Which data structure is used for implementing recursion?ArrayQueueStackHeapC) StackRecursion uses the function call stack to keep track of function calls.
The time complexity of searching in a balanced binary search tree is:O(1)O(log n)O(n)O(n log n)B) O(log n)A balanced BST ensures logarithmic search time.
Which data structure allows insertion and deletion at both ends?QueueStackDequePriority QueueC) DequeA deque (double-ended queue) allows operations at both ends.
Which of the following is NOT a linear data structure?StackQueueTreeArrayC) TreeTrees are hierarchical, not linear.
Hashing is mainly used to:Sort dataSearch data quicklyCompress dataEncrypt dataB) Search data quicklyHashing allows near O(1) average search time.
Which data structure uses the FIFO (First In, First Out) principle?StackQueueTreeGraphB) QueueQueue follows FIFO order, where elements inserted first are removed first.
Which of these is not a linear data structure?ArrayStackGraphQueueC) GraphGraph is a non-linear data structure, representing relationships between nodes.
The time complexity of accessing an element in an array by index is:O(n)O(1)O(log n)O(n²)B) O(1)Arrays provide constant-time random access.
A binary tree is considered complete if:All levels are fully filled except possibly the last, which is filled left to right.Each node has exactly two children.It has the maximum number of nodes possible.It is a full binary tree.A) All levels are fully filled except possibly the last, which is filled left to rightA) All levels are fully filled except possibly the last, which is filled left to right
In which data structure does insertion and deletion happen at the same end?QueueStackDequePriority QueueB) StackStack uses LIFO (Last In, First Out), so insertion and deletion occur at the top.
Which of the following operations is fastest in a singly linked list?Random AccessInsertion at HeadSearching for ElementDeletion at TailB) Insertion at HeadIn a singly linked list, inserting at the head takes O(1) time because no traversal is required.
The height of a complete binary tree with n nodes is approximately:log₂nn√nn²A) log₂nHeight of a complete binary tree grows logarithmically with the number of nodes.
Which of these is NOT a self-balancing binary search tree?AVL TreeRed-Black TreeSplay TreeBinary HeapD) Binary HeapBinary heap is a priority queue structure, not a binary search tree.
In hashing, collision resolution by chaining uses:Open addressingMultiple hash functionsLinked lists at each bucketDirect mappingC) Linked lists at each bucketChaining handles collisions by maintaining a linked list of all elements hashed to the same index.
Which data structure is used for recursive function calls internally?QueueStackHeapHash TableB) StackRecursive calls push return addresses and local variables onto the call stack.
What is the maximum number of nodes in a binary tree of height h?2^h2^(h+1) - 1h²hB) 2^(h+1) - 1A binary tree of height h can have a maximum of 2^(h+1)-1 nodes.
Which data structure is best suited for implementing a LRU cache?Array + StackHash Map + Doubly Linked ListQueue OnlyBinary TreeB) Hash Map + Doubly Linked ListLRU caches use HashMap for O(1) lookup and Doubly Linked List for maintaining order.
Breadth-First Search uses which data structure?StackQueueHeapBinary HeapB) QueueBFS explores nodes level by level using a queue.
Which of these is NOT a self-balancing binary search tree?AVL TreeRed-Black TreeB-TreeHeapD) HeapHeap is a complete binary tree but not a self-balancing BST.
Which of the following data structures uses FIFO principle?StackQueuePriority QueueDequeB) QueueQueue follows First-In-First-Out order for inserting and removing elements.
Which of these is an application of circular queue?Undo/Redo in text editorsCPU Task SchedulingFunction Call StackBinary SearchB) CPU Task SchedulingCircular queues efficiently manage fixed-size buffers for scheduling.
Which traversal of a BST gives sorted output?PreorderIneorderPostorderLevel OrderB) InorderInorder traversal of BST visits nodes in ascending order of keys.
What is the time complexity for inserting into a balanced BST (like AVL)?O(1)O(log n)O(n)O(n log n)B) O(log n)Balanced BSTs maintain logarithmic height, giving O(log n) insertion.
Which of these is a non-linear data structure?ArrayStackQueueGraphD) GraphGraphs store data in nodes connected by edges, not sequentially.
Which traversal is best for copying a binary tree?PreorderInorderPostorderLevel-orderA) PreorderPreorder traversal visits root before children, making it ideal for tree copy operations.
Which of the following is not a self-balancing binary search tree?AVL TreeRed-Black TreeB-TreeBinary HeapD) Binary HeapBinary Heap is a complete tree but not height-balanced like AVL or Red-Black trees.
In hashing, collision resolution by chaining uses:ArraysLinked ListsBinary TreesStacksB) Linked ListsSeparate chaining stores collided keys in linked lists at the same hash index.
What is the maximum number of children a B-tree of order m can have?m – 1mm + 12mB) mA B-tree of order m allows each node to have at most m children.
Which operation is fastest in a circular linked list compared to a singly linked list?TraversalInsertion at the beginningInsertion at the endSearchingC) Insertion at the endCircular linked lists allow O(1) insertion at the end using tail pointer.
Which data structure is not linear?QueueStackGraphLinked ListC) GraphGraphs are non-linear structures used to represent networks and relationships.
Which of the following is used in implementing recursion?QueueStackB-TreeBinary HeapB) StackFunction calls use a stack (call stack) to manage recursion.
The maximum number of children in a binary tree node is:1234B) 2Binary trees allow at most two children per node.
Which data structure is most suitable for undo operations in editors?QueueStackLinked ListHash TableB) StackUndo operations use the LIFO property of stacks.
Which of the following is used to implement BFS in a graph?StackQueuePriority QueueHash TableB) QueueBFS explores nodes level by level using a queue.
The height of a balanced binary tree with n nodes is:O(1)O(log n)O(n)O(n²)B) O(log n)Balanced trees keep height logarithmic for efficient operations.
Which data structure uses “first come, first served”?StackQueueDequeHeapB) QueueQueue follows FIFO principle, serving requests in arrival order.
Which traversal prints a binary search tree in sorted order?PreorderInorderPostorderLevel-orderB) InorderInorder traversal of BST visits nodes in ascending order.
A complete binary tree of height h has at most how many nodes?2ʰ – 12ʰ⁺¹ – 1h²log₂hB) 2ʰ⁺¹ – 1Complete binary trees are filled level by level.
Which of the following is a non-linear data structure?StackQueueTreeArrayC) TreeTrees organize elements hierarchically, unlike linear structures.
The maximum number of nodes in a binary tree of depth d is:2ᵈ⁺¹ − 12ᵈd²log₂dA)2ᵈ⁺¹ − 1Binary trees grow exponentially with depth.
Hashing is primarily used for:SortingSearchingTraversingStoring sequentiallyB) SearchingHashing enables O(1) average-time searches.
Which data structure uses recursion?ArrayLinked ListStackQueueC) StackFunction calls are managed using a stack.
Which of these is not a self-balancing BST?AVLRed-Black TreeB-TreeBinary HeapD) Binary HeapHeaps are not BSTs, though they maintain partial order.
Which data structure uses FIFO order?StackQueueTreeGraphB) QueueQueues follow First-In-First-Out order.
The height of a binary tree with only one node is:–1012B)0A single node tree has height 0.
Best case time complexity of linear search is:O(1)O(log n)O(n)O(n²)A) O(1)If the element is found at the first index.
Which traversal prints a BST in sorted order?PreorderInorderPostorderLevel orderB)InorderInorder traversal of BST yields sorted values.
Which collision resolution technique uses linked lists?Open addressingChainingDouble hashingRehashingB) ChainingChaining stores colliding keys in lists.
Which data structure allows deletion from the front and insertion at the rear?StackQueueDequeTreeB) QueueQueue follows FIFO; insert at rear, delete from front.
Which of the following is a self-balancing binary search tree?AVL TreeBinary HeapB-TreeBinary Search TreeA) AVL TreeAVL trees maintain balance by rotations to ensure O(log n) operations.
The time complexity of searching in a hash table is:O(1) average, O(n) worstO(log n) averageO(n) averageO(n log n) worstA) O(1) average, O(n) worstHashing provides constant time lookups on average but can degrade with collisions.
Which traversal method is used for expression trees to get postfix notation?PreorderIneorderPostorderLevel OrderC) PostorderPostorder traversal yields postfix (Reverse Polish) expression.
A complete binary tree with n nodes has height:O(log n)O(n)O(√n)O(1)A) O(log n)The height of a complete binary tree is proportional to log₂(n).
Which data structure is most suitable for implementing undo operations in text editors?QueueStackHeapGraphB) StackUndo uses LIFO order, which is naturally supported by stacks.
Which tree traversal gives sorted order for a Binary Search Tree?PreorderPostorderInorderLevel orderC) InorderInorder traversal of BST gives values in ascending order.
A circular queue helps to:Save memoryRemove duplicatesSort elementsIncrease time complexityA) Save memoryCircular queues efficiently use memory by wrapping around.
Which data structure is best for implementing a priority queue?Linked ListStackHeapGraphC) HeapBinary heaps provide efficient priority queue operations.
The minimum number of nodes in an AVL tree of height h is:hh + 1Fibonacci(h + 2) − 12^hC) Fibonacci(h + 2) − 1AVL trees use Fibonacci sequence for node balance.
Which operation is not possible in O(1) for a singly linked list?Insert at headDelete at headInsert at tail (with tail pointer)Delete at tailD) Delete at tailDeleting the tail in a singly linked list requires traversal.
Which hashing technique handles collisions using linked lists?Linear probingDouble hashingChainingQuadratic probingC) ChainingIn chaining, each slot points to a linked list of collided keys.
In a max-heap, the largest element is always stored at:Any leaf nodeRoot nodeMiddle nodeRight childB) Root nodeThe root of a max-heap contains the maximum element.
Which data structure is used in breadth-first search (BFS)?StackQueuePriority queueLinked ListB) QueueBFS explores level by level using a queue.
Which data structure is best suited for implementing undo operations in text editors?QueueStackLinked ListDequeB) StackUndo operations follow LIFO order, making stacks ideal.
Which traversal technique visits nodes in the order Left → Root → Right?PreorderPostorderInorderLevel OrderC) InorderInorder traversal of BST yields nodes in sorted order.
What is the time complexity of searching in a balanced binary search tree (BST)?O(n)O(log n)O(n log n)O(1)B) O(log n)Balanced BST keeps height ≈ log n, so search is logarithmic.
Which data structure is used in Breadth-First Search (BFS)?StackQueuePriority QueueHeapB) QueueBFS explores level by level using a queue.
In hashing, what is the purpose of a hash function?Compress dataConvert keys into array indicesEncrypt keysSort keysB) Convert keys into array indicesHash functions map keys uniformly into the hash table index space.
Which is the worst-case time complexity of QuickSort?O(n log n)O(log n)O(n^2)O(n)C) O(n^2)Worst case occurs when pivot selection is poor.
Which of the following is a non-linear data structure?ArrayStackGraphQueueC) GraphGraphs are non-linear due to node and edge relationships.
Which traversal is used for breadth-first search of a graph?StackQueueTreeHeapB) QueueBFS explores level-wise using a queue.
Which data structure is best for implementing undo operations?QueueStackArrayTreeB) StackUndo follows LIFO order, implemented via stack.
Which traversal technique uses a queue in binary trees?InorderPreorderPostorderLevel OrderD) Level OrderLevel order uses BFS, which requires a queue.
Which data structure is used for implementing priority scheduling?StackQueuePriority QueueDequeC) Priority QueuePriority queues process elements based on priority.
Which hashing technique handles collisions?Linear ProbingBinary SearchDFSBFSA) Linear ProbingLinear Probing places colliding keys in the next available slot.
Height of an empty binary tree is:0-11InfiniteB) -1By definition, empty trees have height -1.
Which tree is designed to keep data balanced for faster searching and insertion?Binary Search TreeAVL TreeHeapB-treeB) AVL TreeAVL trees self-balance by maintaining height difference ≤ 1.
What is the worst-case time complexity of QuickSort?O(log n)O(n log n)O(n²)O(n)C) O(n²)When the pivot is poorly chosen, QuickSort degrades to O(n²).
In graph theory, what is a spanning tree?Tree with maximum edgesSubgraph including all vertices with minimum edgesDirected acyclic graphPath covering all edgesB) Subgraph including all vertices with minimum edgesA spanning tree connects all nodes with n−1 edges.