DATA STRUCTURE MCQS
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.