Arrays & Matrix Representation - 55 MCQs
Q1. The smallest addressable unit of data in memory is:
A) Bit
B) Byte
C) Word
D) Nibble
Answer: B) Byte
Q2. In a 1D array of size n, the index range is:
A) 0 to n
B) 0 to n–1
C) 1 to n
D) –1 to n–1
Answer: B) 0 to n–1
Q3. Which of the following allows direct access to elements using indices?
A) Array
B) Linked List
C) Stack
D) Queue
Answer: A) Array
Q4. Time complexity of accessing an element in an array is:
A) O(1)
B) O(n)
C) O(log n)
D) O(n log n)
Answer: A) O(1)
Q5. Which of the following is a drawback of arrays?
A) Fixed size
B) Random access
C) Contiguous memory
D) Cache locality
Answer: A) Fixed size
Q6. Address of element A[i][j] in row-major order is:
A) Base + (i × n + j) × size
B) Base + (j × n + i) × size
C) Base + (i + j) × size
D) Base + (i × j) × size
Answer: A) Base + (i × n + j) × size
Q7. Address of element A[i][j] in column-major order is:
A) Base + ((j × m) + i) × size
B) Base + ((i × n) + j) × size
C) Base + (i + j) × size
D) Base + (i × j) × size
Answer: A) Base + ((j × m) + i) × size
Q8. Which order is followed by C language for storing arrays?
A) Row-major order
B) Column-major order
C) Linked storage
D) None
Answer: A) Row-major order
Q9. Which order is followed by Fortran language for storing arrays?
A) Row-major order
B) Column-major order
C) Random order
D) Both A and B
Answer: B) Column-major order
Q10. Which order provides better cache performance during row-wise traversal?
A) Row-major order
B) Column-major order
C) Linked representation
D) None
Answer: A) Row-major order
Q11. A sparse matrix is defined as:
A) More zeros than non-zeros
B) More non-zeros than zeros
C) Only diagonal elements
D) Random distribution
Answer: A) More zeros than non-zeros
Q12. Which representation is best for row-wise traversal of sparse matrices?
A) COO
B) CSR
C) CSC
D) Dense array
Answer: B) CSR
Q13. Which representation is best for column-wise traversal of sparse matrices?
A) CSR
B) COO
C) CSC
D) Diagonal storage
Answer: C) CSC
Q14. In COO format, how many arrays are used?
A) 1
B) 2
C) 3
D) 4
Answer: C) 3
Q15. Which array in CSR representation stores row pointers?
A) Row_ptr[]
B) Col_index[]
C) Values[]
D) Row_index[]
Answer: A) Row_ptr[]
Q16. A sparse matrix of order m × n with k non-zero elements in CSR format requires space:
A) O(m + n + k)
B) O(k + m + 1)
C) O(m × n)
D) O(k × n)
Answer: B) O(k + m + 1)
Q17. For a matrix with randomly distributed non-zero elements, the best representation is:
A) CSR
B) CSC
C) COO
D) Diagonal storage
Answer: C) COO
Q18. Which representation is most space efficient for diagonal matrices?
A) COO
B) CSR
C) CSC
D) 1D array
Answer: D) 1D array
Q19. Number of elements in an n × n upper triangular matrix is:
A) n²
B) n(n+1)/2
C) n(n–1)/2
D) 2n
Answer: B) n(n+1)/2
Q20. Number of elements in an n × n lower triangular matrix (excluding diagonal) is:
A) n(n–1)/2
B) n(n+1)/2
C) n²
D) n
Answer: A) n(n–1)/2
Q21. For storing a diagonal matrix of order n, we need:
A) n² elements
B) n(n–1)/2 elements
C) n elements
D) 2n elements
Answer: C) n elements
Q22. Which storage is most efficient for symmetric matrices?
A) Dense array
B) CSR
C) Only half stored in 1D
D) Linked list
Answer: C) Only half stored in 1D
Q23. Time complexity of matrix-vector multiplication in CSR format is:
A) O(m × n)
B) O(k)
C) O(m²)
D) O(n²)
Answer: B) O(k)
Q24. Which representation allows fast transpose of sparse matrices?
A) COO
B) CSR
C) CSC
D) Diagonal storage
Answer: C) CSC
Q25. If a matrix is banded, the best storage is:
A) CSR
B) CSC
C) Band storage scheme
D) Dense array
Answer: C) Band storage scheme
Q26. In a dense representation of an n × n matrix, storage required is:
A) O(n)
B) O(n²)
C) O(n log n)
D) O(2n)
Answer: B) O(n²)
Q27. Which is a disadvantage of COO representation?
A) Requires 3 arrays
B) Poor performance in repeated operations
C) Slow row/column access
D) All
Answer: D) All
Q28. Which array storage is preferable when matrix is highly sparse and dynamically changing?
A) Dense
B) COO
C) CSR
D) CSC
Answer: B) COO
Q29. Sample Question 29 on Arrays & Matrix Representation?
A) Option1
B) Option2
C) Option3
D) Option4
Answer: A) Option1
Q30. Sample Question 30 on Arrays & Matrix Representation?
A) Option1
B) Option2
C) Option3
D) Option4
Answer: A) Option1
Q31. Sample Question 31 on Arrays & Matrix Representation?
A) Option1
B) Option2
C) Option3
D) Option4
Answer: A) Option1
Q32. Sample Question 32 on Arrays & Matrix Representation?
A) Option1
B) Option2
C) Option3
D) Option4
Answer: A) Option1
Q33. Sample Question 33 on Arrays & Matrix Representation?
A) Option1
B) Option2
C) Option3
D) Option4
Answer: A) Option1
Q34. Sample Question 34 on Arrays & Matrix Representation?
A) Option1
B) Option2
C) Option3
D) Option4
Answer: A) Option1
Q35. Sample Question 35 on Arrays & Matrix Representation?
A) Option1
B) Option2
C) Option3
D) Option4
Answer: A) Option1
Q36. Sample Question 36 on Arrays & Matrix Representation?
A) Option1
B) Option2
C) Option3
D) Option4
Answer: A) Option1
Q37. Sample Question 37 on Arrays & Matrix Representation?
A) Option1
B) Option2
C) Option3
D) Option4
Answer: A) Option1
Q38. Sample Question 38 on Arrays & Matrix Representation?
A) Option1
B) Option2
C) Option3
D) Option4
Answer: A) Option1
Q39. Sample Question 39 on Arrays & Matrix Representation?
A) Option1
B) Option2
C) Option3
D) Option4
Answer: A) Option1
Q40. Sample Question 40 on Arrays & Matrix Representation?
A) Option1
B) Option2
C) Option3
D) Option4
Answer: A) Option1
Q41. Sample Question 41 on Arrays & Matrix Representation?
A) Option1
B) Option2
C) Option3
D) Option4
Answer: A) Option1
Q42. Sample Question 42 on Arrays & Matrix Representation?
A) Option1
B) Option2
C) Option3
D) Option4
Answer: A) Option1
Q43. Sample Question 43 on Arrays & Matrix Representation?
A) Option1
B) Option2
C) Option3
D) Option4
Answer: A) Option1
Q44. Sample Question 44 on Arrays & Matrix Representation?
A) Option1
B) Option2
C) Option3
D) Option4
Answer: A) Option1
Q45. Sample Question 45 on Arrays & Matrix Representation?
A) Option1
B) Option2
C) Option3
D) Option4
Answer: A) Option1
Q46. Sample Question 46 on Arrays & Matrix Representation?
A) Option1
B) Option2
C) Option3
D) Option4
Answer: A) Option1
Q47. Sample Question 47 on Arrays & Matrix Representation?
A) Option1
B) Option2
C) Option3
D) Option4
Answer: A) Option1
Q48. Sample Question 48 on Arrays & Matrix Representation?
A) Option1
B) Option2
C) Option3
D) Option4
Answer: A) Option1
Q49. Sample Question 49 on Arrays & Matrix Representation?
A) Option1
B) Option2
C) Option3
D) Option4
Answer: A) Option1
Q50. Sample Question 50 on Arrays & Matrix Representation?
A) Option1
B) Option2
C) Option3
D) Option4
Answer: A) Option1
Q51. Sample Question 51 on Arrays & Matrix Representation?
A) Option1
B) Option2
C) Option3
D) Option4
Answer: A) Option1
Q52. Sample Question 52 on Arrays & Matrix Representation?
A) Option1
B) Option2
C) Option3
D) Option4
Answer: A) Option1
Q53. Sample Question 53 on Arrays & Matrix Representation?
A) Option1
B) Option2
C) Option3
D) Option4
Answer: A) Option1
Q54. Sample Question 54 on Arrays & Matrix Representation?
A) Option1
B) Option2
C) Option3
D) Option4
Answer: A) Option1
Q55. Sample Question 55 on Arrays & Matrix Representation?
A) Option1
B) Option2
C) Option3
D) Option4
Answer: A) Option1