Contents

Which of the following form inversion in the array arr = {1,5,4,2}?
a) (5,4), (5,2)
b) (5,4), (5,2), (4,2)
c) (1,5), (1,4), (1,2)              
d) (1,5)

b

Explanation: The necessary condition for an inversion is arr[i]>arr[j] and i<j. So there are 3 inversions in the array. These are (5,4), (5,2), (4,2).


What will be the resulting array after reversing arr[]={3,5,4,2}?
a) 2,3,5,4                                              
b) 4,2,3,5
c) 5,4,2,3                                              
d) 2,4,5,3

d

Explanation: The resulting array upon reversing after reversal is arr[]={2,4,5,3}. We can implement an algorithm for this purpose in various possible ways.


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

c

Explanation: Each element of the array represents the maximum number of steps that can be taken forward from that element. If the first element is 0 then it is not possible to reach the end.


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

d

Explanation: Each element of the array represents the maximum number of steps that can be taken forward from that element. So as the first element here is 0 so we cannot move any further from the first element. Thus, it is not possible to reach the end of the array.


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

b

Explanation: It is a datastructure, which can make search in sorted linked list faster in the same way as binary search tree and sorted array (using binary search) are faster.


Skip lists are similar to which of the following datastructure?
a) stack                                 
b) heap
c) binary search tree
d) balanced binary search tree

d