Variables and Assignments

MATLAB

This set of MATLAB Multiple Choice Questions & Answers (MCQs) focuses on “Variables and Assignments”.

1. Which function is preferable to find the magnitude of a complex number?
a) abs()
b) sqrt()
c) cart2pol()
d) MATLAB does not support complex arguments

2. Which is an escape sequence constant?
a) Esc
b) /n
c) \b
d) nargout

3. All MATLAB computations are done in
a) Single Precision
b) Double Precision
c) Linear accuracy
d) Multi-level precision

4. Which symbol is used to initialise a variable?
a) =
b) ->
c) ==
d) init

5. Choose the correct option.
a) any() shows all the elements in a matrix while all() shows every element of a vector
b) any() is ‘true’ if elements in a vector is zero
c) all() is ‘true’ if every element in a vector is non zero
d) all() is ‘true’ if every element in a vector is 0

6. What operator helps in the transpose of a matrix?
a) “ .’ ”
b) “ ‘ ”
c) “./ ”
d) “ .\ ”

7. What is the difference between the expressions (9*1-8) & (9-1*8)?
a) Computational difference
b) Final results are different
c) No difference
d) Cannot be determined

8. What is the output of the expression

(2*9*Inf)+(9-1*Inf)

a) Inf
b) Error
c) Incomprehensible
d) NaN

9. The expression cos(90) is equal to1 in MATLAB.
a) True
b) False

10. Evaluate the expression:

a=9/1*5/1;  b=a*a/a*a; c=sind(30)+1/2;  d=1-c; e=a+b*c-d

a) 2045
b) 2070
c) Error since sind() is a wrong function
d) 0

Leave a Reply

Your email address will not be published. Required fields are marked *