This set of MATLAB Multiple Choice Questions & Answers (MCQs) focuses on “Vectors and Matrices – 1”.

1. Vectors depend upon brackets while scalars don’t.**a) True**

b) False

2. How many errors will MATLAB show if the following code entered?

A=[1;2;3]; B=[1 2]; C=A.*B;D=C*A;

a) 2**b) 1**

c) No error

d) 4

3. To see the sub-matrix with a_{ij} for 2<=i<=4 and 1<=j<=2 of a matrix a, of order 5*6, which code is used?

a) a(2;4,1;2)

b) a(2,4:1,2)**c) a(2:4,1:2)**

d) a(2,4;1,2)

4. Which code shows the use of ellipsis in MATLAB?**a)**

A = [1 2 3;... 5 6 7]

b) A = [1;2’3]

c)

A = [1;2.. 3;4]

5. What is the symbol used to evaluate the transpose of a vector?

a) “ ^ ”

b) “ * ”**c) “ ‘ ”**

d) “ ~ ”

6. What is the advantage of MATLAB over other computing software with matrix dimensions?

a) No advantage

b) Real time pre-defined memory allocation**c) Real time user-defined memory allocation**

d) Matrix operations are easily computed

7. Which code will help to concatenate two matrices easily in 2 dimensions?

Matrices: A = 1 2 B = 1 2 3 4 3 4

a) cat(A,B)**b) cat(2,[1 2;3 4], [1 2; 3 4])**

c) cat(2;[1 2,3 4]; [1 2, 3 4])

d) cat([1 2;3 4], [1 2; 3 4])

8. Which code can be used for changing the dimensions of a matrix as follows?

Input matrix: 1 2 3 Output matrix: 1 4 2 5 3 6 4 5 6

**a) reshape([1,2,3;4,5,6],1,6)**

b) reshape([1,2,3;4,5,6];1;6)

c) reshape([1,2,3;4,5,6]:1:6)

d) reshape([1,2,3;4,5,6],6,1)

9. What is the function used to multiply a matrix, A, with itself n times?**a) mtimes(A,n)**

b) ntimes(A,n)

c) mtimes(n,A)

d) mtimes(A^n)

10. Which code is used to solve the system of linear equation: A.(x^{2})= B?

A = 1 4 B = 1 2 1 4 1 2

**a) sqrt([1 4;1 4]/[1 2;1 2])**

b) Inf

c) sqrt([1 4,1 4]/[1 2,1 2])

d) sqrt[(1 4;1 4]/[1 2;1 2)]

11. Which operator set is used for left and right division respectively?**a) .\ and ./**

b) ./ and .\

c) Left division and right division is not available in MATLAB

d) / and \

12. If A and B are two matrices, such that a./b=b.\a, what is concluded?**a) Nothing special**

b) A = A^{T}

c) A = A^{-1}

d) A = A

13. If a./b=(b./a)^{T}, what can be concluded about the matrices a and b?**a) a = b ^{T}**

b) a = b

^{-1}

c) a = b’

d) nothing special

14. What is the difference between a[] and a{}?

a) a[] is for empty cell array while a{} is for empty linear array**b) a[] is for empty linear array while a{} is for empty cell array**

c) No difference

d) a[] is an empty row vector while a{} is an empty column vector

15. Choose the function to solve the following problem, symbolically, in the easiest way.

3x+y=5 and 2x+3y=7

**a) linsolve(x,y) where x and y are the co-efficient and result matrix respectively**

b) solve(x,y) where x and y are the co-efficient and result matrix respectively

c) sol(x,y) where x and y are the co-efficient and result matrix respectively

d) the equations are not solvable

16. What is the output of the following code?

A=[1 2 3.. ];

a) The output is suppressed

b) A row vector

c) A row vector concatenated with a null matrix**d) Error**

17. What is the output of the following code?

A=[1 2 a..; ];

**a) Error due to a**

b) Error due to A

c) Error due to [];

d) Error due to ;

18. What is the output of the following code?

A=[1 2 ‘a’;… ];

a) Error due to ‘a’

b) Error due to ‘…’

c) Error due to []**d) ‘a’**

19. What is the output of the following code?

A=[1 2 ‘a’;… ‘f’ ‘q’ ‘w’];

a) A 2*3 character array**b) A 3*2 character matrix**

c) A 3*2 character vector

d) A 2*3 character vector

20. What is the output of the following code?

A=[1 2 ‘a’;… ‘f’ ‘q’ ‘w’;… ]];

**a) Syntax Error**

b) A 2*3 character matrix

c) The concatenation of 2 vectors, vertically, with size 3

d) Cannot be determined

21. What is the output of the following code?

A=[1 2 ‘a’…; ‘a’ ‘b’ ‘c’;… ];

**a) Error in syntax**

b) A 3*2 matrix of characters

c) Error due to 1 and 2

d) Error due to a

22. What is the output of the following code?

A=[1 2 ‘a’….; ‘a’ ‘b’ ‘c’;… ];

**a) A 1*6 matrix**

b) A 6*1 matrix

c) Error in the code

d) Error in ellipsis

23. What is the output of the following code?

a) Clears the workspace

b) Clears the matrices

c) Clears the vectors**d) Clears ALL**

24. All matrices are vectors but all vectors are not matrices in MATLAB.**a) True**

b) False

25. What is the output of the following code?

ismatrix([]);

**a) logical 1**

b) logical 0

c) logical -1

d) Error

26. What is the output of the following code?

isvector([]);

a) 1**b) 0**

c) Syntactical error

d) Logical error

27. If the dimensions of vectors don’t match, the plot command will always give an error.

a) True**b) False**