Data Structure Mcqs Single File
Data Structure Mcqs Single File
a. Underflow
b. Garbage collection
c. Overflow
d. None of the above
7) Which one of the following is not the application of the stack data structure
a. String reversal
b. Recursion
c. Backtracking
d. Asynchronous data transfer
8) Which data structure is mainly used for implementing the recursive algorithm?
a. Queue
b. Stack
c. Binary tree
d. Linked list
9) Which data structure is required to convert the infix to prefix notation?
a. Stack
b. Linked list
c. Binary tree
d. Queue
10) Which of the following is the infix expression?
a. A+B*C
b. +A*BC
c. ABC+*
d. None of the above
11) Which of the following is the prefix form of A+B*C?
a. A+(BC*)
b. +AB*C
c. ABC+*
d. +A*BC
12) Which of the following is not the correct statement for a stack data structure?
a. Arrays can be used to implement the stack
b. Stack follows FIFO
c. Elements are stored in a sequential manner
d. Top of the stack contains the last inserted element
13) What is the outcome of the prefix expression +, -, *, 3, 2, /, 8, 4, 1?
a. 12
b. 11
c. 5
d. 4
a. 1
b. 3
c. 2
d. 5
15) Which one of the following node is considered the top of the stack if the stack is
implemented using the linked list?
a. First node
b. Second node
c. Last node
d. None of the above
a. O(1)
b. O(n)
c. O(logn)
d. O(nlogn)
17) Which of the following that determines the need for the Circular Queue?
18) Which of the following is the time complexity to search an element in the linked list?
a. O(1)
b. O(n)
c. O(logn)
d. O(nlogn)
19) Which of the following statement is not true about the doubly linked list?
20) Which one of the following techniques is not used in the Binary tree?
a. Randomized traversal
b. Preorder traversal
c. Postorder traversal
d. Inorder traversal
22) A linear data structure in which insertion and deletion operations can be performed from
both the ends is___
a. Queue
b. Deque
c. Priority queue
d. Circular queue
23) Which data structure is the best for implementing a priority queue?
a. Stack
b. Linked list
c. Array
d. Heap
24) Which of the following principle is used if two elements in the priority queue have the
same priority?
a. LIFO
b. FIFO
c. Linear tree
d. None of the above
25) Which of the following statement is not true regarding the priority queue?
26) Which of the following options is not true about the Binary Search tree?
a. The value of the left child should be less than the root node
b. The value of the right child should be greater than the root node.
c. The left and right sub trees should also be a binary search tree
d. None of the above
28) Which of the following satisfies the property of the Red Black tree?
a. A tree which is a binary search tree but not strictly balanced tree.
b. A node must be either Red or Black in color and root node must be black.
c. A tree with maximum three children
d. Both a and b
29) What would be the color of newly created node while inserting a new element in a Red
black tree?
31) In a simple graph, the number of edges is equal to twice the sum of the degrees of the
vertices.
a) True
b) False
32) A connected planar graph having 6 vertices, 7 edges contains _____________ regions.
a) 15
b) 3
c) 1
d) 11
33) If a simple graph G, contains n vertices and m edges, the number of edges in the Graph
G'(Complement of G) is ___________
a) (n*n-n-2*m)/2
b) (n*n+n+2*m)/2
c) (n*n-n-2*m)/2
d) (n*n-n+2*m)/2
34) Which of the following properties does a simple graph not hold?
a) Must be connected
b) Must be unweighted
35) What is the maximum number of edges in a bipartite graph having 10 vertices?
a) 24
b) 21
c) 25
d) 16
37) For a given graph G having v vertices and e edges which is connected and has no cycles,
which of the following statements is true?
a) v=e
b) v = e+1
c) v + 1 = e
d) v = e-1
38) For which of the following combinations of the degrees of vertices would the connected
graph be eulerian?
a) 1,2,3
b) 2,3,4
c) 2,4,5
d) 1,3,5
39) A graph with all vertices having equal degree is known as a __________
a) Multi Graph
b) Regular Graph
c) Simple Graph
d) Complete Graph
d) No way to represent
41) A connected planar graph having 6 vertices, 7 edges contains _____________ regions.
A. 15
B. 3
C. 1
D. 11
42) On which of the following statements does the time complexity of checking if an edge
exists between two particular vertices is not, depends?
A. I and II
B. III and IV
C. IV only
D. II and IV
44) What is the maximum number of edges in a bipartite graph having 10 vertices?
A. 24
B. 21
C. 25
D. 16
45) Possible number of labelled simple Directed, Pseudo and Multigarphs exist having 2
vertices?
A. 3, Infinite, 4
B. 4, 3, Infinite
C. 4, Infinite, infinite
D. 4, Infinite, Infinite
46) The most efficient algorithm for finding the number of connected components in an
undirected graph on n vertices and m edges has time complexity.
(A) \theta(n)
(B) \theta(m)
(C) \theta(m + n)
(D) \theta(mn)
A. A
B. B
C. C
D. D
47) If the elements '1', '2', '3' and '4' are added in a stack, so what would be the order for
the removal?
a. 1234
b. 2134
c. 4321
d. None of the above
48) Which one of the following node is considered the top of the stack if the stack is
implemented using the linked list?
a. First node
b. Second node
c. Last node
d. None of the above
49) Which one of the following is the overflow condition if a circular queue is implemented
using array having size MAX?
a. rear= MAX-1
b. rear=MAX
c. front=(rear+1) mod max
d. None of the above
50) Which of the following option is true if implementation of Queue is from the linked
list?
a. In enqueue operation, new nodes are inserted from the beginning and in dequeue
operation, nodes are removed from the end.
b. In enqueue operation, new nodes are inserted from the end and in dequeue
operation, nodes are deleted from the beginning.
c. In enqueue operation, new nodes are inserted from the end and in dequeue
operation, nodes are deleted from the end.
d. Both a and b
1. Which data structure allows deleting data elements from front and inserting at rear?
a. Stacks
b. Queues
c. Deques
d. Binary search tree
2. Identify the data structure which allows deletions at both ends of the list but insertion at
only one end.
a. Input-restricted deque
b. Output-restricted deque
c. Priority queues
d. None of above
3. Which of the following data structure is non-linear type?
a. Strings
b. Lists
c. Stacks
d. None of above
4. Which of the following data structure is linear type?
a. Strings
b. Lists
c. Queues
d. All of above
5. To represent hierarchical relationship between elements, which data structure is
suitable?
a. Deque
b. Priority
c. Tree
d. All of above
6. A binary tree whose every node has either zero or two children is called
a. Complete binary tree
b. Binary search tree
c. Extended binary tree
d. None of above
7. The depth of a complete binary tree is given by
a. Dn = n log2n
b. Dn = n log2n+1
c. Dn = log2n
d. Dn = log2n+1
8. When representing any algebraic expression E which uses only binary operations in a 2-
tree,
a. the variable in E will appear as external nodes and operations in internal nodes
b. the operations in E will appear as external nodes and variables in internal nodes
c. the variables and operations in E will appear only in internal nodes
d. the variables and operations in E will appear only in external nodes
9. A binary tree can easily be converted into q 2-tree
a. by replacing each empty sub tree by a new internal node
b. by inserting an internal nodes for non-empty node
c. by inserting an external nodes for non-empty node
d. by replacing each empty sub tree by a new external node
10. When converting binary tree into extended binary tree, all the original nodes in binary
tree are
a. internal nodes on extended tree
b. external nodes on extended tree
c. vanished on extended tree
d. None of above
11. The post order traversal of a binary tree is DEBFCA. Find out the pre order traversal
a. ABFCDE
b. ADBFEC
c. ABDECF
d. ABDCEF
12. Which of the following sorting algorithm is of divide-and-conquer type?
a. Bubble sort
b. Insertion sort
c. Quick sort
d. All of above
13. An algorithm that calls itself directly or indirectly is known as
a. Sub algorithm
b. Recursion
c. Polish notation
d. Traversal algorithm
14. In a binary tree, certain null entries are replaced by special pointers which point to nodes
higher in the tree for efficiency. These special pointers are called
a. Leaf
b. branch
c. path
d. thread
15. The in order traversal of tree will yield a sorted listing of elements of tree in
a. Binary trees
b. Binary search trees
c. Heaps
d. None of above
16. In a Heap tree
a. Values in a node is greater than every value in left sub tree and smaller than right sub tree
b. Values in a node is greater than every value in children of it
c. Both of above conditions applies
d. None of above conditions applies
17. In a graph if e=[u, v], Then u and v are called
a. endpoints of e
b. adjacent nodes
c. neighbors
d. all of above
18. A connected graph T without any cycles is called
a. a tree graph
b. free tree
c. a tree
d. All of above
19. In a graph if e=(u, v) means
a. u is adjacent to v but v is not adjacent to u
b. e begins at u and ends at v
c. u is processor and v is successor
d. both b and c
20. If every node u in G is adjacent to every other node v in G, A graph is said to be
a. isolated
b. complete
c. finite
d. strongly connected
Answers:
1. Which data structure allows deleting data elements from front and inserting at rear?
b. Queues
2. Identify the data structure which allows deletions at both ends of the list but insertion at
only one end.
a. Input-restricted deque
3. Which of the following data structure is non-linear type?
d. None of above
4. Which of the following data structure is linear type?
d. All of above
5. To represent hierarchical relationship between elements, which data structure is
suitable?
c. Tree
6. A binary tree whose every node has either zero or two children is called
c. Extended binary tree
7. The depth of a complete binary tree is given by
d. Dn = log2n + 1
8. When representing any algebraic expression E which uses only binary operations in a 2-
tree,
a. the variable in E will appear as external nodes and operations in internal nodes
9. A binary tree can easily be converted into q 2-tree
d. by replacing each empty sub tree by a new external node
10. When converting binary tree into extended binary tree, all the original nodes in binary
tree are
a. internal nodes on extended tree
11. The post order traversal of a binary tree is DEBFCA. Find out the pre order traversal
c. ABDECF
12. Which of the following sorting algorithm is of divide-and-conquer type?
c. Quick sort
13. An algorithm that calls itself directly or indirectly is known as
b. Recursion
14. In a binary tree, certain null entries are replaced by special pointers which point to nodes
higher in the tree for efficiency. These special pointers are called
d. thread
15. The in order traversal of tree will yield a sorted listing of elements of tree in
b. Binary search trees
16. In a Heap tree
b. Values in a node is greater than every value in children of it
17. In a graph if e=[u, v], Then u and v are called
d. all of above
18. A connected graph T without any cycles is called
d. All of above
19. In a graph if e=(u, v) means
d. both b and c
20. If every node u in G is adjacent to every other node v in G, A graph is said to be
b. complete
1. In ............................. ; for any node n, every descendant node's value in the left subtree of
n is less than the value of n and every descendant node's value in the right subtree is greater
than the value n.
A) binary tree
B) binary search tree
C) AVL tree
D) binary heap tree
2. For finding a node in a ....................., at each stage we ideally reduce the number of nodes
we have to check by half.
A) binary tree
B) binary search tree
C) AVL tree
D) binary heap tree
3. In the best case of BST, the time is on the order of ........................, but in the worst case it
requires linear time.
A) log₂n
B) n
C) log₂(n+1)
D) n+1
4. ...................... of binary search tree starts by visiting the current node, then its left child and
then its right child.
A) Preorder traversal
B) In-order traversal
C) Linear traversal
D) Post-order traversal
5. The order with which the nodes are inserted affects the running time of the .........................
search algorithm.
A) AVL Tree
B) Red-Black Tree
C) Binary Search Tree
D) Binary Heap Tree
6. .................... of binary search tree starts by visiting the current node's left child, then its right
child and finally the current node itself.
A) Preorder
B) In-order
C) Linear
D) Post-order
7. With an ideal balance, the running time for inserts, searches and deletes, even in the worst
case is ...........................
A) log₂n
B) n
C) log₂(n+1)
D) n+1
8. In binary search tree, a ...................... exists if starting from some node n there exists a path
that returns to n.
A) cycle
B) node
C) root
D) subtree
9. In binary search tree, a ........................ rooted to node n is the tree formed by imaging
node n was a root.
A) cycle
B) node
C) root
D) subtree
10. ................................. is a binary search tree whose left subtree and right subtree differ in
height by at most 1 unit and whose left and right subtrees are themselves AVL trees.
A) Red-Black Tree
B) AVL Tree
C) Binary Head Tree
D) A-A Tree
11. ..................... is a binary search tree whose leaves are external nodes.
A) Red-Black Tree
B) AVL Tree
C) Binary Heap Tree
D) A-A Tree
12. Which of the following is/are properties of red-black tree.
i) every node is either red or black ii) the root is red iii) If a node is red, then both its children
are black iv) every leaf is black
A) i, ii and iii only
B) i, iii and iv only
C) i, ii and iv only
D) All i, ii, iii and iv
13. A lemma is a red-black tree with n internal nodes has height at most ...............
A) 2lg(n)
B) 2n
C) 2lg(n+1)
D) n+1
14. While inserting into ................................, insertions are done at a leaf and will replace an
external node with an internal node with two external children.
A) red-black tree
B) AVL tree
C) binary search tree
D) binary heap tree
15. For an AVL tree ................................ is the additional piece of information which indicates
if the difference in height between the left and right subtree is the same or if not, which of the
two subtrees has height one unit larger.
A) tree factor
B) balance factor
C) additional factor
D) unit factor
16. ..................... is a complete binary tree, that is completely filled except possibly at the
bottom level.
A) Red-Black Tree
B) AVL Tree
C) Binary Heap Tree
D) A-A Tree
17. In a .......................... for every node X with a parent P, the key in P is less than or equal to
the key in X.
A) red-black
B) AVL
C) binary search
D) binary heap
18. An insertion into a ............................. is performed by inserting the new node in the
location referenced by next in the array and then "sifting it up" by comparing the key of the
newly inserted node with the key of the parent.
A) red-black
B) AVL
C) binary search
D) binary heap
19. While deleting nodes from a binary heap, ...................... node is replaced by the last leaf in
the tree.
A) left leaf
B) right leaf
C) root
D) cycle
20. The worst case height of an AVL tree with n nodes is ...............
A) 2 lg n
B) 1.39 lg n
C) 1.44 lg n
D) 1.64 lg n
Answers
26. In linked list each node contain minimum of two fields. One field is data field
to store the data second field is?
a) Pointer to character
b) Pointer to integer
c) Node
d) Pointer to node
27. Which of the following application makes use of a circular linked list?
a) Undo operation in a text editor
b) Recursive function calls
c) Allocating CPU to resources
d) All of the mentioned
28. What is a memory efficient double linked list?
a) Each node has only one pointer to traverse the list back and forth
b) The list has breakpoints for faster traversal
c) An auxiliary singly linked list acts as a helper list to traverse through the doubly linked list
d) None of the mentioned
29. If the elements “A”, “B”, “C” and “D” are placed in a queue and are deleted
one at a time, in what order will they be removed?
a) DCBA
b) ABCD
c) DCAB
d) ABDC
30. Queues serve major role in
a) Simulation of recursion
b) Simulation of arbitrary linked list
c) Simulation of limited resource allocation
d) All of the mentioned