Design and Analysis of Algorithms MCQs with Answers
Practice important Design and Analysis of Algorithms MCQs with answers and explanations.
Multiple Choice Questions
Q211: In the fractional knapsack problem, which algorithm is typically used to find an optimal solution?
- A: Brute force algorithm
- B: Recursive algorithm
- C: Greedy algorithm
- D: Dynamic programming algorithm
View Answer
C
Q212: What does ρi represent in the context of the fractional knapsack problem?
- A: Value per unit weight ratio
- B: Weight of the item
- C: Value of the item
- D: Total weight of all items
View Answer
A
Q213: When applying the greedy approach to the fractional knapsack problem, items are sorted based on what criteria?
- A: Weight
- B: Value
- C: Weight to value ratio
- D: Total value
View Answer
C
Q214: In the greedy solution for the fractional knapsack, if an item does not fit completely, what is done?
- A: The item is not taken at all
- B: A fraction of the item is taken
- C: The item is discarded
- D: The item is prioritized for later
View Answer
B
Q215: Which of the following statements about the greedy algorithm for the fractional knapsack problem is true?
- A: It is optimal
- B: It is non-optimal
- C: It does not consider item value
- D: It only works for small weights
View Answer
A
Q216: In the example of the 0-1 knapsack problem, what is the total value obtained by taking weights of 5, 20, and 30?
- A: 220
- B: 260
- C: 300
- D: 90
View Answer
A
Q217: If a thief is collecting gold, silver, and bronze, which will they take first according to the greedy strategy?
- A: Bronze
- B: Silver
- C: Gold
- D: All equally
View Answer
A
Q218: In the context of the fractional knapsack problem, if an item has a weight of 40 and does not fit, what is done?
- A: Ignore the item
- B: Wait for more space
- C: Take as much as possible
- D: Resort the items
View Answer
C
Q219: The greedy algorithm is optimal for which of the following knapsack problems?
- A: 0-1 knapsack problem
- B: Fractional knapsack problem
- C: Both A and B
- D: Neither A nor B
View Answer
B
Q220: How does the greedy algorithm determine which item to take next?
- A: Based on weight only
- B: Based on total value
- C: Based on value to weight ratio
- D: Based on item availability
View Answer
C