# 50+ Sparse Array MCQs with FREE PDF

We have the best collection of the Sparse Array MCQs and answer with FREE PDF. These Sparse Array MCQs will help you to prepare for any competitive exams like: BCA, MCA, GATE, GRE, IES, PSC, UGC NET, DOEACC Exams at all levels – you just have to practice regularly.

## Sparse Array MCQs

#### 1. 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 6

b) 6 and 2

c) 2 and 6

d) 2 and 2

Answer: 6 and 2

#### 2. What is sparsity of a matrix?

a) The fraction of zero elements over the total number of elements

b) The fraction of non-zero elements over the total number of elements

c) The fraction of total number of elements over the zero elements

d) The fraction of total number of elements over the non-zero elements

Answer: The fraction of zero elements over the total number of elements

#### 3. What is the functionality of the following piece of code?

``````public Object function(int row_index, int col_index)
{
if (row_index < 0 || col_index > N)
{
System.out.println("column index out of bounds");
return;
}
return (sparse_array[row_index].fetch(col_index));
}
``````

a) Store the element in the specified position

b) Get the element from the specified position

c) Alter the element in the specified position

d) Removes the element from the specified position

Answer: Get the element from the specified position

#### 4. Which of the following is the disadvantage of sparse matrices over normal matrices?

a) Size

b) Speed

c) Easily compressible

d) Algorithm complexity

#### 5. 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

Answer: An array in which most of the elements have the same value

#### 6. 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

Answer: When the array has more occurrence of zero elements

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

Answer: Sparse array is memory efficient