1. : What is traversal in the context of data structures?
(A) Adding an element to the data structure
(B) Removing an element from the data structure
(C) Accessing and processing each element of the data structure
(D) Sorting the elements of the data structure
2. : Which traversal technique visits the left subtree, then the root, and finally the right subtree in a binary tree?
(A) Preorder traversal
(B) Inorder traversal
(C) Postorder traversal
(D) Level order traversal
3. : Which traversal method is used in depth-first search (DFS) of a graph?
(A) Inorder traversal
(B) Preorder traversal
(C) Postorder traversal
(D) Any of the above
4. : In a linked list, which operation requires traversal to reach the desired position?
(A) Insertion at the head
(B) Deletion at the head
(C) Insertion at the tail
(D) All of the above
5. : What is the time complexity of traversing an array of size n?
(A) O(1)
(B) O(log n)
(C) O(n)
(D) O(n^2)
6. : What is the time complexity of inserting an element at the beginning of a singly linked list?
(A) O(1)
(B) O(n)
(C) O(log n)
(D) O(n^2)
7. : In an array, what is the time complexity of inserting an element at the end?
(A) O(1)
(B) O(n)
(C) O(log n)
(D) O(n^2)
8. : What is the time complexity of inserting an element at a specific position in an array of size n?
(A) O(1)
(B) O(log n)
(C) O(n)
(D) O(n^2)
9. : In a binary search tree (BST), what is the average time complexity of inserting an element?
(A) O(1)
(B) O(log n)
(C) O(n)
(D) O(n^2)
10. : In a heap, what is the time complexity of inserting an element?
(A) O(1)
(B) O(log n)
(C) O(n)
(D) O(n^2)
11. : What is the time complexity of deleting the first element of a singly linked list?
(A) O(1)
(B) O(n)
(C) O(log n)
(D) O(n^2)
12. : In an array, what is the time complexity of deleting an element from a specific position?
(A) O(1)
(B) O(log n)
(C) O(n)
(D) O(n^2)
13. : What is the time complexity of deleting an element from the end of an array of size n?
(A) O(1)
(B) O(n)
(C) O(log n)
(D) O(n^2)
14. : In a binary search tree (BST), what is the average time complexity of deleting an element?
(A) O(1)
(B) O(log n)
(C) O(n)
(D) O(n^2)
15. : What is the time complexity of deleting the root element in a max heap?
(A) O(1)
(B) O(log n)
(C) O(n)
(D) O(n^2)
16. : Which data structure allows insertion, deletion, and traversal in O(1) time complexity?
(A) Array
(B) Singly linked list
(C) Doubly linked list
(D) None of the above
17. : Which of the following data structures supports O(1) time complexity for both insertion and deletion at the beginning?
(A) Array
(B) Stack
(C) Queue
(D) Singly linked list
18. : Which traversal method is typically used to display elements of a binary search tree in ascending order?
(A) Preorder
(B) Inorder
(C) Postorder
(D) Level order
19. : In which data structure does insertion and deletion take O(1) time but traversal takes O(n) time?
(A) Stack
(B) Queue
(C) Linked list
(D) Binary search tree
20. : What is the time complexity of inserting an element in the middle of a linked list?
(A) O(1)
(B) O(n)
(C) O(log n)
(D) O(n log n)