Q: 1 Which of the following is NOT a step in the Divide and Conquer algorithm?
Combine
Conquer
Divide
None of the above
[ Option D ]
A Divide and Conquer algorithm are a problem-solving technique where a big problem is broken into smaller ones, solved individually, and then combined to produce the final answer. This method is used in algorithms like Merge Sort, Quick Sort, and Binary Search. The Divide and Conquer approach follow three main steps:
Q: 2 Which of the following highly uses the concept of an array?
Binary search tree
Caching
Spatial locality
Scheduling of processes
[ Option C ]
Spatial Locality is a principle of memory access that states if a memory location is accessed, nearby memory locations are likely to be accessed soon. Since arrays store data in contiguous memory locations, accessing elements sequentially benefits heavily from spatial locality. Thus, arrays highly utilize this concept.
Q: 3 Which of the following best describes memorization in dynamic programming?
Storing the results of function calls to avoid recomputation
Rewriting recursive functions to be iterative
Ignoring sub-problems that don’t affect the final result
Using arrays to sort sub-problems
[ Option A ]
Memorization is a key technique used in dynamic programming to improve efficiency by:
In other word, instead of recalculating the result every time, we "memorize" (store) it — typically using an array, map, or hash table.
Q: 4 Which of the following statement is false?
Data structure is particular way of organizing data
Subtraction of two pointer is equal to the difference in terms of number of blocks
A function is block of statement which is used to perform task
None of these
[ Option D ]
A data structure is indeed a particular way of organizing and storing data so that it can be accessed and modified efficiently. This is true.
Subtraction of two pointers gives the difference in terms of number of elements (blocks) between them, not bytes. This is true.
A function is a block of statements used to perform a specific task. This is true.
Since all the given statements (A), (B), and (C) are true, there is no false statement among them.
Q: 5 Which of the following is NOT and NP-Complete problem?
Traveling Salesman Problem
Boolean Satisfiability Problem
Shortes Path Problem
None of the above
[ Option C ]
NP-Complete problems are a class of computational problems that are considered difficult because, while a proposed solution can be verified quickly (in polynomial time), there is no known algorithm that can solve all instances of the problem efficiently. Examples include the Traveling Salesman Problem (TSP), which involves finding the shortest possible route visiting all cities, and the Boolean Satisfiability Problem (SAT), which asks whether a boolean formula can be satisfied.
The Shortest Path Problem, which finds the minimum path between nodes in a graph, is not NP-Complete, because it can be solved efficiently in polynomial time using algorithms like Dijkstra’s or Bellman-Ford.
Q: 6
Match List-I (Solution Approach) with List-II (Problems) and select the correct answer:
| List-I | List-II |
|---|---|
| A. Divide and Conquer Approach | 1. Graph Coloring |
| B. Dynamic Programming | 2. 0/1 Knapsack |
| C. Greedy Approach | 3. Strassen Matrix Multiplication |
| D. Backtracking | 4. Huffman Encoding |
A-3, B-1, C-2, D-4
A-3, B-2, C-1, D-4
A-3, B-2, C-4, D-1
A-4, B-3, C-1, D-2
[ Option C ]
The Divide and Conquer Approach solves problems by dividing them into smaller independent subproblems and combining their solutions, which is exactly how Strassen Matrix Multiplication reduces matrix multiplication complexity.
Strassen’s Algorithm divides matrices into smaller sub-matrices, solves them recursively, and then combines the results.
Dynamic Programming is used when a problem has overlapping subproblems and optimal substructure. Dynamic programming stores intermediate results to avoid repeated computation. The 0/1 Knapsack problem has overlapping subproblems and optimal substructure.
The Greedy Approach works by making locally optimal choices, and Huffman Encoding uses this idea by repeatedly choosing the least frequent symbols to build an optimal coding tree.
The Backtracking is used to explore all possible solutions by trying choices and undoing them if they lead to failure. Graph Coloring tries different color assignments and backtracks whenever a conflict occurs, making backtracking the suitable approach.
Q: 7 The knapsack problem where the objective function is to minimize the profit is-
Greedy
Dynamic 0/1
Back Tracking
Branch & Bound 0/1
[ Option D ]
The 0/1 Knapsack problem is a classic combinatorial optimization problem where each item must be either included or excluded from the knapsack. In this version, the objective is to minimize the profit (or cost), rather than maximize it. Simple greedy methods are not suitable here because they do not always guarantee an optimal solution for 0/1 decisions.
To handle minimization effectively, the Branch & Bound (0/1) technique is used. This method systematically explores all possible combinations of items while using bounds to prune suboptimal branches, which reduces unnecessary computations. While dynamic programming or backtracking can also solve the problem.
Thank you so much for taking the time to read my Computer Science MCQs section carefully. Your support and interest mean a lot, and I truly appreciate you being part of this journey. Stay connected for more insights and updates! If you'd like to explore more tutorials and insights, check out my YouTube channel.
Don’t forget to subscribe and stay connected for future updates.