# Data Structure MCQ - Matrix

Q1.What is the order of a matrix?

- number of rows X number of columns
- number of columns X number of rows
- number of rows X number of rows
- 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).- Associative
- Distributive
- Commutative
- None of these

Answer:- (C).

- int *arr = malloc(r * c * sizeof(int));
- int *arr = (int *)malloc(r * c * sizeof(int));
- int *arr = (int *)malloc(r + c * sizeof(int));
- int *arr = (int *)malloc(r * c * sizeof(arr));

Answer:- (B).

Total number of elements in the matrix will be r*c

**Explanations :**int *arr = (int *)malloc(r * c * sizeof(int));Total number of elements in the matrix will be r*c

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);

- Normal of a matrix
- Trace of a matrix
- Square of a matrix
- Transpose of a matrix

Answer:- (B).

**Explanations :**trace of a matrix is the sum of the principal diagonal elements.- In solving linear equations
- Image processing
- Graph theory
- 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.- Internal complexity
- Searching through a matrix is complex
- Not space efficient
- All of these

Answer:- (D).

**Explanations :**time complexity of a matrix is O(n2) and sometimes the internal organization becomes tedious.- Identity matrix
- Inverse of A
- Square of A
- 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.- Identity Matrix
- Unit Matrix
- Sparse Matrix
- 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- Harry Markowitz
- James Sylvester
- Chris Messina
- 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.- Dictionary of Keys
- Linked List
- Array
- 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).Copyright © 2022 Shineskill Software Pvt. Ltd., All rights reserved.