Practice objective questions
for quick revision and examination
preparation. Try answering each question
before revealing the answer.
π Design and Analysis of Algorithms
π Unit 4
π― MCQs
Design and Analysis of Algorithms - Unit-4
1
What defines a greedy algorithm?
AAn algorithm that tries every possible solution to find the best one.
BAn algorithm that makes the locally optimal choice at each step.
CAn algorithm that reconsiders previous decisions based on future choices.
DAn algorithm that uses backtracking to ensure all possibilities are covered.
Correct AnswerAn algorithm that makes the locally optimal choice at each step.
2
In which scenario is a greedy algorithm guaranteed to find the global optimum?
AWhen the problem has overlapping subproblems and optimal substructure.
BWhen the problem exhibits the property of "greedy choice property" and "optimal substructure."
CWhen the problem is NP-complete.
DWhen the problem can be divided into smaller instances that can be solved independently.
Correct AnswerWhen the problem exhibits the property of "greedy choice property" and "optimal substructure."
3
What is the "greedy choice property" in the context of greedy algorithms?
AA global optimal solution can be arrived at by choosing the local optimum.
BThe choice made at each step is reversible.
CThe choice depends on choices made in previous steps.
DMultiple choices are evaluated before making a decision.
Correct AnswerA global optimal solution can be arrived at by choosing the local optimum.
4
Why might a greedy algorithm not always produce an optimal solution?
ABecause it always makes the safest choice.
BBecause it may make a choice that seems best at the moment but is not optimal overall.
CBecause it evaluates all possible choices at each step.
DBecause it uses dynamic programming.
Correct AnswerBecause it may make a choice that seems best at the moment but is not optimal overall.
5
Which characteristic does a problem need to have for a greedy algorithm to be applicable?
AThe problem must be divisible into smaller independent subproblems.
BThe problem should allow a global optimal solution to be assembled from local optima.
CThe problem requires the solution to consider future consequences of current decisions.
DThe problem must be solved in polynomial time.
Correct AnswerThe problem should allow a global optimal solution to be assembled from local optima.
6
What is the primary difference between dynamic programming and greedy algorithms?
ADynamic programming makes use of recursion, while greedy algorithms do not.
BGreedy algorithms solve subproblems and combine their solutions; dynamic programming does not.
CDynamic programming solves each subproblem once and stores the result, while greedy algorithms make decisions from the given solution set without looking back.
DGreedy algorithms are used for optimization problems, while dynamic programming is not.
Correct AnswerDynamic programming solves each subproblem once and stores the result, while greedy algorithms make decisions from the given solution set without looking back.
7
Which of the following is a characteristic of greedy algorithms?
AThey are always the most efficient solution.
BThey can always backtrack to find the best solution.
CThey make a series of choices that are locally optimal, aiming for a global optimum.
DThey require complete knowledge of future decisions.
Correct AnswerThey make a series of choices that are locally optimal, aiming for a global optimum.
8
What can be a downfall of using a greedy algorithm for a particular problem?
AThey are too slow for large datasets.
BThey may not consider the overall problem, leading to suboptimal solutions.
CThey can only solve problems that can be expressed recursively.
DThey often require more memory than other algorithms.
Correct AnswerThey may not consider the overall problem, leading to suboptimal solutions.
9
What is the main objective of the job sequencing with deadlines problem?
ATo complete all jobs within their deadlines.
BTo maximize the total number of jobs done.
CTo maximize the total profit while respecting job deadlines.
DTo minimize the total time taken to complete the jobs.
Correct AnswerTo maximize the total profit while respecting job deadlines.
10
In the context of job sequencing, what does a deadline signify?
AThe time at which a job must start.
BThe time by which a job must be completed.
CThe total duration of a job.
DThe waiting time before a job can be started.
Correct AnswerThe time by which a job must be completed.
11
Which strategy is typically used to solve the job sequencing problem using a greedy algorithm?
ASelecting jobs in ascending order of deadlines.
BSelecting jobs in descending order of their profits.
CSelecting jobs in ascending order of their duration.
DSelecting jobs randomly.
Correct AnswerSelecting jobs in descending order of their profits.
12
Why is the greedy choice property useful in solving the job sequencing problem?
AIt helps in choosing the job with the maximum duration first.
BIt ensures that jobs with earlier deadlines are always completed first.
CIt focuses on selecting jobs that offer the highest profit first.
DIt ensures all jobs are completed without overlapping.
Correct AnswerIt focuses on selecting jobs that offer the highest profit first.
13
What does the feasibility check involve in job sequencing with deadlines?
AChecking if a job can be completed before its deadline after scheduling.
BChecking if jobs overlap with each other.
CChecking if the total duration exceeds the total available time.
DChecking if all jobs can be completed in a single sequence.
Correct AnswerChecking if a job can be completed before its deadline after scheduling.
14
Which of the following is a true statement about the job sequencing problem?
AIt can always guarantee that all jobs will be completed within their deadlines.
BIt may not be possible to complete all jobs within their deadlines.
CThere is no need to consider deadlines as long as the profit is maximized.
DThe sequence in which jobs are selected does not affect the total profit.
Correct AnswerIt may not be possible to complete all jobs within their deadlines.
15
What limitation does the greedy algorithm face when solving job sequencing problems?
AIt cannot handle jobs with identical deadlines.
BIt may not always lead to the optimum solution of sequencing all jobs.
CIt requires that all jobs have different profits.
DIt must always select jobs in order of increasing profit.
Correct AnswerIt may not always lead to the optimum solution of sequencing all jobs.
16
In a job sequencing scenario, what happens if a job cannot be completed by its deadline?
AThe job is done anyway, but the profit is not counted.
BThe job is typically not included in the sequence.
CThe deadline of the job is extended to accommodate the schedule.
DThe profit of the job is reduced proportionally to the delay.
Correct AnswerThe job is typically not included in the sequence.
17
Which factor is NOT usually considered while applying a greedy method to job sequencing with deadlines?
AProfit of each job
BDuration of each job
CDeadline of each job
DNumber of resources needed
Correct AnswerNumber of resources needed
18
What is the ideal outcome when applying a greedy approach to job sequencing with deadlines?
ACompleting all jobs irrespective of their profit.
BMaximizing the total profit while adhering to the deadlines of as many jobs as possible.
CMinimizing the total time taken for job completion.
DEnsuring no two jobs overlap in the schedule.
Correct AnswerMaximizing the total profit while adhering to the deadlines of as many jobs as possible.
19
What distinguishes the Fractional Knapsack problem from the 0/1 Knapsack problem?
AItems in the Fractional Knapsack can only be taken once.
BItems can be divided into smaller parts in the Fractional Knapsack.
CAll items must be taken in the 0/1 Knapsack.
DThe knapsack has unlimited capacity in the Fractional problem.
Correct AnswerItems can be divided into smaller parts in the Fractional Knapsack.
20
What is the main objective of the Fractional Knapsack problem?
ATo maximize the total weight of the knapsack.
BTo minimize the total weight of the knapsack.
CTo maximize the total value of items in the knapsack.
DTo minimize the total value of items in the knapsack.
Correct AnswerTo maximize the total value of items in the knapsack.
21
Which strategy is typically employed to solve the Fractional Knapsack problem using a greedy method?
ASelecting items based on maximum weight.
BSelecting items based on maximum value.
CSelecting items based on maximum value-to-weight ratio.
DSelecting items based on minimum value-to-weight ratio.
Correct AnswerSelecting items based on maximum value-to-weight ratio.
22
Why is the greedy algorithm suitable for solving the Fractional Knapsack problem?
AIt always finds the globally optimal solution.
BIt efficiently utilizes the knapsack's capacity to maximize total value.
CIt prioritizes heavier items first.
DIt requires sorting items by their weights.
Correct AnswerIt efficiently utilizes the knapsack's capacity to maximize total value.
23
What does the 'greedy choice' involve in the Fractional Knapsack problem?
ATaking the smallest item to save space.
BTaking the item with the highest value first.
CTaking the item with the highest value-to-weight ratio first.
DTaking the item with the lowest weight first.
Correct AnswerTaking the item with the highest value-to-weight ratio first.
24
In the context of the greedy method for the Fractional Knapsack, what must be done before making selections?
AItems must be sorted by weight in ascending order.
BItems must be sorted by value in ascending order.
CItems must be sorted by value-to-weight ratio in descending order.
DItems must be divided into equal weights.
Correct AnswerItems must be sorted by value-to-weight ratio in descending order.
25
What is a limitation of the greedy algorithm when applied to the 0/1 Knapsack problem instead of the Fractional Knapsack?
AIt cannot guarantee the optimum solution.
BIt takes too long to compute.
CIt requires items to be divisible.
DIt must use a different sorting criterion.
Correct AnswerIt cannot guarantee the optimum solution.
26
What happens when an item is selected for inclusion in the knapsack in the Fractional Knapsack problem?
AThe item is taken in its entirety.
BOnly a fraction of the item may be taken.
CThe remaining items are re-evaluated.
DThe knapsack's capacity is increased.
Correct AnswerOnly a fraction of the item may be taken.
27
Which of the following scenarios best applies the Fractional Knapsack problem's solution method?
APacking a bag with whole items for a camping trip where the bag's capacity is limited.
BDistributing resources in parts to different departments based on urgency and importance.
CChoosing courses to meet as many graduation requirements as possible within a limited number of slots.
DLoading cargo of various sizes and values into a ship without exceeding the weight limit.
Correct AnswerLoading cargo of various sizes and values into a ship without exceeding the weight limit.
28
What characteristic of items is irrelevant to solving the Fractional Knapsack problem using the greedy method?
AThe weight of the items.
BThe value of the items.
CThe color of the items.
DThe value-to-weight ratio of the items.
Correct AnswerThe color of the items.
29
The main time taking step in fractional knapsack problem is ___________
ABreaking items into fraction
BAdding items into knapsack
CSorting
DLooping through sorted items
Correct AnswerSorting
30
Given items as {value,weight} pairs {{60,20},{50,25},{20,5}}. The capacity of knapsack=40. Find the maximum value output assuming items to be divisible and nondivisible respectively.
A100, 80
B110, 70
C130, 110
D110, 80
Correct Answer110, 80
31
Given items as {value,weight} pairs {{40,20},{30,10},{20,5}}. The capacity of knapsack=20. Find the maximum value output assuming items to be divisible.
A60
B80
C100
D40
Correct Answer60
32
What is the primary goal of constructing a Minimum Cost Spanning Tree (MCST) in a weighted graph?
ATo find the shortest path between two specific vertices.
BTo connect all vertices with the least total edge weight without creating cycles.
CTo find the longest possible path without repeating edges.
DTo maximize the differences in weight between consecutive edges.
Correct AnswerTo connect all vertices with the least total edge weight without creating cycles.
33
Which algorithm is a popular greedy method used to find the MCST of a graph?
ADijkstraβs Algorithm
BKruskalβs Algorithm
CFloyd-Warshall Algorithm
DBellman-Ford Algorithm
Correct AnswerKruskalβs Algorithm
34
What is the key characteristic of Kruskalβs algorithm when forming a minimum spanning tree?
AIt starts from the highest weight edges and includes them if they don't form a cycle.
BIt begins at a chosen vertex and explores adjacent vertices progressively.
CIt sorts all edges in ascending order by weight and includes them if they donβt close a cycle.
DIt selects edges randomly until all vertices are connected without cycles.
Correct AnswerIt sorts all edges in ascending order by weight and includes them if they donβt close a cycle.
35
In the context of MCST, what role does a "cycle" play?
AIt helps in reducing the total cost of the spanning tree.
BIt is necessary to ensure all vertices are connected.
CIt must be avoided to ensure a valid spanning tree.
DIt represents the maximum weight edge in the graph.
Correct AnswerIt must be avoided to ensure a valid spanning tree.
36
What is the objective of the Single Source Shortest Path problem?
ATo find the shortest paths from a specific source vertex to all other vertices in the graph.
BTo determine the longest path from a single source to a destination.
CTo calculate the shortest path that visits all vertices starting from a source.
DTo find a path that maximizes the total edge weights from a source to all other vertices.
Correct AnswerTo find the shortest paths from a specific source vertex to all other vertices in the graph.
37
Which algorithm is a well-known greedy method for solving the SSSP problem in graphs without negative weight edges?
AKruskalβs Algorithm
BDijkstraβs Algorithm
CFloyd-Warshall Algorithm
DBellman-Ford Algorithm
Correct AnswerDijkstraβs Algorithm
38
What is a characteristic feature of Dijkstraβs algorithm?
AIt re-evaluates the shortest path tree if a shorter path is discovered.
BIt processes all vertices and edges in a random order.
CIt requires the graph to be unweighted.
DIt uses a priority queue to choose the vertex with the smallest known distance from the source.
Correct AnswerIt uses a priority queue to choose the vertex with the smallest known distance from the source.
39
How does Dijkstraβs algorithm determine the next vertex to process?
ABy selecting the vertex closest to the source based on physical distance.
BBy selecting the vertex with the smallest tentative distance to the source.
CBy choosing vertices in alphabetical order.
DBy randomly selecting any vertex that has not been processed yet.
Correct AnswerBy selecting the vertex with the smallest tentative distance to the source.
40
In Dijkstraβs algorithm, what happens if a shorter path to a vertex is found after it has been processed?
AThe algorithm backtracks to reconsider the best path.
BThe algorithm updates the distances for all adjacent vertices.
CThe algorithm does not allow updates; the path remains fixed.
DThe priority queue is updated with the new shorter distance.
Correct AnswerThe priority queue is updated with the new shorter distance.
Fill in the Blanks
41
The Greedy method is a heuristic strategy used to find __________ solutions at each step, with the hope of finding a global optimum.
Correct AnswerLocally optimal
42
At each step of the Greedy method, a decision is made that appears to be the __________ choice at that moment.
Correct AnswerBest (or optimal)
43
Greedy algorithms do not always guarantee an __________ solution.
Correct AnswerOptimal
44
The choice made by a Greedy algorithm is based only on the information available at the __________, without considering future consequences.
Correct AnswerCurrent step
45
Greedy algorithms are often used for __________ problems where a sequence of choices needs to be made.
Correct AnswerOptimization
46
The Greedy method is particularly effective when __________ subproblems can be solved independently.
Correct AnswerSubsequent
47
Greedy algorithms are well-suited for problems with _____________ choices, where the locally optimal choice also leads to a globally optimal solution.
Correct Answerindependent
48
However, the greedy method might not always find the _____________ solution, as it focuses on short-term gains.
Correct Answeroptimal
49
An example of a problem where the greedy method works well is finding the minimum spanning tree of a graph, using algorithms like Prim's or Kruskal's. Here, choosing the _____________ edge at each step contributes to the overall goal.
Correct Answerlowest weight
50
In Job Sequencing with Deadlines, each job has a __________ and a __________ associated with it.
Correct AnswerDeadline, profit
51
The Greedy method for Job Sequencing with Deadlines involves selecting jobs based on their __________, starting with the job that has the __________ deadline.
Correct AnswerProfit, earliest (or closest)
52
If a job cannot be scheduled due to lack of available slots within its deadline, it is __________.