Data Structures MCQ Test
63 Data Structures multiple-choice questions with answers, from the PGDCA syllabus. Instant score, full answer review, free and no signup.
Each attempt picks 25 questions at random from the 63 in this topic.
Score 50% or more? Get a certificate at 40% off
Finish any PGDCA test on this site with a score of 50% or above and you can claim a course certificate from Alien Institute of Computer at a 40% discount. Your score appears on the result screen with a WhatsApp button that carries it across for you.
Ask about the certificateAll 63 Data Structures questions with answers
1. What is a data structure?
- A. A way of organising and storing data for efficient access
- B. A type of computer hardware
- C. A programming language
- D. An operating system feature
Answer: A way of organising and storing data for efficient access
2. Which data structure follows the Last In First Out (LIFO) principle?
- A. Queue
- B. Stack
- C. Linked list
- D. Tree
Answer: Stack
3. Which data structure follows the First In First Out (FIFO) principle?
- A. Stack
- B. Queue
- C. Tree
- D. Graph
Answer: Queue
4. Which operation adds an element to a stack?
- A. Enqueue
- B. Push
- C. Insert
- D. Append
Answer: Push
5. Which operation removes an element from a stack?
- A. Dequeue
- B. Pop
- C. Delete
- D. Remove
Answer: Pop
6. Which operation adds an element to a queue?
- A. Push
- B. Enqueue
- C. Insert
- D. Add
Answer: Enqueue
7. Which operation removes an element from a queue?
- A. Pop
- B. Dequeue
- C. Shift
- D. Drop
Answer: Dequeue
8. What happens when you try to push onto a full stack?
- A. Underflow
- B. Overflow
- C. The stack resizes
- D. Nothing
Answer: Overflow
9. What happens when you try to pop from an empty stack?
- A. Overflow
- B. Underflow
- C. It returns zero
- D. It returns NULL safely
Answer: Underflow
10. Which notation places the operator after the operands, as in AB+?
- A. Infix
- B. Prefix
- C. Postfix
- D. Mixfix
Answer: Postfix
11. Which notation places the operator before the operands, as in +AB?
- A. Infix
- B. Prefix
- C. Postfix
- D. Reverse Polish
Answer: Prefix
12. Which data structure is used to convert infix to postfix notation?
- A. Queue
- B. Stack
- C. Tree
- D. Graph
Answer: Stack
13. Which data structure is used for function call management in most languages?
- A. Queue
- B. Stack
- C. Heap
- D. Hash table
Answer: Stack
14. What is a linked list?
- A. A fixed-size array
- B. A sequence of nodes where each node points to the next
- C. A sorted array
- D. A type of tree
Answer: A sequence of nodes where each node points to the next
15. What does each node of a singly linked list contain?
- A. Data only
- B. Data and a pointer to the next node
- C. Two pointers only
- D. Data and an index
Answer: Data and a pointer to the next node
16. In a doubly linked list, each node has how many pointers?
- A. One
- B. Two
- C. Three
- D. None
Answer: Two
17. What is the main advantage of a linked list over an array?
- A. Faster random access
- B. Dynamic size — it can grow and shrink at run time
- C. Less memory per element
- D. Simpler code
Answer: Dynamic size — it can grow and shrink at run time
18. What is the main disadvantage of a linked list compared with an array?
- A. It cannot store integers
- B. No direct random access — you must traverse from the head
- C. It has a fixed size
- D. It cannot be sorted
Answer: No direct random access — you must traverse from the head
19. In a circular linked list, what does the last node point to?
- A. NULL
- B. The first node
- C. Itself
- D. The middle node
Answer: The first node
20. What is the time complexity of accessing an element in an array by index?
- A. O(1)
- B. O(n)
- C. O(log n)
- D. O(n log n)
Answer: O(1)
21. What is the time complexity of searching an unsorted array linearly?
- A. O(1)
- B. O(n)
- C. O(log n)
- D. O(n²)
Answer: O(n)
22. What is the time complexity of binary search on a sorted array?
- A. O(1)
- B. O(n)
- C. O(log n)
- D. O(n²)
Answer: O(log n)
23. What is a prerequisite for using binary search?
- A. The array must be sorted
- B. The array must be small
- C. The array must contain integers
- D. The array must be dynamic
Answer: The array must be sorted
24. What is the worst-case time complexity of bubble sort?
- A. O(n)
- B. O(n log n)
- C. O(n²)
- D. O(log n)
Answer: O(n²)
25. What is the average time complexity of quick sort?
- A. O(n)
- B. O(n log n)
- C. O(n²)
- D. O(log n)
Answer: O(n log n)
26. What is the worst-case time complexity of quick sort?
- A. O(n log n)
- B. O(n²)
- C. O(n)
- D. O(log n)
Answer: O(n²)
27. What is the time complexity of merge sort in all cases?
- A. O(n)
- B. O(n log n)
- C. O(n²)
- D. O(log n)
Answer: O(n log n)
28. Which sorting algorithm repeatedly selects the smallest remaining element?
- A. Bubble sort
- B. Selection sort
- C. Merge sort
- D. Quick sort
Answer: Selection sort
29. Which sorting algorithm builds the sorted list one element at a time by inserting?
- A. Insertion sort
- B. Selection sort
- C. Heap sort
- D. Radix sort
Answer: Insertion sort
30. Which sorting technique uses the divide-and-conquer strategy?
- A. Bubble sort
- B. Merge sort
- C. Selection sort
- D. Insertion sort
Answer: Merge sort
31. Which sorting algorithm is generally the fastest in practice for large random data?
- A. Bubble sort
- B. Quick sort
- C. Selection sort
- D. Insertion sort
Answer: Quick sort
32. What is a tree in data structures?
- A. A linear structure
- B. A hierarchical structure of nodes with one root
- C. A circular structure
- D. A sorted array
Answer: A hierarchical structure of nodes with one root
33. What is the topmost node of a tree called?
- A. Leaf
- B. Root
- C. Branch
- D. Parent
Answer: Root
34. What is a node with no children called?
- A. Root
- B. Leaf
- C. Parent
- D. Sibling
Answer: Leaf
35. How many children can a node have at most in a binary tree?
- A. One
- B. Two
- C. Three
- D. Any number
Answer: Two
36. In a binary search tree, where are values smaller than the node placed?
- A. In the right subtree
- B. In the left subtree
- C. At the root
- D. In a separate list
Answer: In the left subtree
37. Which traversal visits left subtree, root, then right subtree?
- A. Preorder
- B. Inorder
- C. Postorder
- D. Level order
Answer: Inorder
38. Which traversal visits root, left subtree, then right subtree?
- A. Inorder
- B. Preorder
- C. Postorder
- D. Level order
Answer: Preorder
39. Which traversal visits left subtree, right subtree, then root?
- A. Preorder
- B. Inorder
- C. Postorder
- D. Level order
Answer: Postorder
40. Inorder traversal of a binary search tree produces what?
- A. A random order
- B. Elements in sorted ascending order
- C. Elements in reverse order
- D. Only leaf nodes
Answer: Elements in sorted ascending order
41. What is the height of a tree with only a root node?
- A. -1
- B. 0
- C. 1
- D. 2
Answer: 0
42. What is the average time complexity of search in a balanced binary search tree?
- A. O(1)
- B. O(log n)
- C. O(n)
- D. O(n²)
Answer: O(log n)
43. What is a graph in data structures?
- A. A chart of data
- B. A set of vertices connected by edges
- C. A sorted tree
- D. A type of array
Answer: A set of vertices connected by edges
44. In a directed graph, edges have what property?
- A. No direction
- B. A specific direction from one vertex to another
- C. Equal weight
- D. Only one endpoint
Answer: A specific direction from one vertex to another
45. Which data structure is used in breadth-first search (BFS)?
- A. Stack
- B. Queue
- C. Heap
- D. Tree
Answer: Queue
46. Which data structure is used in depth-first search (DFS)?
- A. Queue
- B. Stack (or recursion)
- C. Hash table
- D. Array
Answer: Stack (or recursion)
47. Which representation of a graph uses a two-dimensional matrix?
- A. Adjacency list
- B. Adjacency matrix
- C. Edge list
- D. Incidence list
Answer: Adjacency matrix
48. Which algorithm finds the shortest path from a single source in a weighted graph?
- A. Kruskal's algorithm
- B. Dijkstra's algorithm
- C. Bubble sort
- D. Binary search
Answer: Dijkstra's algorithm
49. Which algorithms find a minimum spanning tree?
- A. Dijkstra and Bellman-Ford
- B. Kruskal and Prim
- C. BFS and DFS
- D. Quick sort and merge sort
Answer: Kruskal and Prim
50. What is a hash table used for?
- A. Sorting data
- B. Fast key-based lookup of values
- C. Storing data in order
- D. Compressing data
Answer: Fast key-based lookup of values
51. What is a collision in hashing?
- A. Two keys mapping to the same index
- B. The table becoming full
- C. A hash function failing
- D. Data being corrupted
Answer: Two keys mapping to the same index
52. Which technique resolves collisions by storing a linked list at each index?
- A. Linear probing
- B. Chaining
- C. Double hashing
- D. Rehashing
Answer: Chaining
53. What is the average time complexity of lookup in a good hash table?
- A. O(1)
- B. O(log n)
- C. O(n)
- D. O(n²)
Answer: O(1)
54. What does Big O notation describe?
- A. The exact run time of a program
- B. The upper bound of an algorithm's growth rate
- C. The memory address of data
- D. The number of variables used
Answer: The upper bound of an algorithm's growth rate
55. Which complexity is the most efficient for large inputs?
- A. O(n²)
- B. O(n log n)
- C. O(n)
- D. O(log n)
Answer: O(log n)
56. What is a circular queue used to solve?
- A. Sorting problems
- B. Wasted space at the front of a linear queue
- C. Recursion depth
- D. Memory leaks
Answer: Wasted space at the front of a linear queue
57. What is a priority queue?
- A. A queue where elements are served by priority, not arrival order
- B. A queue with two ends
- C. A sorted array
- D. A stack variant
Answer: A queue where elements are served by priority, not arrival order
58. Which data structure is commonly used to implement a priority queue?
- A. Array
- B. Heap
- C. Stack
- D. Linked list
Answer: Heap
59. In a min-heap, where is the smallest element located?
- A. At a leaf
- B. At the root
- C. In the middle
- D. At the last index
Answer: At the root
60. What is a deque?
- A. A queue that can only be read
- B. A double-ended queue allowing insertion and deletion at both ends
- C. A deleted queue
- D. A sorted queue
Answer: A double-ended queue allowing insertion and deletion at both ends
61. What is recursion in the context of data structures?
- A. A loop that never ends
- B. A function calling itself to solve smaller subproblems
- C. A sorting method
- D. A memory allocation technique
Answer: A function calling itself to solve smaller subproblems
62. Which memory area is used for dynamically allocated data structures?
- A. Stack
- B. Heap
- C. Register
- D. Cache
Answer: Heap
63. What is a sparse matrix?
- A. A matrix with mostly zero elements
- B. A matrix with no rows
- C. A three-dimensional matrix
- D. A sorted matrix
Answer: A matrix with mostly zero elements
Frequently asked questions
How many Data Structures questions are in this test?
This page has 63 Data Structures MCQs with answers. Each attempt picks 25 of them at random.
Is the Data Structures test free?
Yes — it is free, needs no signup, and you can retake it as many times as you like.
Can I get a certificate for this test?
Score 50% or more and you can claim a certificate from Alien Institute of Computer at 40% off. The WhatsApp button appears on your result screen.