Explore topic-wise MCQs in Data Structures and Algorithms.

This section includes 30 Mcqs, each offering curated multiple-choice questions to sharpen your Data Structures and Algorithms knowledge and support exam preparation. Choose a topic below to get started.

1.

Suffix array is space efficient and faster than the suffix tree.

A. True
B. Fasle
Answer» C.
2.

Who coined the term Sparse Matrix?

A. Harry Markowitz
B. James Sylvester
C. Chris Messina
D. Arthur Cayley
Answer» B. James Sylvester
3.

What will be the suffix array of the string 'engineering'?

A. 2 3 8 4 9 1 7 5 0 6 10
B. 5 0 6 1 4 9 1 7 0 2 3 8
C. 5 0 6 10 2 4 9 1 7 3 8
D. 5 0 6 10 2 3 8 4 9 1 7
Answer» E.
4.

If comparison based sorting algorithm is used construct the suffix array, then what will be time required to construct the suffix array?

A. O(nlogn)
B. O(n2)
C. O(n2logn)
D. O(n2) + O(logn)
Answer» D. O(n2) + O(logn)
5.

Is Sparse Matrix also known as Dense Matrix?

A. True
B. False
Answer» C.
6.

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

A. Dictionary of Keys
B. Linked List
C. Array
D. Heap
Answer» E.
7.

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» B. Total number of Zero elements = m + n
8.

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

A. Heap
B. Binary tree
C. Hash table
D. Adjacency List
Answer» C. Hash table
9.

Which one of the following is a Special Sparse Matrix?

A. Band Matrix
B. Skew Matrix
C. Null matrix
D. Unit matrix
Answer» B. Skew Matrix
10.

Which of the following bitwise operations will you use to set a particular bit to 0?

A. OR
B. AND
C. XOR
D. NAND
Answer» C. XOR
11.

What are some of the applications of sorted arrays?

A. Commercial computing
B. Priority Scheduling
C. Discrete Mathematics
D. All of the mentioned
Answer» E.
12.

Suffix array of the string 'statistics' is ____________

A. 2 8 7 4 9 0 5 1 6 3
B. 2 7 4 9 8 0 5 1 6 3
C. 2 4 9 0 5 7 8 1 6 3
D. 2 8 7 0 5 1 6 9 4 3
Answer» B. 2 7 4 9 8 0 5 1 6 3
13.

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

A. Identity Matrix
B. Unit Matrix
C. Sparse Matrix
D. Zero Matrix
Answer» D. Zero Matrix
14.

To search for an element in a sorted array, which searching technique can be used?

A. Linear Search
B. Jump Search
C. Binary Search
D. Fibonacci Search
Answer» D. Fibonacci Search
15.

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» E.
16.

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» B. Sparsity = 1 + Density
17.

LCP array and ______ is used to construct suffix tree.

A. Hash tree
B. Hash trie
C. Suffix array
D. Balanced tree
Answer» D. Balanced tree
18.

Suffix array can be created by performing __________ traversal of a suffix tree.

A. breadth-first
B. level order
C. depth-first
D. either breadth-first or level order
Answer» D. either breadth-first or level order
19.

What is the time required to locate the occurrences of a pattern P of length m in a string of length n using suffix array?

A. O(nm)
B. O(n2)
C. O(mnlogn)
D. O(mlogn)
Answer» E.
20.

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

A. True
B. False
Answer» B. False
21.

Suffix array can be created in O(nlogn) time.

A. True
B. False
Answer» B. False
22.

Which of the following is/are advantages suffix array one suffix tree?I. Lesser space requirementII. Improved cache localityIII. Easy construction in linear time

A. Only I
B. All I, II and III
C. Only I and III
D. Only II and III
Answer» C. Only I and III
23.

If row-major order is used, how is the following matrix stored in memory?a b cd e fg h i

A. ihgfedcba
B. abcdefghi
C. cfibehadg
D. adgbehcfi
Answer» C. cfibehadg
24.

What is the worst case time complexity of inserting an element into the sorted array?

A. O(nlogn)
B. O(logn)
C. O(n)
D. O(n2)
Answer» D. O(n2)
25.

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» C. Square of A
26.

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» E.
27.

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» B. The fraction of non-zero elements over the total number of elements
28.

What are the advantages of sparse matrices over normal matrices?

A. Size
B. Speed
C. Easily compressible
D. All of the mentioned
Answer» E.
29.

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» C. 2 and 6
30.

If column-major order is used, how is the following matrix stored in memory?a b cd e fg h i

A. ihgfedcba
B. abcdefghi
C. cfibehadg
D. adgbehcfi
Answer» E.