
















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Mcq for placement preparation in data Structure
Typology: Schemes and Mind Maps
1 / 24
This page cannot be seen from the preview
Don't miss anything!

















1. What is the time complexity to insert an element at the beginning of a linked list? a) O(1) b) O(n) c) O(log n) d) O(n log n) 2. Which data structure uses LIFO (Last In, First Out)? a) Queue b) Stack c) Array d) Linked List 3. What is the time complexity to access an element in an array by index? a) O(1) b) O(n) c) O(log n) d) O(n log n) 4. What is the best case time complexity of linear search? a) O(1) b) O(n) c) O(log n) d) O(n²) 5. In a queue, insertion is done at the ___ and deletion is done from the ___ a) Front, Rear b) Rear, Front c) Rear, Rear d) Front, Front 6. Which traversal method is used in depth-first traversal of a tree? a) Level-order b) Breadth-first c) Inorder/Preorder/Postorder d) None of the above
7. Which of the following is not a self-balancing binary search tree? a) AVL Tree b) Red-Black Tree c) B-Tree d) Binary Heap 8. Which data structure is used to implement recursion? a) Queue b) Array c) Stack d) Linked List 9. Which data structure is best for implementing priority queues? a) Queue b) Stack c) Heap d) Linked List 10. Which of these is not a linear data structure? a) Array b) Linked List c) Binary Tree d) Stack 11. What is the height of a complete binary tree with n nodes? a) log₂n b) n c) √n d) n² 12. What is the maximum number of children a binary tree node can have? a) 1 b) 2 c) 3 d) 4 13. Which hashing technique handles collisions by storing all elements in a list at a location?
a) 1 b) 0 c) 2 d) Depends on tree
20. What does a hash function do? a) Converts data into a tree b) Searches for duplicates c) Maps data to a unique index d) Encrypts data 21. In a circular queue, when front == rear, the queue is: a) Full b) Empty c) Half full d) Invalid 22. The inorder traversal of a binary search tree gives: a) Postorder traversal b) Preorder traversal c) Level order d) Sorted output 23. What is the element of stack after the following stack operations? PUSH(1), PUSH(2), POP(), PUSH(3), POP()? a) 1 b) 2 c) 3 d) Empty 24. Which structure is ideal for implementing undo/redo operations? a) Stack b) Queue c) Tree d) Hash table 25. What does the term “enqueue” refer to?
a) Removing from queue b) Adding to stack c) Adding to queue d) Removing from stack
26. In which traversal is the root node visited first? a) Inorder b) Postorder c) Preorder d) Level order 27. What is the auxiliary space complexity of Merge Sort? a) O(1) b) O(log n) c) O(n) d) O(n²) 28. Which of the following is a non-linear data structure? a) Array b) Stack c) Graph d) Queue 29. Which of these is not used in graph representations? a) Adjacency matrix b) Adjacency list c) Edge list d) Binary Heap 30. What is a leaf node in a tree? a) A node with no children b) A node with two children c) Root node d) None of the above
6. In a circular linked list, the last node points to: a) NULL b) Itself c) First node d) Middle node 7. Which tree has all levels fully filled except possibly the last level? a) Full Binary Tree b) Complete Binary Tree c) Perfect Binary Tree d) AVL Tree 8. A hash collision occurs when: a) Data is deleted b) Index is out of bounds c) Two keys produce same hash index d) Table is full 9. Which of these is a non-linear data structure? a) Stack b) Tree c) Queue d) Array 10. What is the maximum number of nodes in a binary tree of height h? a) 2h b) 2^h c) 2^(h+1) - 1 d) h²
11. Which of the following is not a characteristic of a heap? a) Complete binary tree b) Can be used to implement priority queue c) Always balanced d) Sorted order 12. Which data structure allows insertion and deletion from both ends? a) Queue b) Stack c) Deque d) Array 13. The best data structure to check for balanced parentheses in an expression is: a) Queue b) Stack c) Array d) Linked List 14. A binary tree is balanced if: a) All nodes have two children b) Every level is full c) Left and right subtrees differ in height by -1,0, d) It is complete 15. The time complexity of push and pop operations in stack is: a) O(1) b) O(log n) c) O(n) d) O(n log n) 16. Which of the following is NOT a type of linked list?
21. What is the worst-case time complexity of quicksort? a) O(n log n) b) O(n²) c) O(n) d) O(log n) 22. Which of the following can be used to implement a priority queue? a) Queue b) Heap c) Stack d) Array 23. What does ‘depth’ in a tree represent? a) Total nodes b) Total leaves c) Longest path from root to leaf d) Number of children of root 24. What is the space complexity of recursive factorial function? a) O(1) b) O(n) c) O(log n) d) O(n²) 25. Which data structure is best for checking palindromes? a) Stack b) Queue c) Tree d) Hash table 26. When does rehashing occur in a hash table?
a) When collision occurs b) When table becomes too full c) When search fails d) When deletion happens
27. How many null pointers are in a binary tree with n nodes? a) n b) n - 1 c) n + 1 d) 2n 28. Which operation is not efficient in singly linked list? a) Insertion at front b) Deletion from front c) Insertion at end d) Deletion from end 29. Stack can be implemented using: a) Array only b) Linked list only c) Either array or linked list d) Queue 30. Which tree traversal is used to create a copy of a tree? a) Postorder b) Inorder c) Preorder d) BFS SET-
6. What is the worst-case complexity of inserting into a binary search tree? a) O(log n) b) O(1) c) O(n) d) O(n²) 7. Which data structure allows you to access the largest element in O(1) time? a) Stack b) Queue c) Max Heap d) Binary Search Tree 8. Which sorting algorithm is best suited for nearly sorted data? a) Quick Sort b) Merge Sort c) Insertion Sort d) Heap Sort 9. Which of the following is not a limitation of array data structure? a) Fixed size b) Insertion is costly c) Direct access d) Wastage of memory 10. Which of the following applications use graph data structure? a) Social networks b) Maps and navigation c) Network routing d) All of the above
11. In postorder traversal, the sequence of visiting nodes is: a) Left → Right → Root b) Root → Left → Right c) Right → Left → Root d) Root → Right → Left 12. The number of edges in a complete undirected graph with n vertices is: a) n b) n(n-1)/ c) n² d) (n-1)² 13. The structure used for Breadth First Traversal of a graph is: a) Stack b) Queue c) Tree d) Array 14. Which algorithm finds the minimum spanning tree in a graph? a) Dijkstra’s b) Floyd-Warshall c) Kruskal’s d) Bellman-Ford 15. Which of the following operations is the most expensive in an array? a) Traversal b) Access by index c) Insertion at start d) Insertion at end
a) To store extra data b) To mark start and end c) To act as a dummy node d) To increase memory
22. In which case does binary search work? a) Unsorted array b) Sorted array c) Linked list d) Tree only 23. The worst case for search in a hash table occurs when: a) Keys are unique b) Table is empty c) All keys collide d) Table is full 24. Which of the following statements about trees is false? a) A tree with n nodes has exactly n–1 edges b) A binary tree is a special case of tree c) Trees can have cycles d) Tree is a connected acyclic graph 25. Which of the following uses dynamic memory allocation? a) Array b) Linked List c) Stack using array d) Queue using array 26. Which data structure is best suited for implementing undo-redo in editors?
a) Queue b) Stack of stacks c) Tree d) Graph
27. In BFS traversal of a graph, a node is visited: a) Before all its adjacent nodes b) After visiting all adjacent nodes c) In random order d) Only if not visited earlier 28. Which data structure is commonly used in compiler syntax checking? a) Queue b) Stack c) Tree d) Graph 29. What is the result of stack overflow? a) Memory leak b) Out of memory error c) Program crash d) Deadlock 30. A graph that has no cycles and is connected is called a: a) DAG b) Tree c) Spanning tree d) Forest SET-
a) Pop b) Push c) Peek d) All of the above
6. Which of the following uses level-order traversal? a) Stack b) Queue c) Binary Tree d) Graph 7. In graph theory, which traversal technique guarantees the shortest path (unweighted)? a) DFS b) BFS c) Dijkstra d) Bellman-Ford 8. Which is the most suitable data structure for implementing a dictionary? a) Stack b) Queue c) Hash Table d) Tree 9. The maximum number of nodes at level l of a binary tree is: a) l b) 2^l c) l² d) 2^(l-1) 10. In which scenario does linear probing fail in hashing?
a) When the table is full b) When there's a duplicate key c) When load factor < 1 d) Never fails
11. Which sorting technique is not stable by default? a) Merge Sort b) Insertion Sort c) Bubble Sort d) Quick Sort 12. What is the primary advantage of AVL trees over regular BSTs? a) Insertion is easier b) Deletion is faster c) Automatically balanced d) Requires less space 13. In a binary tree, the number of null links is always: a) n - 1 b) n c) n + 1 d) 2n 14. In an array-based stack implementation, what indicates stack underflow? a) Top = - b) Top = MaxSize c) Top = 0 d) Stack is full