Matrix and Sparse Matrix MCQs

Matrix and Sparse Matrix MCQs

 Q1. Which of the following are the uses of matrices?. 

A. In solving linear equations. 

B. Image processing. 

C. Graph theory. 

D. All of the mentioned. 

Answer= All of the mentioned


Q2. What is the disadvantage of matrices?. 

A. Internal complexity. 

B. Searching through a matrix is complex. 

C. Not space efficient. 

D. All of the mentioned. 

Answer= All of the mentioned


Q3. 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. 

Answer= Inverse of A


Q4. Which matrix has most of the elements (not all) as Zero?. 

A. Identity Matrix. 

B. Unit Matrix. 

C. Sparse Matrix. 

D. Zero Matrix. 

Answer= Sparse Matrix


Q5. 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. 

Answer= Sparsity = 1 - Density


Q6. Who coined the term Sparse Matrix?. 

A. Harry Markowitz. 

B. James Sylvester. 

C. Chris Messina. 

D. Arthur Cayley. 

Answer= Harry Markowitz


Q7. Is O(n) the Worst case Time Complexity for addition of two Sparse Matrix?. 

A. TRUE. 

B. FALSE. 

C.  Nothing Can be said. 

D.  None of the mentioned. 

Answer= TRUE


Q8. The matrix contains m rows and n columns. The matrix is called Sparse Matrix if ________. 

A. Total number of Zero elements > (m*n)/2. 

B. Total number of Zero elements = m + n. 

C. Total number of Zero elements = m/n. 

D. Total number of Zero elements = m-n. 

Answer= Total number of Zero elements > (m*n)/2


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

A. Dictionary of Keys. 

B. Linked List. 

C. Array. 

D. Heap. 

Answer= Heap


Q10. Is Sparse Matrix also known as Dense Matrix?. 

A. TRUE. 

B. FALSE. 

C.  Nothing Can be said. 

D.  None of the mentioned. 

Answer= FALSE


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

A. Band Matrix. 

B. Skew Matrix. 

C. Null matrix. 

D. Unit matrix. 

Answer= Band Matrix


Q12. In what way the Symmetry Sparse Matrix can be stored efficiently?. 

A. Heap. 

B. Binary tree. 

C. Hash table. 

D. Adjacency List. 

Answer= Binary tree


Q13. What does the number of inversions in an array indicate?. 

A. mean value of the elements of array. 

B. measure of how close or far the array is from being sorted. 

C. the distribution of values in the array. 

D. median value of the elements of array. 

Answer= measure of how close or far the array is from being sorted


Q14. How many inversions does a sorted array have?. 

A. 0. 

B. 1. 

C. 2. 

D. cannot be determined. 

Answer= 0


Q15. What is the condition for two elements arr[i] and arr[j] to form an inversion?. 

A. arr[i]<arr[j] . 

B. i < j. 

C. arr[i] < arr[j] and i < j. 

D. arr[i] > arr[j] and i < j. 

Answer= arr[i] > arr[j] and i < j


Q16. Under what condition the number of inversions in an array are maximum?. 

A. when the array is sorted. 

B. when the array is reverse sorted. 

C. when the array is half sorted. 

D. depends on the given array. 

Answer= when the array is reverse sorted


Q17. Under what condition the number of inversions in an array are minimum?. 

A. when the array is sorted. 

B. when the array is reverse sorted. 

C. when the array is half sorted. 

D. depends on the given array. 

Answer= when the array is sorted


Q18. How many inversions are there in the array arr = {1,5,4,2,3}?. 

A. 0. 

B. 3. 

C. 4. 

D. 5. 

Answer= 5


Q19. Which of the following form inversion in the array arr = {1,5,4,2}?. 

A. (5,4), (5,2). 

B. (5,4), (5,2), (4,2). 

C. (1,5), (1,4), (1,2). 

D. (1,5). 

Answer= (5,4), (5,2), (4,2)


Q20. The time complexity of the code that determines the number of inversions in an array using merge sort is lesser than that of the code that uses loops for the same purpose.. 

A. TRUE. 

B. FALSE. 

C.  Nothing can be said. 

D.  None of the mentioned. 

Answer= TRUE


Q21. What is the time complexity of the code that uses merge sort for determining the number of inversions in an array?. 

A. O(n2). 

B. O(n). 

C. O(log n). 

D. O(n log n). 

Answer= O(n log n)


Q22. What is the time complexity of the code that uses self balancing BST for determining the number of inversions in an array?. 

A. O(n2). 

B. O(n). 

C. O(log n). 

D. O(n log n). 

Answer= O(n log n)


Q23. The time complexity of the code that determines the number of inversions in an array using self balancing BST is lesser than that of the code that uses loops for the same purpose.. 

A. TRUE. 

B. FALSE. 

C.  Nothing can be said. 

D.  None of the mentioned. 

Answer= TRUE


Q24. What is the space complexity of the code that uses merge sort for determining the number of inversions in an array?. 

A. O(n). 

B. O(log n). 

C. O(1). 

D. O(n log n). 

Answer= O(n)


Q25. What will be the resulting array after rotating arr[]={1, 2, 3, 4, 5} by 2?. 

A. 2, 1, 3, 4, 5. 

B. 3, 4, 5, 1, 2. 

C. 4, 5, 1, 2, 3. 

D. 1, 2, 3, 5, 4. 

Answer= 3, 4, 5, 1, 2


Q26. To rotate an array by using the algorithm of rotating its elements one by one is an in place algorithm.. 

A. TRUE. 

B. FALSE. 

C.  Nothing can be said. 

D.  None of the mentioned. 

Answer= TRUE


Q27. What will be the auxiliary space complexity of the code to rotate an array by using the reversal algorithm (d = number of rotations)?. 

A. O(1). 

B. O(n). 

C. O(d). 

D. O(n*d). 

Answer= O(1)

Previous Post Next Post