Data Structure MCQs (01-100)
1. Data structure is:
A) A way of storing and organizing data
B) A programming language
C) An algorithm
D) None
Answer: A
2. The main aim of using data structures is:
A) Efficient data access and modification
B) Reduce memory
C) Slow down execution
D) None
Answer: A
3. Examples of linear data structures are:
A) Array, Stack, Queue, Linked List
B) Tree, Graph
C) Both A and B
D) None
Answer: A
4. Non-linear data structures include:
A) Trees and Graphs
B) Arrays and Stacks
C) Queues
D) None
Answer: A
5. Which data structure allows random access?
A) Array
B) Linked List
C) Stack
D) Queue
Answer: A
6. The index of the first element of an array is:
A) 0
B) 1
C) -1
D) None
Answer: A
7. The time complexity of accessing an element in an array is:
A) O(1)
B) O(n)
C) O(log n)
D) O(n²)
Answer: A
8. The number of elements in an array is called:
A) Length or size
B) Degree
C) Capacity
D) None
Answer: A
9. In an array, elements are stored in:
A) Contiguous memory locations
B) Random locations
C) Linked blocks
D) None
Answer: A
10. Insertion in an array at a specific position takes:
A) O(n) time
B) O(1) time
C) O(log n) time
D) None
Answer: A
11. Deletion in an array at the beginning takes:
A) O(n)
B) O(1)
C) O(n²)
D) None
Answer: A
12. A linked list consists of:
A) Nodes containing data and pointer(s)
B) Only data
C) Only pointers
D) None
Answer: A
13. In a singly linked list, each node contains:
A) Data and a pointer to next node
B) Two pointers
C) Data only
D) None
Answer: A
14. The last node of a singly linked list contains:
A) NULL pointer
B) Head pointer
C) Random data
D) None
Answer: A
15. Which of the following allows traversal in both directions?
A) Doubly linked list
B) Singly linked list
C) Array
D) None
Answer: A
16. In a circular linked list, the last node points to:
A) The first node
B) NULL
C) Random node
D) None
Answer: A
17. Advantage of linked list over array:
A) Dynamic memory allocation
B) Faster access
C) Random access
D) None
Answer: A
18. Disadvantage of linked list:
A) No random access
B) Requires extra memory for pointers
C) Both A and B
D) None
Answer: C
19. Stack is also known as:
A) Last In First Out (LIFO) structure
B) First In First Out (FIFO) structure
C) Random access list
D) None
Answer: A
20. Basic operations of stack:
A) Push and Pop
B) Add and Remove
C) Enqueue and Dequeue
D) None
Answer: A
21. The top of stack refers to:
A) The last inserted element
B) The first element
C) The bottom
D) None
Answer: A
22. If we try to pop from an empty stack, it causes:
A) Stack Underflow
B) Stack Overflow
C) Runtime error
D) None
Answer: A
23. Pushing an element into a full stack causes:
A) Stack Overflow
B) Stack Underflow
C) Queue Full
D) None
Answer: A
24. Stack can be implemented using:
A) Array or Linked List
B) Only Array
C) Only Queue
D) None
Answer: A
25. The postfix expression for (A + B) * C is:
A) AB+C*
B) ABC+*
C) A+BC*
D) None
Answer: A
26. The prefix form of (A + B) * (C – D) is:
A) *+AB-CD
B) +AB-CD
C) AB+CD-
D) None
Answer: A
27. Evaluation of postfix expression uses:
A) Stack
B) Queue
C) Array
D) None
Answer: A
28. Parentheses are used in infix expression to:
A) Indicate priority of operations
B) Separate numbers
C) Denote variables
D) None
Answer: A
29. Reversing a string using stack involves:
A) Pushing each character and then popping
B) Using queue
C) Sorting characters
D) None
Answer: A
30. A queue works on which principle?
A) FIFO (First In First Out)
B) LIFO (Last In First Out)
C) FILO
D) None
Answer: A
31. The two ends of a queue are called:
A) Front and Rear
B) Start and End
C) Top and Bottom
D) None
Answer: A
32. Insertion in a queue takes place at:
A) Rear end
B) Front end
C) Middle
D) None
Answer: A
33. Deletion in a queue takes place at:
A) Front end
B) Rear end
C) Both ends
D) None
Answer: A
34. A circular queue helps to:
A) Reuse empty spaces left by deletions
B) Store circular data
C) Avoid overflow
D) None
Answer: A
35. Double-ended queue (Deque) allows insertion and deletion:
A) From both ends
B) Only one end
C) Randomly
D) None
Answer: A
36. Priority queue is:
A) Queue in which elements are dequeued based on priority
B) Normal queue
C) LIFO
D) None
Answer: A
37. Which data structure is used for recursion?
A) Stack
B) Queue
C) Array
D) None
Answer: A
38. Which operation is not possible in stack?
A) Dequeue
B) Pop
C) Push
D) None
Answer: A
39. The size of the stack is determined by:
A) The maximum number of elements it can hold
B) Total memory
C) Number of operations
D) None
Answer: A
40. In linked list implementation of stack, push and pop operations are performed at:
A) Head node
B) Tail node
C) Middle node
D) None
Answer: A
41. The process of accessing each element in a data structure is called:
A) Traversal
B) Searching
C) Sorting
D) None
Answer: A
42. A collection of elements with linear relationship is called:
A) Linear data structure
B) Non-linear structure
C) Array
D) None
Answer: A
43. Binary tree is an example of:
A) Non-linear data structure
B) Linear structure
C) Queue
D) None
Answer: A
44. A data structure that can be described recursively is:
A) Linked list or tree
B) Array
C) Stack
D) None
Answer: A
45. The memory required by a data structure depends on:
A) Number of elements and size of each element
B) Compiler
C) CPU
D) None
Answer: A
46. The process of arranging data in ascending or descending order is:
A) Sorting
B) Searching
C) Traversing
D) None
Answer: A
47. Linear search has a time complexity of:
A) O(n)
B) O(log n)
C) O(1)
D) None
Answer: A
48. Binary search can be applied only on:
A) Sorted arrays
B) Unsorted arrays
C) Linked lists
D) None
Answer: A
49. The complexity of binary search is:
A) O(log n)
B) O(n)
C) O(n²)
D) None
Answer: A
50. Which operation is not possible in an array?
A) Random insertion without shifting elements
B) Sequential access
C) Indexing
D) None
Answer: A
51. In a queue, if the rear pointer equals the front pointer, the queue is:
A) Empty
B) Full
C) Overflowed
D) None
Answer: A
52. Which queue allows insertion at one end and deletion at the other?
A) Simple Queue
B) Circular Queue
C) Priority Queue
D) Deque
Answer: A
53. Which queue is most suitable for CPU scheduling?
A) Priority Queue
B) Circular Queue
C) Simple Queue
D) None
Answer: A
54. In a circular queue, the next position of rear is calculated using:
A) (rear + 1) % size
B) (rear + size)
C) (rear + 2)
D) None
Answer: A
55. Which of the following is not an application of queues?
A) Recursion
B) CPU scheduling
C) Printer spooling
D) Data buffering
Answer: A
56. The data structure used for simulating recursion is:
A) Stack
B) Queue
C) Tree
D) Graph
Answer: A
57. A binary tree is a tree in which each node has at most:
A) Two children
B) One child
C) Three children
D) None
Answer: A
58. The degree of a node in a tree is:
A) Number of children it has
B) Number of ancestors
C) Number of siblings
D) None
Answer: A
59. The degree of a tree is:
A) Maximum degree of its nodes
B) Sum of degrees of all nodes
C) Number of leaves
D) None
Answer: A
60. A leaf node is a node with:
A) No children
B) One child
C) Two children
D) None
Answer: A
61. The root of a binary tree has:
A) No parent
B) One parent
C) Two parents
D) None
Answer: A
62. The height of a tree is the:
A) Length of the longest path from root to leaf
B) Number of nodes
C) Degree of root
D) None
Answer: A
63. A binary tree with ‘n’ nodes has exactly how many edges?
A) n – 1
B) n + 1
C) 2n
D) None
Answer: A
64. In a complete binary tree, all levels except possibly the last are:
A) Completely filled
B) Empty
C) Randomly filled
D) None
Answer: A
65. In a full binary tree, every node has:
A) 0 or 2 children
B) 1 child
C) 3 children
D) None
Answer: A
66. The maximum number of nodes at level ‘l’ in a binary tree is:
A) 2^l
B) l²
C) l + 1
D) None
Answer: A
67. The maximum number of nodes in a binary tree of height ‘h’ is:
A) 2^(h+1) – 1
B) h²
C) h × 2
D) None
Answer: A
68. A binary search tree (BST) is:
A) A binary tree with left < root < right property
B) Random binary tree
C) Only balanced trees
D) None
Answer: A
69. Searching in a BST has a time complexity of:
A) O(h), where h = height of tree
B) O(n) always
C) O(1)
D) None
Answer: A
70. The in-order traversal of a BST gives:
A) Sorted order of elements
B) Reverse order
C) Random order
D) None
Answer: A
71. Pre-order traversal sequence is:
A) Root → Left → Right
B) Left → Right → Root
C) Left → Root → Right
D) None
Answer: A
72. Post-order traversal sequence is:
A) Left → Right → Root
B) Root → Left → Right
C) Right → Root → Left
D) None
Answer: A
73. In-order traversal sequence is:
A) Left → Root → Right
B) Root → Left → Right
C) Left → Right → Root
D) None
Answer: A
74. Level order traversal of a binary tree is performed using:
A) Queue
B) Stack
C) Recursion
D) None
Answer: A
75. Which traversal is used to copy a tree?
A) Pre-order
B) In-order
C) Post-order
D) Level-order
Answer: A
76. Which traversal is used to delete a tree?
A) Post-order
B) Pre-order
C) In-order
D) None
Answer: A
77. The smallest element in a BST is found:
A) By traversing leftmost path
B) By traversing rightmost path
C) At root always
D) None
Answer: A
78. The largest element in a BST is found:
A) By traversing rightmost path
B) Leftmost path
C) Root
D) None
Answer: A
79. Deletion of a node in a BST with two children is done by:
A) Replacing with inorder successor/predecessor
B) Simply removing
C) Deleting all children
D) None
Answer: A
80. A balanced binary tree is one where:
A) Height difference between left and right subtrees ≤ 1
B) Equal number of nodes
C) Every node has 2 children
D) None
Answer: A
81. Which of the following is a self-balancing BST?
A) AVL tree
B) Binary heap
C) Threaded tree
D) None
Answer: A
82. The balance factor of a node in AVL tree is:
A) Height(left) – Height(right)
B) Nodes(left) – Nodes(right)
C) Level(left) + Level(right)
D) None
Answer: A
83. For a node to be balanced in AVL, balance factor should be:
A) -1, 0, or +1
B) 0 only
C) ±2
D) None
Answer: A
84. Rotation in AVL trees is used to:
A) Restore balance after insertion/deletion
B) Search faster
C) Remove duplicates
D) None
Answer: A
85. A tree with maximum height among all BSTs for given nodes is:
A) Skewed tree
B) Balanced tree
C) Full tree
D) None
Answer: A
86. In a skewed tree, every node has:
A) Only one child
B) Two children
C) No children
D) None
Answer: A
87. The height of a skewed tree with n nodes is:
A) n
B) log₂n
C) √n
D) None
Answer: A
88. Threaded binary trees are used to:
A) Make in-order traversal faster without recursion
B) Store threads
C) Reduce nodes
D) None
Answer: A
89. A complete binary tree can be efficiently stored in:
A) Array
B) Linked list
C) Stack
D) None
Answer: A
90. A binary tree can be uniquely constructed if:
A) In-order and Pre-order traversals are given
B) Only In-order is given
C) Only Pre-order is given
D) None
Answer: A
91. Expression trees are used to represent:
A) Arithmetic expressions
B) Logical statements
C) Binary numbers
D) None
Answer: A
92. Internal nodes in an expression tree represent:
A) Operators
B) Operands
C) Both
D) None
Answer: A
93. Leaves in an expression tree represent:
A) Operands
B) Operators
C) Both
D) None
Answer: A
94. Post-order traversal of expression tree gives:
A) Postfix expression
B) Prefix expression
C) Infix expression
D) None
Answer: A
95. Pre-order traversal of expression tree gives:
A) Prefix expression
B) Postfix expression
C) Infix expression
D) None
Answer: A
96. Binary tree with n leaf nodes has at least how many total nodes?
A) 2n – 1
B) n
C) log₂n
D) None
Answer: A
97. Height-balanced trees are used to:
A) Reduce search time
B) Increase space usage
C) Randomize data
D) None
Answer: A
98. Traversing a tree without recursion can be done using:
A) Stack or Queue
B) Only Stack
C) Only Queue
D) None
Answer: A
99. The number of null pointers in a binary tree with n nodes is:
A) n + 1
B) n
C) 2n
D) None
Answer: A
100. Which traversal is suitable for constructing a BST from a sorted array?
A) In-order traversal
B) Pre-order traversal
C) Post-order traversal
D) None
Answer: A