Sparse Array MCQs and Answers

[Solved] Which of the following is the disadvantage of sparse matrices over normal matrices?

Which of the following is the disadvantage of sparse matrices over normal matrices? a) Sizeb) Speedc) Easily compressibled) Algorithm complexity Answer: dExplanation: As the sparse matrix contains zeroes we will compute operations only on non-zero values. This increases the complexity of the algorithm as we need to identify the index of zero elements first and …

[Solved] Which of the following is the disadvantage of sparse matrices over normal matrices? Read More »

[Solved] What is sparsity of a matrix? (MCQ)

What is sparsity of a matrix? a) The fraction of zero elements over the total number of elementsb) The fraction of non-zero elements over the total number of elementsc) The fraction of total number of elements over the zero elementsd) The fraction of total number of elements over the non-zero elements Answer: aExplanation: The sparsity …

[Solved] What is sparsity of a matrix? (MCQ) Read More »

[Solved] Suppose the contents of an array A are, A = {1, null, null, null, null, 10};

Suppose the contents of an array A are, A = {1, null, null, null, null, 10}; What would be the size of the array considering it as a normal array and a sparse array? a) 6 and 6b) 6 and 2c) 2 and 6d) 2 and 2 Answer: bExplanation: A normal array considers null also …

[Solved] Suppose the contents of an array A are, A = {1, null, null, null, null, 10}; Read More »

[Solved] What is the difference between a normal(naive) array and a sparse array?

What is the difference between a normal(naive) array and a sparse array? a) Sparse array can hold more elements than a normal arrayb) Sparse array is memory efficientc) Sparse array is dynamicd) A naive array is more efficient Answer: bExplanation: A naive implementation allocates space for the entire size of the array, whereas a sparse …

[Solved] What is the difference between a normal(naive) array and a sparse array? Read More »

[Solved] When do you use a sparse array? (MCQ)

When do you use a sparse array? a) When there are unique elements in the arrayb) When the array has more occurrence of zero elementsc) When the data type of elements differd) When elements are sorted Answer: bExplanation: It need not necessarily be zero, it could be any default value, usually zero or null.

[Solved] What is a sparse array? (MCQ)

What is a sparse array? a) Data structure for representing arrays of recordsb) Data structure that compactly stores bitsc) An array in which most of the elements have the same valued) An array in which memory is allocated in run time Answer: cExplanation: They are set to a default value, usually 0 or null.