Professional Documents
Culture Documents
DS........
DS........
DS........
a. 1 1 1 0
0010
1100
b. 1 1 1 0
0011
1100
c. 4 5 3 0
0060
7600
d. 4 0 3 0
0060
7600
Ans:- d. 4 0 3 0
0060
7600
------------------------------------------------------------------------------------------------------------------------------------
2. A self-adjusting tree in which the element on which operation is performed becomes the root of
the tree
2-3 Tree
Red-Black Tree
Splay Tree
AVL Tree
B-Tree
B+ Tree
AB+ Tree
A- Tree
Ans:- B+ Tree
------------------------------------------------------------------------------------------------------------------------------------
4. When two keys result in having the same hash value, the condition is called
Collapsing
Collision
Chaining
Matching
Ans:- Collision
------------------------------------------------------------------------------------------------------------------------------------
if (n == 1) return a
l1 =xSort( l1 )
l2= xSort( l2 )
end procedure
Predict the name of the sorting algorithm from the following option….Please choose a correct
answer.
Quick sort
Merge sort
Selection sort
Red-black trees
AVL Trees
2-3 Trees
------------------------------------------------------------------------------------------------------------------------------------
7. The least Time Complexity of removing the duplicates from the unsorted linked list is
O(n^3)
O(n^2)
O(n)
None
Ans:- O(n)
------------------------------------------------------------------------------------------------------------------------------------
8. There are two data structures, one an array and another a singly linked list. Both stores same set
of elements. Let A indicate time taken to search in an array and B indicate to search in a Inked list
A>B
A<B
A=B
Can't Predict
Ans:- A<B
------------------------------------------------------------------------------------------------------------------------------------
Jack was given two non-negative functions f1 and f2. The function f1 (n) =O(f2(n)) if and only
if there exist a positive constant K and no such that? Please choose a correct answer.
c) f1(n) ≥ K*f2(n)
d) f1(n) 1 = K*f2(n)
------------------------------------------------------------------------------------------------------------------------------------
Jack was given two non-negative functions f1 and f2. The function f1 (n) =O(f2(n)) if and only
b) f1(n) = K*f2(n)
c) f1(n) ≥ K*f2(n)
d) f1(n) 1 = K*f2(n)
------------------------------------------------------------------------------------------------------------------------------------
11. Sam has a problem K. The problem K is NP-complete if K is NP-hard. Which of the
a) K:NP
b) K directly proportional to NP
c) KENP
d) K=NP
Answer : d) K=NP
------------------------------------------------------------------------------------------------------------------------------------
12. A hash table has 12 buckets and uses linear probing to insert values. The hash function is
K mod 8 and the key values are combined. The elements 11, 17, 14, 21, 31, 28, 51, 18 were
inserted into the hash table in that order, which location holds the 18.
a) 1
b) 4
c) 7
d) 2 Answer : 2
------------------------------------------------------------------------------------------------------------------------------------
if (n = - 1) return a
Var 11
as
var 12
Sort( 11 )
Sort( 12 )
end procedure
Predict the name of the sorting algorithm from the following options.
------------------------------------------------------------------------------------------------------------------------------------
14. Thomas has written an algorithm to sort an array. The algorithm is given below. Help
n: size of list
for i = 1 to n - 1
end procedure
a) O( log2 n) (logbase2)
b) O( n 10g2 n) (logbase2)
c) O(n)
d) O(n^2)
Answer : d) O(n^2)
------------------------------------------------------------------------------------------------------------------------------------
1. Begin from the first element, then perform a comparison with the following
2. If the present element is larger than the following element of the array, then
3. If the present element is lesser than the following element of the array, shift
Searching a particular
d) searching a particular
------------------------------------------------------------------------------------------------------------------------------------
a) O(log n).
b) O(n log n)
c) O(n)
d) O(n^2)
Answer: a) O(log n)
------------------------------------------------------------------------------------------------------------------------------------
17. In linear search algorithm, the worst case manifests in which of the following
situations?
b) When item is the last element in the array or When item is not in the array
at all
Answer: b) When item is the last element in the array or When item is not in
------------------------------------------------------------------------------------------------------------------------------------
18. Which of the following solutions would you get when you apply Prim's
algorithm on a graph?
------------------------------------------------------------------------------------------------------------------------------------
19. As a schedular, Operating System has to schedule different jobs that are
coming for processing. OS has to refine the precedence of each job for
scheduling. Which queue is used for storing and scheduling these jobs?
a) Linear Queue
b) Circular Queue
c) Dequeue
d) Priority Queue
------------------------------------------------------------------------------------------------------------------------------------
20. you want to store the following data of N students and porform the
operations like searching and sorting Which of the following you will use for
the same?
------------------------------------------------------------------------------------------------------------------------------------
21. Which of the following solutions would you get when you apply Prim's
algorithm on a graph?
------------------------------------------------------------------------------------------------------------------------------------
c) Load Balancing
------------------------------------------------------------------------------------------------------------------------------------
24. Which of the following sorting algorithms can be used to sort a random
a) Insertion Sort
b) Quick Sort
c) Heap Sort
d) Merge Sort
------------------------------------------------------------------------------------------------------------------------------------
25. Which of the following is true about linked list implementation of stack?
a) In push operation, if new nodes are inserted at the beginning of linked list,
b) In push operation, if new nodes are inserted at the end, then in pop
------------------------------------------------------------------------------------------------------------------------------------
b) DFS and BSF can be done in O(V+ E) time for adjacency list representation.
matrix representation.
------------------------------------------------------------------------------------------------------------------------------------
approach?
a) Insertion sort
b) Bubble sort
c) Quick sort
------------------------------------------------------------------------------------------------------------------------------------
a) Inorder
b) Preorder
c) Postorder
------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------
30. When determining the efficiency of an algorithm, how would you measure
------------------------------------------------------------------------------------------------------------------------------------
a) O(log n)
b) O(n log n)
c) O(n^2)
d) O(n)
Answer: c) O(n^2)
------------------------------------------------------------------------------------------------------------------------------------
32. You want to store n integer numbers inputed by the user and perform the
actions like searching and sorting on those numbers. Which of the following
a) Structure
b) Union
c) Variable
d) Arrays
Answer: d) Arrays
------------------------------------------------------------------------------------------------------------------------------------
a) Insert
b) Commit
c) Push
Answer: c) push
------------------------------------------------------------------------------------------------------------------------------------
34. what an extra key inserted at the end of the array is called?
a) Transposition
b) Stop key
c) Sentinel
d) Not sure
Answer: c) Sentinel
------------------------------------------------------------------------------------------------------------------------------------
35. An intelligent thief thieving in a new place, where the houses were arranged like a binary tree.
The thief can only enter through the root. Apart from the root ,each house has only one parent
house.
The thief had to be careful about the burglar system installed there. It would automatically contact
the police if two directly linked houses were robbed on the same night. You are given the binary
tree. Find the maximum amount of money the thief can rob without altering the police.
a) 310
b)305
c)330
d)345
Ans: