Data Structure Mcqs
Data Structure Mcqs
(1) What is a data structure? A) A way to store and organize data B) A type of database C) A
data transmission protocol D) A computer network Answer: A
(2) Which of the following is a linear data structure? A) Tree B) Graph C) Array D) Hash table
Answer: C
(3) Which data structure uses LIFO principle? A) Queue B) Stack C) Array D) Linked List
Answer: B
(4) In which data structure are elements stored in contiguous memory locations? A) Stack B)
Array C) Linked List D) Tree Answer: B
(5) Which of the following is an example of a non-linear data structure? A) Stack B) Queue C)
Tree D) Array Answer: C
(6) What is the index of the first element in an array? A) -1 B) 1 C) 0 D) Depends on language
Answer: C
(7) Which of the following is a dynamic data structure? A) Array B) Stack C) Linked List D)
Matrix Answer: C
(8) How many dimensions can an array have? A) One B) Two C) Any number D) Three only
Answer: C
(9) Which data structure is best suited for arithmetic expression evaluation? A) Queue B) Graph
C) Stack D) Tree Answer: C
(10) Which of the following allows random access? A) Linked List B) Stack C) Queue D) Array
Answer: D
(11) What is a sparse matrix? A) A matrix with all elements B) A matrix with no zero elements
C) A matrix with majority elements as zero D) A matrix with only diagonal elements Answer: C
(12) Which operation inserts an element at the top of a stack? A) Pop B) Insert C) Push D) Add
Answer: C
(13) Which operation removes the top element from a stack? A) Delete B) Remove C) Pull D)
Pop Answer: D
(14) Which notation is used for postfix expression? A) Operator before operand B) Operator
between operands C) Operand before operator D) None Answer: C
(15) Which is NOT a valid stack operation? A) Push B) Peek C) Insert at bottom D) Pop
Answer: C
(16) Recursion uses which data structure internally? A) Queue B) Stack C) Heap D) Tree
Answer: B
(17) Which of the following is used to convert infix to postfix? A) Queue B) Stack C) Tree D)
Graph Answer: B
(18) What does the peek operation do? A) Inserts element B) Deletes element C) Returns top
element without removing it D) Empties stack Answer: C
(19) What is the maximum number of elements a stack can hold if the size is defined as 10? A) 9
B) 10 C) 11 D) Depends on system Answer: B
(20) Which algorithm is used to solve Tower of Hanoi? A) Recursion B) Iteration C) Searching
D) Backtracking Answer: A
(21) Which of the following is not a data structure operation? A) Traversal B) Insertion C)
Compiling D) Deletion Answer: C
(22) Which of these supports FIFO? A) Stack B) Array C) Queue D) Tree Answer: C
(23) In array implementation of stack, overflow occurs when: A) Stack is empty B) Stack is full
C) Stack has one element D) Stack pointer is at zero Answer: B
(24) What happens when a stack underflows? A) It adds data automatically B) It performs peek
C) It accesses invalid memory D) It resets itself Answer: C
(25) Two-dimensional arrays are best suited to represent: A) Trees B) Graphs C) Matrices D)
Queues Answer: C
(26) Which of these supports dynamic memory allocation? A) Array B) Stack C) Linked List D)
Matrix Answer: C
(28) Which stack operation checks the top without removing it? A) Push B) Pop C) Peek D)
Empty Answer: C
(29) Which notation requires no parenthesis? A) Infix B) Prefix C) Postfix D) Both B and C
Answer: D
(30) What is the time complexity of push operation in stack? A) O(log n) B) O(n) C) O(1) D)
O(n log n) Answer: C
(31) Which structure uses nodes and pointers? A) Stack B) Array C) Linked List D) Queue
Answer: C
(32) The array index must be of type: A) float B) double C) integer D) char Answer: C
(33) Which of the following is not true for stack? A) Stack can be implemented using array B)
Stack can be implemented using linked list C) Stack can have multiple tops D) Stack is LIFO
Answer: C
(34) What does 'n-dimensional array' refer to? A) 1D array B) Array with two indices C) Array
with more than 2 dimensions D) Sparse matrix Answer: C
(35) Which of these is not a valid operation on arrays? A) Traversing B) Insertion at random
position C) Deletion D) Reversal Answer: B
(36) Which expression type needs conversion before evaluation? A) Postfix B) Infix C) Prefix D)
Mixed Answer: B
(37) Which is the base case in Tower of Hanoi problem? A) Move 1 disk B) Move 2 disks C)
Move all disks D) None Answer: A
(38) Which of the following cannot be used with stacks? A) Expression conversion B)
Expression evaluation C) Tree traversal D) Binary search Answer: D
(39) Which of the following is used to implement recursion? A) Stack B) Queue C) Linked List
D) Array Answer: A
(40) Stack overflow means: A) More memory allocated B) Stack full C) Stack empty D)
Operation successful Answer: B
(41) Which matrix has mostly zero elements? A) Dense B) Sparse C) Regular D) Uniform
Answer: B
(42) In recursion, base case is: A) Termination point B) Function call C) Stack top D) Starting
point Answer: A
(43) What data structure is used in depth-first traversal? A) Queue B) Stack C) Graph D) Array
Answer: B
(44) A stack can be implemented using: A) Array only B) Linked List only C) Array or Linked
List D) Matrix Answer: C
(45) If you remove an element from an empty stack: A) Stack resets B) Error or underflow
occurs C) Value becomes 0 D) Nothing happens Answer: B
(46) What is the use of stack in backtracking? A) Stores visited path B) Stores parent node C)
Tracks solution D) All of the above Answer: D
(47) Which of these supports random insertion? A) Stack B) Array C) Queue D) Linked List
Answer: D
(49) In tower of Hanoi with 3 disks, how many moves are required? A) 7 B) 5 C) 6 D) 9
Answer: A
(51) The push operation adds element: A) Anywhere B) Bottom of stack C) Top of stack D)
Middle Answer: C
(52) What does a two-dimensional array look like? A) Line B) Matrix C) Tree D) List Answer:
B
(53) A stack is said to be empty when: A) Top = -1 B) Top = 0 C) Top = size D) Stack has no
memory Answer: A
(55) Which is not an application of stack? A) Undo feature B) Parenthesis checker C) Binary
search D) Expression evaluator Answer: C
(56) Maximum size of an array is determined at: A) Compile time B) Run time C) Link time D)
Depends on system Answer: A
(57) Which structure has no limit on data size? A) Stack B) Queue C) Linked List D) Array
Answer: C
(58) Which function solves Tower of Hanoi? A) Recursive() B) hanoi() C) TOH() D) All of the
above Answer: D
(59) What kind of array has variable number of elements in each row? A) Rectangular B) Jagged
C) Sparse D) Multidimensional Answer: B
(60) Stack pointer keeps track of: A) Bottom element B) All elements C) Top element D) Middle
element Answer: C
(61) Postfix expression evaluation is: A) Left to right B) Right to left C) Top to bottom D) Based
on priority Answer: A
(62) Infix notation of AB+C* is: A) A+(BC) B) A+BC C) (A+B)C D) A(B+C) Answer: B
(63) What is 2D array? A) Collection of strings B) Matrix with rows and columns C) Linear
array D) None Answer: B
(64) N-dimensional arrays are represented using: A) Stack B) Pointers C) Nested arrays D) All
of the above Answer: D
(65) Which operation is invalid on a full stack? A) Push B) Pop C) Peek D) Display Answer: A
(66) How is a sparse matrix stored efficiently? A) 2D array B) Linked list C) Triplet or array of
structures D) Tree Answer: C
(68) Which stack operation takes constant time? A) Push B) Pop C) Peek D) All of the above
Answer: D
(69) Recursive functions must have: A) Loop B) Base case C) Stack D) Queue Answer: B
(70) Array is best when: A) Insertion is frequent B) Memory is limited C) Random access is
needed D) Size is dynamic Answer: C
(71) What is needed to convert infix to postfix? A) Stack B) Queue C) Tree D) Loop Answer: A
(72) What is time complexity for evaluating postfix? A) O(n^2) B) O(log n) C) O(n) D) O(1)
Answer: C
(73) Which is better for recursive functions? A) Iteration B) Stack C) Array D) Queue Answer:
B
(74) What happens when recursion depth exceeds? A) Memory leak B) Stack overflow C) Core
dump D) Program exits Answer: B
(75) Stacks are used in: A) Operating systems B) Compiler design C) Expression parsing D) All
of the above Answer: D
(76) Which case terminates a recursive call? A) Infinite loop B) Base condition met C) Stack full
D) Memory exhausted Answer: B
(77) What is the result of prefix +AB? A) A+B B) B+A C) A*B D) Error Answer: A
(78) What is the stack size after 3 push and 1 pop? A) 2 B) 3 C) 4 D) 1 Answer: A
(81) Which problem uses recursion effectively? A) Tower of Hanoi B) Linear search C) Binary
search D) Hashing Answer: A
(82) Which is not part of stack operations? A) Push B) Peek C) Enqueue D) Pop Answer: C
(83) Stacks are preferred when: A) First inserted item needed B) Last inserted item needed C)
Any element needed D) None Answer: B
(84) Stack can be used for: A) Function calls B) Parsing C) Backtracking D) All of the above
Answer: D
(86) What determines efficiency of recursion? A) Base case B) Stack usage C) Memory usage D)
All of the above Answer: D
(87) Array elements are stored: A) Randomly B) Sequentially C) Scattered D) Virtually Answer:
B
(88) What structure is used in undo/redo? A) Stack B) Array C) Tree D) Queue Answer: A
(89) What makes sparse matrix useful? A) Fast access B) Less memory C) More zeros D)
Multiple types Answer: B
(92) Function call in recursion is stored in: A) Stack frame B) Heap C) Tree D) Table Answer:
A
(94) In sparse matrix, non-zero elements are stored: A) Only in arrays B) As triplets C) In linked
lists D) In matrices Answer: B
(96) Stack implemented by array is: A) Static B) Dynamic C) Hybrid D) Circular Answer: A
(97) Top pointer after one push on empty stack: A) 0 B) -1 C) 1 D) Depends Answer: A
(98) Which algorithm uses stack? A) Depth-first search B) Breadth-first search C) Linear search
D) Hashing Answer: A
(99) What is reverse Polish notation? A) Prefix B) Infix C) Postfix D) None Answer: C
(100) Which structure tracks function calls? A) Tree B) Stack C) Queue D) Array Answer: B
UNIT 2
Queues and Linked Lists – MCQs
(1) What is a queue? A) A data structure following LIFO B) A linear data structure following
FIFO C) A circular structure D) A random structure Answer: B
(2) Which operation inserts an element in a queue? A) Pop B) Peek C) Enqueue D) Delete
Answer: C
(3) Which operation removes an element from a queue? A) Insert B) Enqueue C) Dequeue D)
Add Answer: C
(4) Which of the following is a circular queue? A) Queue with a fixed size B) Queue
implemented with linked list C) Queue where rear connects to front D) Queue used in trees
Answer: C
(5) What is a deque? A) Queue with one end B) Stack + Queue C) Double-ended queue D) Non-
linear structure Answer: C
(6) What is a priority queue? A) Normal queue B) Queue with random insertion C) Queue where
elements are dequeued based on priority D) Queue used in recursion Answer: C
(7) Which is NOT a queue application? A) CPU scheduling B) Disk scheduling C) Simulation
D) Arithmetic evaluation Answer: D
(8) Which algorithm uses queues in CPU scheduling? A) Tower of Hanoi B) Round Robin C)
Merge Sort D) Recursion Answer: B
(9) What happens in round robin scheduling? A) Each process gets fixed time B) One process
runs forever C) One queue for all D) Recursive execution Answer: A
(10) In simulation, queues are used to: A) Sort elements B) Reverse input C) Model waiting lines
D) Solve equations Answer: C
(11) Which data structure is used in breadth-first search? A) Stack B) Queue C) Tree D) Graph
Answer: B
(12) What is a linked list? A) Array of integers B) List with contiguous elements C) Collection
of nodes linked together D) File system Answer: C
(13) What is the first node in a linked list called? A) Start B) Begin C) Head D) Entry Answer:
C
(14) What does a node contain in a single linked list? A) Data only B) Data and pointer to next
C) Data and pointer to previous D) Key and value Answer: B
(15) What is circular linked list? A) List with repeated data B) Last node points to head C) List
with no head D) List with tail only Answer: B
(16) What is a doubly linked list? A) List with two data fields B) List where nodes point in one
direction C) List with previous and next pointers D) List sorted by key Answer: C
(17) What is the difference in circular doubly linked list? A) Tail points to head and vice versa
B) List without NULL pointers C) List with two heads D) List only for stack Answer: A
(18) Which linked list type uses most memory? A) Single B) Circular C) Doubly D) Circular
doubly Answer: D
(19) Which of the following allows traversal in both directions? A) Stack B) Queue C) Doubly
linked list D) Single linked list Answer: C
(20) Which is not a valid operation on a linked list? A) Insert B) Search C) Pop D) Delete
Answer: C
(22) What does a polynomial term consist of? A) Only coefficients B) Degree only C)
Coefficient and exponent D) Array index Answer: C
(23) In linked list polynomial, each node represents: A) One equation B) One constant C) One
term D) All variables Answer: C
(24) How are polynomial terms stored in a list? A) Randomly B) Sorted by exponent C) Sorted
by coefficient D) Grouped by variable Answer: B
(25) Which data structure is best for polynomial operations? A) Array B) Stack C) Linked List
D) Queue Answer: C
(26) What is the main disadvantage of linked lists over arrays? A) Fixed size B) Extra memory
for pointers C) Slow access time D) Both B and C Answer: D
(27) Which of the following queue types is most useful for scheduling tasks by importance? A)
Circular queue B) Deque C) Priority queue D) FIFO queue Answer: C
(28) Which of these linked lists provides the fastest insertion at both ends? A) Single linked list
B) Circular linked list C) Doubly linked list D) Circular doubly linked list Answer: D
(29) Which pointer is NOT present in a singly linked list? A) Prev B) Next C) NULL D) Head
Answer: A
(30) Which queue structure is used in BFS? A) Stack B) Priority Queue C) Circular Queue D)
Linear Queue Answer: D
(31) What is the time complexity of enqueue operation in a queue? A) O(1) B) O(n) C) O(log n)
D) O(n log n) Answer: A
(32) What is the primary benefit of circular queues over linear queues? A) Simpler
implementation B) Better memory utilization C) Faster processing D) Easier traversal Answer:
B
(33) In a circular queue, when is the queue full? A) rear == size - 1 B) rear == front C) (rear + 1)
% size == front D) rear == NULL Answer: C
(34) Which of the following data structures is most appropriate for implementing a printer
spooler? A) Stack B) Queue C) Linked list D) Tree Answer: B
(35) How is polynomial addition implemented using linked lists? A) Multiply coefficients B)
Add matching exponents C) Merge two sorted lists D) Both B and C Answer: D
(36) What is the time complexity to search an element in a singly linked list? A) O(1) B) O(n) C)
O(log n) D) O(n log n) Answer: B
(37) What is the drawback of singly linked list over doubly linked list? A) Cannot traverse
backward B) Extra memory for pointers C) Cannot insert at front D) Cannot delete Answer: A
(38) Which pointer is updated when inserting a node at the beginning of a singly linked list? A)
Tail B) Rear C) Head D) Next Answer: C
(39) What is the time complexity for inserting a node at the end of a singly linked list (with tail
pointer)? A) O(n) B) O(1) C) O(log n) D) O(n log n) Answer: B
(40) Which of these is not true for doubly linked lists? A) Each node points to the previous node
B) It requires more memory C) It allows backward traversal D) It's faster than singly linked list
for all operations Answer: D
(41) Which of these is used to implement undo operations? A) Queue B) Stack C) Linked List D)
Tree Answer: B
(42) Which of the following is true for a circular linked list? A) First node points to null B) Last
node points to null C) Last node points to head D) No node points to another Answer: C
(43) In which scenario is a circular queue more efficient than a linear queue? A) When elements
need to be reversed B) When front and rear meet C) When queue is implemented using array D)
When queue operations are frequent and fixed-size Answer: D
(44) Which data structure allows insertion and deletion at both ends? A) Queue B) Deque C)
Stack D) Circular linked list Answer: B
(45) Which data structure is most suited for representing polynomials dynamically? A) Array B)
Linked List C) Stack D) Tree Answer: B
(46) What is the primary advantage of linked list over arrays? A) Fixed memory usage B) Easy
to reverse C) Dynamic memory allocation D) Faster sorting Answer: C
(47) In a doubly linked list, the last node contains: A) Null in both pointers B) Pointer to next
only C) Null in next and pointer to previous D) Pointer to previous and next Answer: C
(48) Which of the following is used to remove elements from both ends? A) Deque B) Priority
Queue C) Stack D) Circular Queue Answer: A
(49) How many pointers are needed in a node of a doubly linked list? A) 1 B) 2 C) 3 D) 4
Answer: B
(50) What is the result of enqueue followed by dequeue in a queue? A) Queue is empty B) One
element added C) One element removed D) Queue unchanged Answer: A
(51) Which pointer indicates the end of a singly linked list? A) prev B) head C) NULL D) last
Answer: C
(52) In linked list insertion, where can a node be added? A) Beginning B) End C) Middle D) All
of the above Answer: D
(53) A circular queue eliminates the problem of: A) Memory allocation B) Overflow C) Wasted
memory D) None Answer: C
(54) What is the time complexity of deleting a node from a linked list given its pointer? A) O(n)
B) O(1) C) O(log n) D) O(n log n) Answer: B
(55) In a priority queue, which element is removed first? A) Most recently added B) Highest
value C) Lowest value D) Element with highest priority Answer: D
(56) What does each node of a circular doubly linked list contain? A) Data, next B) Data, next,
previous C) Only data D) Data and index Answer: B
(57) What is the output if the queue is empty and dequeue is performed? A) Underflow error B)
Overflow error C) Memory leak D) Nothing Answer: A
(58) The time complexity to traverse a linked list of size n is: A) O(1) B) O(n) C) O(n²) D) O(log
n) Answer: B
(59) In a linked list, which node contains NULL? A) First B) Middle C) Last D) None Answer:
C
(60) A deque allows insertions and deletions from: A) Front only B) Rear only C) Both ends D)
Middle only Answer: C
(61) A node in a singly linked list has: A) Two pointers B) Data and one pointer C) Only data D)
Previous and next Answer: B
(62) What is the role of the front pointer in a queue? A) Indicates rear B) Indicates first element
C) Points to last node D) Resets memory Answer: B
(63) Which structure can implement polynomial multiplication efficiently? A) Stack B) Queue
C) Array D) Linked list Answer: D
(64) What is the drawback of arrays compared to linked lists? A) Cannot resize B) Easier
insertion C) Easy deletion D) Faster access Answer: A
(65) In a doubly linked list, what happens when a node is deleted? A) Nothing B) Memory is
retained C) Pointers must be adjusted D) Only data is removed Answer: C
(66) Circular linked lists are efficient for: A) Stack operations B) Repeating tasks in loops C)
Random access D) Sorting Answer: B
(67) Which queue is used in level order traversal of binary tree? A) Deque B) Priority Queue C)
Linear Queue D) Circular Queue Answer: C
(68) Which of the following allows insertion at one end and deletion at the other? A) Stack B)
Queue C) Tree D) Graph Answer: B
(70) In a priority queue, which data structure is commonly used? A) Heap B) Linked list C)
Stack D) Binary Tree Answer: A
(71) What is the time complexity to insert a node at the beginning of a linked list? A) O(n) B)
O(1) C) O(log n) D) O(n²) Answer: B
(72) Which operation is not allowed in queue? A) Insert at rear B) Delete from front C) Peek
front D) Insert at front Answer: D
(73) What is the use of a NULL pointer in linked lists? A) Acts as terminator B) Points to last C)
Helps find start D) Indicates overflow Answer: A
(74) What is the best data structure for a playlist where next and previous songs must be
accessible? A) Array B) Stack C) Doubly linked list D) Queue Answer: C
(75) Which queue is used in scheduling disk access? A) Priority queue B) Deque C) Stack D)
Simple queue Answer: A
(76) In a singly linked list, which node does not have a next pointer? A) First B) Last C) Second
D) Middle Answer: B
(77) To represent sparse matrix efficiently, use: A) Array B) Stack C) Triplet linked list D)
Queue Answer: C
(78) What is the default direction of insertion in a queue? A) Front B) Rear C) Middle D)
Random Answer: B
(79) What does a linked list require more of compared to array? A) Time B) Memory C) Pointers
D) None Answer: B
(80) A node is: A) Data only B) Memory cell C) Structure containing data and link D) None
Answer: C
(81) What is front == rear condition in circular queue used to detect? A) Underflow B) Overflow
C) Empty Queue D) Null pointer Answer: B
(82) What is a sentinel node? A) Node used for data B) Dummy node marking end/start C) First
node D) Last node Answer: B
(83) A doubly linked list with one node has: A) NULL in both links B) Self-reference C) One
pointer only D) Cyclic link Answer: A
(84) In linked lists, nodes are created using: A) Arrays B) Structs/Objects C) Classes only D)
None Answer: B
(85) What is necessary to remove an element from a linked list? A) Index B) Key C) Pointer to
previous node D) None Answer: C
(86) A queue implemented using an array has maximum size: A) n+1 B) Fixed at runtime C)
Depends on memory D) Depends on front Answer: B
(87) When rear = front in a circular queue: A) Queue is full B) Queue is empty C) One element
exists D) Error Answer: A
(88) Which linked list type is ideal for games with undo/redo? A) Single B) Circular C) Doubly
D) Random Answer: C
(89) Polynomial expressions are represented using: A) Array B) Stack C) Linked list D) Graph
Answer: C
(90) What operation is common in both stack and queue? A) Push B) Insert C) Delete D) None
Answer: C
(91) In linked list, each element is called: A) Value B) Pointer C) Node D) Data Answer: C
(92) How to reverse a singly linked list? A) Use loop B) Change head C) Update next pointers
D) Delete and insert Answer: C
(93) How to know end of linked list? A) By size B) By NULL C) By memory address D) By
element count Answer: B
(94) What structure manages free memory in dynamic allocation? A) Queue B) Stack C) Free list
D) Array Answer: C
(95) A circular queue is implemented using: A) Stack B) Linked list or array C) Tree D) Graph
Answer: B
(96) What is rear pointer in a queue used for? A) Point to front B) Point to first element C) Insert
new element D) Remove element Answer: C
(97) Which queue gives highest priority to important tasks? A) Simple queue B) Deque C)
Circular queue D) Priority queue Answer: D
(98) What is best data structure for implementing LRU cache? A) Tree B) Linked list + hash C)
Stack D) Array Answer: B
(99) Which linked list type doesn’t use NULL? A) Singly B) Doubly C) Circular D) Multilevel
Answer: C
(100) A dynamic list grows by: A) Looping B) User input C) Allocation on demand D) Fixed
blocks Answer: C
UNIT 3
A) Stack
B) Queue
C) Array
D) Linked List
Answer: C
A) 2i
B) 2i + 1
C) i/2
D) 2i - 1
Answer: A
A) 2i
B) 2i + 1
C) i/2
D) i - 1
Answer: B
A) i/2
B) floor(i/2)
C) 2i
D) i+1
Answer: B
A) Difficult to implement
B) Inefficient for sparse trees
C) Takes too much time
D) Not human readable
Answer: B
A) Array
B) Stack
C) Node with pointers
D) Queue
Answer: C
A) In-order
B) Level-order
C) Post-order
D) Pre-order
Answer: B
A) Complete
B) Sparse
C) Balanced
D) AVL
Answer: B
A) Difficult to implement
B) Inefficient for sparse trees
C) Takes too much time
D) Not human readable
Answer: B
A) Array
B) Stack
C) Node with pointers
D) Queue
Answer: C
A) Data only
B) One pointer only
C) Data and two pointers
D) Only pointers
Answer: C
A) In-order
B) Level-order
C) Post-order
D) Pre-order
Answer: B
A) Complete
B) Sparse
C) Balanced
D) AVL
Answer: B
A) Fixed
B) Dynamic
C) Limited
D) Compact
Answer: B
39. The array representation of a tree with missing nodes leads to:
A) Better efficiency
B) Memory waste
C) Faster traversal
D) Compact storage
Answer: B
A) i/2
B) floor(i/2)
C) 2i
D) i-1
Answer: B
A) In-order
B) Pre-order
C) Post-order
D) Level-order
Answer: B
42. In which traversal is the root visited after both left and right subtrees?
A) In-order
B) Pre-order
C) Post-order
D) Level-order
Answer: C
A) Random order
B) Sorted order
C) Reverse order
D) Post-order
Answer: B
A) Pre-order
B) Post-order
C) In-order
D) Level-order
Answer: D
45. What is the in-order traversal of a tree with root A, left child B, and right child C?
A) A B C
B) B A C
C) C A B
D) B C A
Answer: B
A) Pre-order
B) In-order
C) Post-order
D) Level-order
Answer: A
A) In-order
B) Pre-order
C) Post-order
D) Level-order
Answer: C
A) Post-order
B) In-order
C) Pre-order
D) Level-order
Answer: C
A) In-order
B) Post-order
C) Pre-order
D) Reverse in-order
Answer: B
A) Post-order
B) In-order
C) Pre-order
D) Level-order
Answer: C
A) Post-order
B) Pre-order
C) In-order
D) Level-order
Answer: C
A) O(log n)
B) O(n log n)
C) O(n)
D) O(n²)
Answer: C
A) Level-order
B) In-order
C) Pre-order
D) Post-order
Answer: A
56. Level-order traversal is a type of:
A
/
BC
A) A B C
B) B A C
C) C B A
D) B C A
Answer: B
58. The number of traversals required to reconstruct a binary tree uniquely is:
A) 1
B) 2
C) 3
D) 0
Answer: B
A) Pre-order
B) In-order
C) Post-order
D) Level-order
Answer: C
IV. Types of Binary Trees (61–100)
A) Arithmetic expressions
B) Boolean expressions
C) Logical expressions
D) All of the above
Answer: D
A) Operators
B) Operands
C) Expressions
D) Functions
Answer: B
A) Operands
B) Leaf nodes
C) Operators
D) Values
Answer: C
A) Infix expression
B) Prefix expression
C) Postfix expression
D) None
Answer: A
A) Pre-order
B) In-order
C) Post-order
D) Level-order
Answer: C
A) Operand
B) Operator
C) Variable
D) Constant
Answer: B
A) Compiler design
B) Operating system
C) Databases only
D) Networking
Answer: A
A) Pre-order
B) Post-order
C) In-order
D) Level-order
Answer: C
A) Larger value
B) Equal value
C) Smaller value
D) Random value
Answer: C
A) Balanced tree
B) Sorted list
C) Tree with root 10 and left child 5
D) Unordered structure
Answer: C
A) O(1) search
B) O(n) search
C) Logarithmic search in average case
D) Constant time deletion
Answer: C
A) O(1)
B) O(log n) on average
C) O(n²)
D) O(n log n)
Answer: B
A) O(log n)
B) O(1)
C) O(n)
D) O(n log n)
Answer: C
A) Skewed
B) Balanced
C) Linear
D) Full
Answer: B
A) Pre-order
B) Post-order
C) Reverse in-order
D) Level-order
Answer: C
A) log n
B) n
C) n/2
D) n²
Answer: B
81. Which of the following causes a Binary Search Tree to degenerate into a linked list?
82. In a BST, the node with the smallest value is located at:
A) The root
B) The rightmost node
C) The leftmost node
D) The last inserted node
Answer: C
83. Deletion of a node with one child in a BST requires:
84. Which traversal would result in a sorted descending order for a BST?
A) In-order
B) Pre-order
C) Post-order
D) Reverse in-order
Answer: D
85. Which one of the following BST operations takes O(log n) time in the best case?
A) Insertion
B) Search
C) Deletion
D) All of the above
Answer: D
A) Binary Heap
B) AVL Tree
C) Self-adjusting Binary Search Tree
D) Threaded Tree
Answer: C
A) Rotation
B) Swapping
C) Mirroring
D) Hashing
Answer: A
A) It is deleted
B) It is moved to the root
C) It is stored at the leaf
D) It is ignored
Answer: B
A) O(n)
B) O(n log n)
C) O(log n)
D) O(1)
Answer: C
A) O(n)
B) O(1)
C) O(log n)
D) O(n²)
Answer: C
94. A splay tree is efficient when:
A) Deleting a node
B) Rotating a node to the root
C) Splitting the tree
D) Rebalancing using height
Answer: B
A) Compilers
B) Databases
C) File Systems
D) All of the above
Answer: D
97. Which binary tree type is ideal for searching with minimal time?
A) Skewed tree
B) Splay tree
C) Balanced BST
D) AVL tree
Answer: D
99. Which tree is best when recent accesses are more likely to be repeated?
A) AVL tree
B) Binary search tree
C) Splay tree
D) B-tree
Answer: C
A) A
B) B
C) C
D) D
Answer: D
UNIT 4
A) O(n)
B) O(n log n)
C) O(n²)
D) O(log n)
Answer: C
12. Insertion sort is best suited for:
A) O(n)
B) O(n²)
C) O(n log n)
D) O(n³)
Answer: B
A) Next elements
B) All elements
C) Previous sorted elements
D) Last element only
Answer: C
A) It is not stable
B) It requires additional memory
C) It is adaptive
D) It is recursive
Answer: C
A) O(n)
B) O(n²)
C) O(log n)
D) O(n log n)
Answer: A
A) Large datasets
B) Small or nearly sorted datasets
C) Random data
D) Reversely sorted arrays
Answer: B
19. In insertion sort, the number of comparisons in the worst case is:
A) O(n)
B) O(n log n)
C) O(n²)
D) O(log n)
Answer: C