(Objective Assessment) – 128 Practice Questions with
Answers and Explanations (2026) latest exam update
this year .pdf
Q1. Which abstract data type follows a Last-In, First-Out (LIFO) principle and is
commonly used for function call management and expression evaluation?*
Answer: The stack data structure follows a LIFO principle.
Explanation: Stacks support push and pop operations, making them ideal for recursion,
undo features, and parsing.
Q2. What is the time complexity of accessing an element by its index in a standard
array, and why does this operation have that complexity?*
Answer: Accessing an element by index in an array has O(1) time complexity.
Explanation: Arrays store elements in contiguous memory, allowing direct calculation
of any element's address.
Q3. Which sorting algorithm divides the input array into two halves, recursively sorts
each half, and then merges the two sorted halves back together?*
Answer: Merge sort divides the array, recursively sorts, and merges the halves.
,Explanation: Merge sort is a stable, divide-and-conquer algorithm with O(n log n) time
complexity.
Q4. What is the worst-case time complexity of searching for an element in an
unsorted array using linear search, and why?*
Answer: The worst-case time complexity is O(n).
Explanation: In the worst case, the target may be the last element or not present,
requiring a full scan.
Q5. Which abstract data type follows a First-In, First-Out (FIFO) principle and is
commonly used for breadth-first search and task scheduling?*
Answer: The queue data structure follows a FIFO principle.
Explanation: Queues support enqueue and dequeue operations, preserving insertion
order for processing.
Q6. What is a key disadvantage of using a linked list compared to an array when
frequent random access to elements by index is required?*
Answer: Linked lists have slower random access to elements, requiring O(n) time to
reach a specific index.
Explanation: Linked lists store elements non-contiguously, so each node must be
traversed sequentially.
,Q7. Which data structure is typically used to implement a priority queue efficiently,
allowing insertion and removal of the highest-priority element in logarithmic time?*
Answer: A heap (usually a binary heap) is used to implement a priority queue.
Explanation: Heaps maintain the heap property, enabling O(log n) insertion and
extraction of the max or min.
Q8. What is the average-case time complexity of the quicksort algorithm, and under
what conditions does it achieve this performance?*
Answer: Quicksort has an average-case time complexity of O(n log n).
Explanation: This occurs when the pivot divides the array into roughly equal halves on
average.
Q9. In Python, which built-in data structure is typically used to implement a
dictionary, providing average-case constant time complexity for key lookups?*
Answer: Python dictionaries are typically implemented using hash tables.
Explanation: Hash tables map keys to indices via a hash function, enabling fast
average-case lookups.
Q10. Which tree-based data structure maintains the property that for every node, all
keys in the left subtree are less than the node's key, and all keys in the right subtree
are greater?*
Answer: A binary search tree (BST) maintains this ordering property.
Explanation: BSTs enable efficient search, insertion, and deletion when balanced.
, Q11. What is the worst-case time complexity of searching for an element in a
balanced binary search tree, and why is it better than searching in an unsorted
array?*
Answer: The worst-case time complexity is O(log n) in a balanced BST.
Explanation: Each comparison eliminates half the remaining nodes, unlike linear
search in an unsorted array.
Q12. Which traversal method of a binary tree visits nodes in the order: left subtree,
root, right subtree, and produces a sorted sequence for a binary search tree?*
Answer: Inorder traversal visits nodes in left-root-right order.
Explanation: For a BST, inorder traversal yields keys in ascending order.
Q13. What is the primary advantage of using a doubly linked list over a singly linked
list when frequent backward traversal or deletion of a node given its reference is
required?*
Answer: Doubly linked lists allow efficient backward traversal and easier deletion given a
node reference.
Explanation: Each node has pointers to both next and previous nodes.
Q14. Which sorting algorithm repeatedly selects the smallest (or largest) element
from the unsorted portion and swaps it with the first unsorted element?*