MCQ On MATLAB
MCQ On MATLAB
The space located for the matrix generated from the spones command is _______
A. Same as a sparse matrix
B. Same as the original matrix
C. Same as an identity matrix
D. Double that of the sparse matrix
ANSWER: A
How can we smoothen the following graph of sin (t) and cos (t) into a circle?
A. reduce the gap between linearly spaced elements of the dependent variable t
B. reduce the gap between elements of the dependent variable t
C. increase the gap between linearly spaced elements of the dependent variable t
D. increase the gap between elements of the dependent variable t
ANSWER: A
How can several graphs for the same function be plotted on the same window?
A. Contour plots
B. Bode plots
C. 3-D plots
D. n-D plots
ANSWER: A
What is the slope of the sawtooth waveform generated by the sawtooth command?
A. 1/pi
B. pi
C. 1/(2*pi)
D. 2*pi
ANSWER: A
What is the period of the sawtooth() waveform which is generated by the sawtooth()
command?
A. 2*pi
B. pi*2
C. pi
D. 3*pi/2
ANSWER: A
Which command can be used to generate multiple graphs in the same window?
A. hold on
B. wait
C. not possible without contour command
D. not possible
ANSWER: A
In a 2-d Plot, which command will make the axes of the graph same?
A. axis square
B. axis equals
C. axes square
D. axes equal
ANSWER: A
What is the output of the following code? title(�x^2+y^2=r^2�)
A. x2+y2 = r2
B. x^2+y^2 = r^2
C. Error
D. No such command
ANSWER: A
Amongst multiple elseif and nested if, which would take less runtime?
A. multiple elseif
B. nested if
C. elseif
D. elseif & nested if
ANSWER: A
What is the output of the following code? if((-10 &&00)||(20134 && 900)) ,
fprintf("%s","True."), else, fprintf("%s","False."), end
A. True
B. False
C. Error
D. Nan
ANSWER: A
What is the output of the following code? i=0; for i=0:2 i=1;
end
A. Output is suppressed
B. Output shows 1 3 times
C. Output shows 1 2 times
D. Error
ANSWER: A
In nested loops, the break statement, if present within a nested if the structure,
will exit the _______
A. Ongoing if structure
B. Entire loop
C. Ongoing loop
D. Entire if structure
ANSWER: B
Multiple graphs can be plotted, in the same window, if we use the ___ command in a
loop.
A. hold on
B. held on
C. hold off
D. not possible
ANSWER: A
How much does the precision change while finding sin(x) using evalc and eval?
A. 10%
B. 2%
C. 20%
D. No change
ANSWER: D
Which of these is the way to access the rst element in a vector named v (assuming
there is at least one element in the vector)?
A. v(0)
B. v(1)
C. v
D. v(: , 0)
E. none of the above
ANSWER: B
Which of the following is used to see if two elements are equal in MATLAB?
A. !=
B. ==
C. isequal
D. =
E. none of the above
ANSWER: B
What is the value of ans that is printed when the following code is run:
isnumeric(32)
A. 1
B. 0
C. 32
D. yes
E. true
ANSWER: A
This Matlab command clears all data and variables stored in memory:
A. clc
B. clear
C. delete
D. deallocate
E. none of the above
ANSWER: B
7. To better manage memory and prevent unnecessary memory allocations, Matlab uses:
A. vectors
B. scalars
C. matrix math
D. delayed copy
E. licenses
ANSWER: D
8. To print a newline in a fprintf statement, you must use the following escape
character:
A. \t
B. \nl
C. \nxt
D. \n
E. none of the above
ANSWER: D
9. In Matlab, this keyword immediately moves to the next iteration of the loop:
A. update
B. goto
C. continue
D. break
E. none of the above
ANSWER: C
A student is repeatedly calling a function file but gets no output. She has checked
the file repeatedly so finally she asked her teacher about it. The teacher checked
everything and finds the error and gives her a scolding. What is a silly mistake?
A. She was calling the wrong function
B. She has placed a semicolon at the end of the line which computes the desired
values
C. She has called a .m file
D. She was calling a script file
ANSWER: B
A function is not returning values according to desired input values. What should
be the correction?
A. Include clear all at the beginning of function file
B. Include close all at the beginning of function file
C. Include echo on in the function file
D. Cannot be solved
ANSWER: A
The command used to reflect the files from a disk into the workspace is _______
A. load
B. show
C. disp()
D. it is not possible
ANSWER: A
What would be the output of the following code (in editor window)? A = [1 0 2]
; b = [3 0 7] ; c=a.*b;
A. [2 0 21]
B. [3 0 14]
C. [14 0 3]
D. [7 0 3]
ANSWER: B
What would be the output of the following code (in editor window)? a=1:5 ;
c=a.^2
A. [1 25]
B. [1 2 3 4 5]
C. [25 16 9 4 1]
D. [1 4 9 16 25]
ANSWER: D
What would be the output of the following code (in editor window)? A = [1 1
0 0] B = [1 ;2 ;3 ;4] C=A*B
A. 0
B. [1 0 0 0]
C. 3
D. [1 2 0 0]
ANSWER: C
What would be the output of the following code (in editor window)? A = [1 2;
3 4] C = A^2
A. [7 10; 15 22]
B. [1 4; 9 16]
C. [16 9; 4 1]
D. [22 15; 10 7]
ANSWER: A
If the result of our summation is Infinity, what will MATLAB show?
A. Infinity
B. Nan
C. Inf
D. Error
ANSWER: C
What is the error in the following code? for i={1: 10}; p=a+1; end;
A. None
B. {}
C. The : operator
D. Cannot be determined
ANSWER: A
What is the output of the following command? >> x={1 2 3}; >> t=[1 2
3]; >> plot(x,t)
A. plots a ramp function
B. plots r(t)-r(t-3)
C. Error due to plot
D. Error due to x
ANSWER: D
A student has to find a solution for a system of equations having three variables.
He has defined the coefficient matrix as C while the variable matrix as d. He
observes that the system is homogeneous. So, to find the solution, he must first
check
A. Consistency
B. Homogeneity
C. Heterogeneity
D. Linearity
ANSWER: A
The command to find the eigen vector of a matrix in matrix form is _____________
A. eig(a,matrix)
B. eig(a,�matrix�)
C. eigen(a,matr)
D. eig(A.
ANSWER: B
Checking the linearity of a system, the first thing we need to check is whether the
system is __________
A. Homogeneous or not
B. Consistent or not
C. Superposition
D. Depends on the representation of the system
ANSWER: D
To represent only two digits after the decimal point, the format we use is ______
A. Long e
B. Short
C. Hex
D. Bank
ANSWER: D
What are the minimum numbers of expressions which will be required to express a
mathematical relation?
A. At least 1
B. At least 2
C. At most 1
D. Depends on the number of variables
ANSWER: A
The teacher has given the assignment to find the sum of 2 numbers. But the code
should not contain the �+� operator. What is to be done?
A. Use a function
B. Add the values and print the sum directly
C. Use an expression
D. Cannot be done
ANSWER: A