/* */ 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

Answer:- (A).
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

Answer:- (C).
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));

Answer:- (B).
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

Answer:- (B).
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

Answer:- (D).
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

Answer:- (D).
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

Answer:- (B).
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

Answer:- (C).
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

Answer:- (A).
Explanations :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.
Q10.Which of the following is not the method to represent Sparse Matrix?
  1. Dictionary of Keys
  2. Linked List
  3. Array
  4. Heap

Answer:- (D).
Explanations :Heap is not used to represent Sparse Matrix while in Dictionary, rows and column numbers are used as Keys and values as Matrix entries, Linked List is used with each node of Four fields (Row, Column, Value, Next Node) (2D array is used to represent the Sparse Matrix with three fields (Row, Column, Value).