What is a sparse array?
a) Data structure for representing arrays of records
b) Data structure that compactly stores bits
c) An array in which most of the elements have the same value
d) An array in which memory is allocated in run time
Explanation: They are set to a default value, usually 0 or null.
When do you use a sparse array?
a) When there are unique elements in the array
b) When the array has more occurrence of zero elements
c) When the data type of elements differ
d) When elements are sorted
Explanation: It need not necessarily be zero, it could be any default value, usually zero or null.
What is the difference between a normal(naive) array and a sparse array?
a) Sparse array can hold more elements than a normal array
b) Sparse array is memory efficient
c) Sparse array is dynamic
d) A naive array is more efficient
Explanation: A naive implementation allocates space for the entire size of the array, whereas a sparse array(linked list implementation) allocates space only for the non-default values.
What is the order of a matrix?
a) number of rows X number of
columns
b) number of columns X number of rows
c) number of rows X number of rows
d) number of columns X number of columns
Explanation: The order of the matrix is the number of rows X number of columns.
Which of the following property does not hold for matrix multiplication?
a) Associative
b) Distributive
c) Commutative
d) Additive Inverse
Explanation: In matrix multiplication, AB != BA
Which of the following is an advantage of matrices?
a) Internal complexity
b) Searching through a matrix is complex
c) Not space efficient
d) Graph Plotting