Comprehensive DS Question Bank
Comprehensive DS Question Bank
https://rtpnotes.vercel.app
a) O(n^2)
b) O(nlogn)
c) O(n^3)
d) O(n)
9 Quick sort algorithm is an example of D
a) backtracking
b) greedy algorithm
c) divide and conquer
d) dynamic programming
11 Consider the following C code. Assume that unsigned long B
int type
length is 64 bits.
The value returned when we call fun with the input 2 40 is (A)
4 (B) 5
(C) 6 (D) 40
12 Which of the following has a search efficiency of O(1): C
A)Tree
B) Heap
Qno Question Answer
C) Hash Table
D) Linked List
13 Using division method, in a given hash table of size 157, the C
key of value
172 be placed at position
a) 19
b) 72
c) 15
d) 17
14 What is the time complexity of a Merge Sort Algorithm? A
a) O(n logn)
b) On3
c) On
d) On2
15 Which one of the below is not divide and conquer approach? B
A - Insertion Sort
B - Merge Sort
C - Shell Sort
D - Heap Sort
16 ___ is a pile in which items are added at one end and B
removed from
the other.
A) List
B) Queue
C) Stack
D) Array
17 A linear collection of data elements where the linear node is A
given
by means of pointer is called?
a) Linked list
b) Node list
c) Primitive list
d) Unordered list
18 Which of the following is not a disadvantage to the usage of D
array?
a) Fixed size
b) There are chances of wastage of memory space if
elements
inserted in an array are lesser than the allocated size
Qno Question Answer
c) Insertion based on position
d) Accessing elements at specified positions
19 The postfix expression for the infix expression B
A+B∗(C+D)/F+D∗E is:
a) AB+CD+∗F/D+E∗
b) ABCD+∗F/DE∗++
c) A∗B+CD/F∗DE++
d) A+∗BCD/F∗DE++
A - Merge Sort
B - Insertion Sort
C - Quick Sort
D - Heap Sort
24 How can we describe an array in the best possible way? Container that
stores the elements
of similar types
25 What is the value of postfix expression 6324+-* D
a. Garbage value
b. 10
c. 50
d. None of the above
27 Which of the following is not the operation that can be D
performed on queue
a) Insertion
b) Deletion
c) Retrieval
d) Traversal
28 One can convert a binary tree to its mirror image by C
traversing it in
A) Inorder
B) Preorder
C) Postorder
D) None of the above
29 Which is the type of data structure where each node can A
have at most
two children ?
a) Binary Tree
b) Graph
c) Linked List
d) Array
30 Which of the following is not true about comparison based D
sorting
algorithms?
a)O(1)
b) O(n)
c) O(logn)
d) O(nlogn)
35 Which one of the below mentioned is linear data D
structure
A - Queue
B - Stack
C - Arrays
D - All of the above
36 Which of the following is false about a doubly linked list? D
int javatpoint[10];
int javatpoint;
javatpoint{20};
array javatpoint[10];
39 What is time complexity of heap sort algorithm? D
A) O(1) B) O(n) C) O(log n) D) O(nLogn)
40 Consider the basic block given below. A
a=b+c
c=a+d
d=b+c
e= d - b
a=e+b
The minimum number of nodes and edges present in the
DAG
representation of the above
basic block respectively are
(A) 0(n^2) (B) 0(n log n) (C) θ(n log n) (D) θ(n^2 )
48 B+ trees are preferred to binary tree in Database because 2.Disk
access is much
1.Disk capacity are greater than memory capacities slower than memory
2.Disk access is much slower than memory access access
3.Disk data transfer rates are much less than memory data
transfer
rate
4.Disks are more reliable than Memory
49 Minimum number of queues required for priority queue D
implementation?
A-5
B-4
C-3
D-2
51 In a min heap : B
(A) Parent nodes have values greater than or equal to their
Qno Question Answer
child
(B) Parent nodes have values less than or equal to their child
(C) both statements are true
(D) both statements are false
52 Q 1 - In order traversal of binary search tree will C
produce −
A - unsorted list
B - reverse of input
C - sorted list
D - none of the above
53 What is the worst case run-time complexity of binary search D
algorithm?
A - Ο(n2)
B - Ο(nlog n)
C - Ο(n3)
D - Ο(n
54 Which of the following uses memoization? C
A - Greedy approach
B - Divide and conquer approach
C - Dynamic programming approach
D - None of the above!
55 What is the time complexity of pop() operation when the A
stack is
implemented using an array?
a) O(1)
b) O(n)
c) O(logn)
d) O(nlogn)
56 The Inorder and Preorder traversal of a binary tree is d b e a debfgca
f c g and a b d e c f g respectively. Which among the
following is the correct Post Order Traversal Sequence for
this tree?
57 Which of the following is not the application of stack? Data Transfer
between two
asynchronous
processes
58 In the worst case, the number of comparisons needed to n
search a singly linked list of length n for a given element is?
59 To implement a stack using queue (with only enqueue and 2
dequeue operations), how many queues will you need?
Qno Question Answer
60 The optimal data structure used to solve Tower of Hanoi is Stack
_________
61 Assume that the operators +, -, X are left associative and ^ is abc X+ def ^^ –
right associative. The order of precedence (from highest to
lowest) is ^, X, +, -. The postfix expression for the infix
expression a + b X c – d ^ e ^ f is?
62 The time complexity of heap sort in worst case is O(nlogn)
63 Suppose we are sorting an array of eight integers using 2
heapsort, and we have just finished some
heapify (either maxheapify or minheapify) operations. The
array now looks like this:
16 14 15 10 12 27 28
1->2->3->4->5->6
79 Suppose we are sorting an array of eight integers using a) The pivot could
quicksort, and we have just finished the first partitioning with be either the 7 and 9
the array looking like this.
2 5 1 7 9 12 11 10