# Data Structure MCQ - Matrix

This section focuses on the "Matrix" in Data Structure. These Multiple Choice Questions (MCQ) should be practiced to improve the Data Structure skills required for various interviews (campus interviews, walk-in interviews, company interviews), placements, entrance exams and other competitive examinations.

1. What is the order of a matrix?

A. number of rows multiplied number of columns

B. number of columns multiplied number of rows

C. number of rows multiplied number of rows

D. number of columns multiplied number of columns

View Answer

Ans : A

Explanation: The order of the matrix is the number of rows X number of columns.

2. How do you allocate a matrix using a single pointer in C? (M and N are the number of rows and columns respectively)

A. int *arr = malloc(M * N * sizeof(int));

B. int *arr = (int *)malloc(M * N * sizeof(int));

C. int *arr = (int *)malloc(M + N * sizeof(int));

D. int *arr = (int *)malloc(M * N * sizeof(arr));

View Answer

Ans : B

Explanation: Total number of elements in the matrix will be M*N

3.Which of the following don’t use matrices?

A. In solving linear equations

B. Image processing

C. Graph theory

D. Sorting numbers

View Answer

Ans : D

Explanation : Sorting numbers don’t use matrices.

4. Matrix A when multiplied with Matrix C gives the Identity matrix I, what is C?

A. Identity matrix

B. Inverse of A

C. Square of A

D. Transpose of A

View Answer

Ans : B

Explanation : Any square matrix when multiplied with its inverse gives the identity matrix. Note that non square matrices are not invertible.

5. What is the relation between Sparsity and Density of a matrix?

A. Sparsity = 1 – Density

B. Sparsity = 1 + Density

C. Sparsity = Density*Total number of elements

D. Sparsity = Density/Total number of elements

View Answer

Ans : A

Explanation : Sparsity of a matrix is equal to 1 minus Density of the matrix.

6. Who coined the term Matrix?

A. Harry Markowitz

B. James Sylvester

C. Chris Messina

D. Arthur Cayley

View Answer

Ans : B

Explanation: James Sylvester coined the term Matrix.

7. Who coined the term Sparse Matrix?

A. Harry Markowitz

B. James Sylvester

C. Chris Messina

D. Arthur Cayley

View Answer

Ans : A

Explanation: Harry Markowitz coined the term Sparse Matrix. James Sylvester coined the term Matrix. Chris Messina coined the term Hashtag and Arthur Cayley developed the algebraic aspects of a matrix.

8.Which of the following is not the method to represent Sparse Matrix?

A. Dictionary of Keys

B. Linked List

C. Array

D. Heap

View Answer

Ans : D

Explanation : Heap is not the method to represent Sparse Matrix.

9. Which one of the following is a Special Sparse Matrix?

A. Band Matrix

B. Skew Matrix

C. Null matrix

D. Unit matrix

View Answer

Ans : A

Explanation : A band matrix is a sparse matrix whose non zero elements are bounded to a diagonal band, comprising the main diagonal and zero or more diagonals on either side.

10. Which of the following is the way to represent Sparse Matrix?

A. Arra

B. Linked list

C. Both A and B

D. None of the above

View Answer

Ans : C

Explanation : Sparse Matrix Representations can be done in many ways following are two common representations : Array representation and Linked list representation

Discussion