Independent Preparation Bank for Pakistani Computing Graduates • 100% Free • No Signup
NSCTTest.
Simulator
Data Structures & AlgorithmsTopic #4 of 540 MCQs Available

Hashing

Comprehensive question bank, step-by-step rationales, and dedicated timed quiz for Hashing.

Launch Quiz Mode ↗

Hashing Question Bank

Showing 40 questions of 40 with verified answers

10Multiple Choice

(Calculation) In an AVL tree, if a node has a Left Subtree of height 3 and a Right Subtree of height 1, what Rotation is required to fix the balance?

11Multiple Choice

(Conceptual) Which binary tree traversal is also known as a Breadth-First Search (BFS)?

12Multiple Choice

(Scenario-Based) An expression tree represents (3 + 5) * 2. Which traversal will yield the correct **Postfix** notation 3 5 + 2 *?

13Multiple Choice

(Calculation) What is the height of a Complete Binary Tree with 15 nodes? (Assume root is at height 0).

14Multiple Choice

(Conceptual) In a **Max-Heap** (which is a special type of complete binary tree), where is the largest element always located?

15Multiple Choice

(Debugging) While searching for value 40 in a BST, you visit nodes in this order: 10, 50, 20, 30, 45, 35. Is this a valid search path?

16Multiple Choice

(Conceptual) What is the time complexity of Level-order traversal in a tree with N nodes?

17Multiple Choice

(Code-Tracing) Trace the output of **Post-order** traversal for a tree where A is Root, B is Left Child, and C is Right Child.

18Multiple Choice

(Scenario-Based) A database index uses a **B-Tree** instead of a simple BST. What is the main reason?

19Multiple Choice

(Conceptual) What happens during a Left Rotation (RR) in an AVL tree?

20Multiple Choice

(Comparison) How many NULL pointers are there in a Binary Tree with N nodes?

21Multiple Choice

(Scenario-Based) You have a Complete Binary Tree stored in an Array. If a node is at index i (1-based indexing), where is its Left Child?

22Multiple Choice

(Conceptual) What is a Threaded Binary Tree?

23Multiple Choice

(Calculation) What is the minimum number of nodes in an AVL tree of height 3? (Assume height of single node is 0).

24Multiple Choice

(Conceptual) In a **Red-Black Tree**, which is true?

25Multiple Choice

(Scenario-Based) Which data structure is used to implement a Trie (Prefix Tree)?

1Multiple Choice

(Conceptual) Which data structure is primarily used to implement Breadth-First Search (BFS)?

2Multiple Choice

(Scenario-Based) You are representing a social network with 1 billion users, where each user has an average of 100 friends. Which graph representation should you use to save memory?

3Multiple Choice

(Calculation) What is the Time Complexity of performing a DFS traversal on a graph with V vertices and E edges represented as an Adjacency List? •

4Multiple Choice

(Code-Tracing) During a DFS on a Directed Graph, you encounter an edge (u, v) where v is already in the current recursion stack. This indicates:

5Multiple Choice

(Conceptual) Which algorithm is the best choice for finding the shortest path between a single source and all other nodes in a graph with negative edge weights?

6Multiple Choice

(Calculation) How many edges are in a Complete Undirected Graph with n vertices?

7Multiple Choice

(Scenario-Based) A GPS system needs to find the fastest route from Point A to Point B. All road distances are positive. Which algorithm is most likely used?

8Multiple Choice

(Conceptual) What is a Topological Sort of a Directed Acyclic Graph (DAG)?

9Multiple Choice

(Comparison) What is the primary difference between **Kruskal's** and **Prim's** algorithms for finding an MST?

10Multiple Choice

(Code-Tracing) In a graph representation using an Adjacency Matrix adj[V] [V], how do you check if an edge exists between node 3 and node 5?

11Multiple Choice

(Conceptual) A graph is "Disconnected" if:

12Multiple Choice

(Scenario-Based) You need to detect if a "Deadlock" exists in an Operating System. You model the resources and processes as a directed graph. A deadlock exists if:

13Multiple Choice

(Calculation) What is the time complexity of the Floyd-Warshall algorithm?

14Multiple Choice

(Conceptual) In the context of Union-Find (used in Kruskal's), what is the purpose of "Path Compression"?

15Multiple Choice

(Debugging) You run Dijkstra's on a graph and it enters an infinite loop or gives a wrong answer. What is the most likely cause?

16Multiple Choice

(Conceptual) What is the "In-degree" of a vertex in a directed graph?

17Multiple Choice

(Calculation) In a graph with 5 vertices, what is the maximum possible value in its **Adjacency Matrix** (assuming unweighted)?

18Multiple Choice

(Scenario-Based) You want to find the minimum length of a cable needed to connect all houses in a neighborhood so that everyone has internet access. This is a problem of finding:

19Multiple Choice

(Conceptual) What does it mean if a Directed Graph is "Strongly Connected"?

20Multiple Choice

(Code-Tracing) Trace the result of **Kruskal's Algorithm** on three edges: (A-B, 5), (B-C, 10), (A-C, 2). Which edge is picked first?

21Multiple Choice

(Conceptual) Which algorithm is used to find Strongly Connected Components (SCCs) in a directed graph?

22Multiple Choice

(Calculation) What is the Space Complexity of an **Adjacency Matrix** for a graph with V vertices?

23Multiple Choice

(Scenario-Based) You are using BFS to find the shortest path in a graph where all edges have a weight of 10. Will BFS find the correct path?

26Multiple Choice

What is the primary drawback of open addressing with linear probing in a Hash Table when the load factor becomes high?