Sparse and Suffix Array MCQs

Sparse  and Suffix Array MCQs

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


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


Q3. What are the advantages of sparse matrices over normal matrices?. 

A. Size. 

B. Speed. 

C. Easily compressible. 

D. All of the mentioned. 

Answer= All of the mentioned


Q4. Which of the following is false?. 

A. Suffix array is always sorted. 

B. Suffix array is used in string matching problems. 

C. Suffix array is always unsorted. 

D. Suffix array contains all the suffixes of the given string. 

Answer= Suffix array is always unsorted


Q5. 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= 2 8 7 4 9 0 5 1 6 3


Q6. 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= depth-first


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

A. TRUE. 

B. Fasle. 

C.  Nothing can be said. 

D.  None of the mentioned. 

Answer= Fasle


Q8. 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= O(n2logn)


Q9. 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= 5 0 6 10 2 3 8 4 9 1 7


Q10. LCP array and ______ is used to construct suffix tree.. 

A. Hash tree. 

B. Hash trie. 

C. Suffix array. 

D. Balanced tree. 

Answer= Suffix array


Q11. 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= O(mlogn)


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

A. TRUE. 

B. FALSE. 

C.  Nothing can be said. 

D.  None of the mentioned. 

Answer= TRUE


Q13. 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= All I, II and III


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

Answer= number of rows X number of columns


Q15. Which of the following property does not hold for matrix multiplication?. 

A. Associative. 

B. Distributive. 

C. Commutative. 

D. None of the mentioned. 

Answer= Commutative


Q16. How do you allocate a matrix using a single pointer in C?(r and c are the number of rows and columns respectively). 

A. int *arr = malloc(r * c * sizeof(int));. 

B. int *arr = (int *)malloc(r * c * sizeof(int));. 

C. int *arr = (int *)malloc(r + c * sizeof(int));. 

D. int *arr = (int *)malloc(r * c * sizeof(arr));. 

Answer= int *arr = (int *)malloc(r * c * sizeof(int));


Previous Post Next Post