Rotation and Reversal Array Operation MCQs

Rotation and Reversal Array Operation MCQs

 Q1. Which of the following is the predefined function for array reversal in C++?. 

A. rotate(). 

B. arr_rotate(). 

C. array_rotate(). 

D. rot(). 

Answer= rotate()


Q2. How many arguments are required by the predefined function rotate() in C++?. 

A. 1. 

B. 2. 

C. 3. 

D. 4. 

Answer= 3


Q3. Predefined function rotate() in C++ is available under which header file?. 

A. math. 

B. stdio. 

C. stdlib. 

D. algorithm. 

Answer= algorithm


Q4. Which of the following algorithm to rotate an array has the maximum time complexity?. 

A. rotate elements one by one. 

B. juggling algorithm. 

C. reversal algorithm. 

D. using a temporary array. 

Answer= rotate elements one by one


Q5. What is the time complexity of the juggling algorithm to rotate an array?. 

A. O(1). 

B. O(n). 

C. O(d). 

D. O(n*d). 

Answer= O(n)


Q6. Reversal algorithm and juggling algorithm for array rotation have the same time complexity.. 

A. TRUE. 

B. FALSE. 

C.  Nothing Can be said. 

D.  None of the mentioned. 

Answer= TRUE


Q7. What will be the minimum number of jumps required to reach the end of the array arr[] = {1,3,6,3,6,8,5}?. 

A. 1. 

B. 2. 

C. 3. 

D. not possible to reach the end. 

Answer= 3


Q8. What will be the minimum number of jumps required to reach the end of the array arr[] ={0,1,3,6,3,6,8,5}?. 

A. 1. 

B. 2. 

C. 3. 

D. not possible to reach the end. 

Answer= not possible to reach the end


Q9. What will be the minimum number of jumps required to reach the end of the array arr[] = {1,2,0,0,3,6,8,5}?. 

A. 1. 

B. 2. 

C. 3. 

D. not possible to reach the end. 

Answer= not possible to reach the end


Q10. It is not possible to find the minimum number of steps to reach the end of an array in linear time.. 

A. TRUE. 

B. FALSE. 

C.  Nothing can be said. 

D.  None of the mentioned. 

Answer= FALSE


Q11. In how many different ways we can reach the end of the array arr[]={1,3,5,8,9}?. 

A. 1. 

B. 2. 

C. 3. 

D. 4. 

Answer= 4


Q12. It is not possible to reach the end of an array if any element of the array is 0.. 

A. TRUE. 

B. FALSE. 

C.  Nothing can be said. 

D.  None of the mentioned. 

Answer= FALSE


Q13. What is the minimum possible time complexity to find the number of steps to reach the end of an array?. 

A. O(n). 

B. O(n2). 

C. O(n3/2). 

D. O(1). 

Answer= O(n)


Q14. What is a skip list?. 

A. a linkedlist with size value in nodes. 

B. a linkedlist that allows faster search within an ordered sequence. 

C. a linkedlist that allows slower search within an ordered sequence. 

D. a tree which is in the form of linked list. 

Answer= a linkedlist that allows faster search within an ordered sequence


Q15. Consider the 2-level skip listHow to access 38?. 

A. travel 20-30-35-38. 

B. travel 20-30-40-38. 

C. travel 20-38. 

D. travel 20-40-38. 

Answer= travel 20-30-35-38


Q16. Skip lists are similar to which of the following datastructure?. 

A. stack. 

B. heap. 

C. binary search tree. 

D. balanced binary search tree. 

Answer= balanced binary search tree

Previous Post Next Post