/* */ Click to Join Live Class with Shankar sir Call 9798158723

# Data Structure MCQ - Matrix

Q1.What is the order of a matrix?
1. number of rows X number of columns
2. number of columns X number of rows
3. number of rows X number of rows
4. number of columns X number of columns

Explanations :By definition, the order of a matrix is number of rows X number of columns, generally denoted by mXn(not compulsory).
Q2.Which of the following property does not hold for matrix multiplication?
1. Associative
2. Distributive
3. Commutative
4. None of these

Q3.How do you allocate a matrix using a single pointer in C?(r and c are the number of rows and columns respectively)
1. int *arr = malloc(r * c * sizeof(int));
2. int *arr = (int *)malloc(r * c * sizeof(int));
3. int *arr = (int *)malloc(r + c * sizeof(int));
4. int *arr = (int *)malloc(r * c * sizeof(arr));

Explanations :int *arr = (int *)malloc(r * c * sizeof(int));
Total number of elements in the matrix will be r*c
What does the following piece of code do?
```for(int i = 0; i < row; i++)
{
for(int j = 0; j < column; j++)
{
if(i == j)
sum = sum + (array[i][j]);
}
}
System.out.println(sum);```
1. Normal of a matrix
2. Trace of a matrix
3. Square of a matrix
4. Transpose of a matrix

Explanations :trace of a matrix is the sum of the principal diagonal elements.
Q5.Which of the following are the uses of matrices?
1. In solving linear equations
2. Image processing
3. Graph theory
4. All of these

Explanations :Solving linear equations is a separate field in Mathematics involving matrices, Image processing stores the pixels in the form of matrices, and the graphs are represented with the help of matrices to indicate the nodes and edges.
Q6.What is the disadvantage of matrices?
1. Internal complexity
2. Searching through a matrix is complex
3. Not space efficient
4. All of these

Explanations :time complexity of a matrix is O(n2) and sometimes the internal organization becomes tedious.
Q7.Matrix A when multiplied with Matrix C gives the Identity matrix I, what is C?
1. Identity matrix
2. Inverse of A
3. Square of A
4. Transpose of A

Explanations :Any square matrix when multiplied with its inverse gives the identity matrix. Note that non square matrices are not invertible.
Q8.Which matrix has most of the elements (not all) as Zero?
1. Identity Matrix
2. Unit Matrix
3. Sparse Matrix
4. Zero Matrix

Explanations :Sparse Matrix is a matrix in which most of the elements are Zero. Identity Matrix is a matrix in which all principle diagonal elements are 1 and rest of the elements are Zero. Unit Matrix is also called Identity Matrix. Zero Matrix is a matrix in which all the elements are Zer
Q9.Who coined the term Sparse Matrix?
1. Harry Markowitz
2. James Sylvester
3. Chris Messina
4. Arthur Cayley