Algorithm Design Techniques MCQ Quiz - Objective Question with Answer for Algorithm Design Techniques - Download Free PDF
Last updated on Jun 12, 2025
Latest Algorithm Design Techniques MCQ Objective Questions
Algorithm Design Techniques Question 1:
Consider the following Statements
Statement 1: Greedy technique solves the problem correctly and always provides an optimized solution to the problem.
Statement 2: Bellman ford, Floyd-warshal, and Prim’s algorithms use the Dynamic Programming technique to solve the Path problems.
Which of the following is true?
Answer (Detailed Solution Below)
Algorithm Design Techniques Question 1 Detailed Solution
Answer: Option 3
Explanation:
Statement 1: Greedy technique solves the problem correctly and always provides an optimized solution to the problem.
This Statement is False. Since the Greedy technique does not always solve a problem correctly.
Statement 2: Bellman ford, Floyd-warshal, and Prim’s algorithms use the Dynamic Programming technique to solve the Path problems.
This Statement is also False Since Prim's algorithm does not use the Dynamic Programming technique.
Prim's algorithm is a greedy algorithm that finds a minimum spanning tree for a weighted undirected graph.
Algorithm Design Techniques Question 2:
Which one of the following properties of an algorithm ensures that each step of the algorithm is properly defined and the actions to be performed are clearly specified?
Answer (Detailed Solution Below)
Algorithm Design Techniques Question 2 Detailed Solution
Definiteness:
Each step must be precisely defined; the actions to be carried out must be rigorously and unambiguously specified for each case. input: An algorithm has zero or more inputs, taken from a specified set of objects. output: An algorithm has one or more outputs, which have a specified relation to the inputs.
Hence the correct answer is Definiteness.
Additional Information
Finiteness:
For any input, the algorithm must terminate after a finite number of steps. Definiteness: All steps of the algorithm must be precisely defined. Effectiveness: It must be possible to perform each step of the algorithm correctly and in a finite amount of time.
Effectiveness:
For an algorithm to be effective, it means that all those steps that are required to get to output must be feasible with the available resources. It should not contain any unnecessary and redundant steps which could make an algorithm ineffective.
input:
An algorithm has zero or more inputs, taken from a specified set of objects.
Output:
An algorithm has one or more outputs, which have a specified relation to the inputs.
Algorithm Design Techniques Question 3:
An algorithm that works to arrange data in ordered way :
Answer (Detailed Solution Below)
Algorithm Design Techniques Question 3 Detailed Solution
The correct answer is option 4: Sorting algorithm
Key Points
- A Sorting Algorithm is used to arrange data in a particular order (either ascending or descending).
- Common sorting algorithms include Bubble Sort, Merge Sort, Quick Sort, Insertion Sort, etc.
- Sorting helps in optimizing the performance of other algorithms like searching and merging.
Additional Information
- Searching algorithm: Used to find specific elements in data (e.g., linear search, binary search).
- Merging algorithm: Combines two or more sorted lists into one sorted list.
- Inverting algorithm: Not commonly used for sorting or ordering data; it's more related to reversing data or operations.
Hence, the correct answer is: option 4: Sorting algorithm
Algorithm Design Techniques Question 4:
To split a Linked list into smaller and smaller possible sub-problem and then solving individual sub problems to get final answer after joining individual results is :
Answer (Detailed Solution Below)
Algorithm Design Techniques Question 4 Detailed Solution
The correct answer is option 3: Divide and Conquer approach
Key Points
- Divide and Conquer is a problem-solving technique where:
- The problem is divided into smaller sub-problems.
- Each sub-problem is solved independently.
- The solutions to the sub-problems are then combined to solve the original problem.
- This approach is commonly used in:
- Merge Sort
- Quick Sort
- Binary Search
- Linked list manipulations like Merge Sort on Linked Lists
Additional Information
- Greedy Algorithms: Make locally optimal choices at each step without considering the overall problem.
- Dynamic Programming: Solves overlapping sub-problems and uses memoization to store intermediate results.
- Static Programming: Not a standard algorithmic paradigm.
Hence, the correct answer is: option 3: Divide and Conquer approach
Algorithm Design Techniques Question 5:
Match the following :
(a) |
Merge sort |
(i) |
Greedy approach |
(b) |
8 Queens problem |
(ii) |
Dynamic programming |
(c) |
Single source shortest path |
(iii) |
Divide and conquer |
(d) |
Optimal binary search tree |
(iv) |
Backtracking |
Answer (Detailed Solution Below)
Algorithm Design Techniques Question 5 Detailed Solution
Key Points
- Merge Sort uses the Divide and Conquer strategy. It divides the array into halves, recursively sorts them, and then merges the sorted halves.
- 8 Queens Problem is solved using Backtracking, which explores possible positions and backtracks upon invalid placements.
- Single Source Shortest Path (like Dijkstra’s algorithm) follows the Greedy Approach by selecting the shortest unvisited path at each step.
- Optimal Binary Search Tree uses Dynamic Programming to compute minimum expected search costs by evaluating all combinations of subtrees.
Additional Information
- Divide and Conquer: Breaks the problem into smaller sub-problems, solves them recursively, and combines their results. (Merge Sort)
- Backtracking: Systematically tries all possibilities and abandons paths that fail. (8 Queens)
- Greedy Approach: Makes optimal choices at each step to find global optimum. (Dijkstra’s algorithm)
- Dynamic Programming: Solves overlapping subproblems and builds solutions bottom-up. (Optimal BST)
Top Algorithm Design Techniques MCQ Objective Questions
A _________ is used to show the processing that takes place in the flowchart.
Answer (Detailed Solution Below)
Algorithm Design Techniques Question 6 Detailed Solution
Download Solution PDFConcept:
Flowcharts use special shapes to represent different types of actions or steps in a process. Lines and arrows show the sequence of the steps, and the relationships among them. These are known as flowchart symbols.
Hence Option 4 is correct
In flowchart representation, which of the following symbols indicates input/output?
Answer (Detailed Solution Below)
Algorithm Design Techniques Question 7 Detailed Solution
Download Solution PDFExplanation:
- An oval represents a start or end point
- A line is a connector that shows relationships between the representative shapes
- A parallelogram represents input and output
- A rectangle represents a process
- A diamond indicates a decision
The given symbol represents the predefined process such as a sub-routine or a module.
Design Element |
Shape |
Design Element |
Shape |
Design Element |
Shape |
Process |
|
Sequential data |
|
Parallel mode |
|
Terminator |
|
Direct data |
|
Loop limit |
|
Decision |
|
Manual input |
|
On-page reference |
|
Document |
|
Card |
|
Off-page reference |
|
Data (input and output) |
|
Paper tape |
|
Yes/No decision indicators |
|
Predefined process (such as subroutine or a module) |
|
Display |
|
Condition |
|
Stored data |
|
Manual operation |
|
Control transfer |
|
Internal storage |
|
Preparation |
|
Annotation |
|
A sorting technique is called stable if
Answer (Detailed Solution Below)
Algorithm Design Techniques Question 8 Detailed Solution
Download Solution PDF- A sorting algorithm is said to be stable if two objects with equal keys appear in the same order in sorted output as they appear in the input array to be sorted.
- This means a sorting algorithm is called stable if two identical elements do not change the order during the process of sorting.
- Some sorting algorithms are stable by nature like Insertion sort, Merge Sort, Bubble Sort, etc. and some sorting algorithms are not, like Heap Sort, Quick Sort, etc.
Explanation:
Which of the following property of an algorithm states that the algorithm must terminate after a certain number of steps?
Answer (Detailed Solution Below)
Algorithm Design Techniques Question 9 Detailed Solution
Download Solution PDF- An algorithm is a strictly defined finite sequence of well-defined statements (often called instruction or commands) that provide the solution to a problem or to a specific class of problems for an acceptable set of input values (if there are any inputs).
- An algorithm is a step by step procedure to solve a given problem.
- The term here “finite” means that the algorithm should reach an endpoint and cannot run forever.
- An algorithm must satisfy the following properties:
- Input: The algorithm must have input values from a specified set.
- Output: The algorithm must produce the output values from a specified set of input values.
The output values are the solution to a problem.
- Finiteness: For any input, the algorithm must terminate after certain/finite member of steps i.e. should be terminating and not infinite.
- Definiteness: All steps of the algorithm must be precisely defined.
- Effectiveness: It must be possible to perform each step of the algorithm correctly and in a finite amount of time. It is not enough that each step is definite (or precisely defined), but it must also be feasible.
An unordered list contains n distinct elements. The number of comparisons to find an element in this list that is neither maximum nor minimum is
Answer (Detailed Solution Below)
Algorithm Design Techniques Question 10 Detailed Solution
Download Solution PDFCode:
#include
int main() {
int ary[10] = {250,1,9,7,3,4,5,21,15,19};
/if we take any 3 elemement from n distinct element in an array one of them would be neither maximum nor minimum.
int a = ary[0];
int b = ary[1];
int c = ary[2];
if((b > a && a >c) || (c > a && a > b))
printf("%d",a);
else if((a > b && b >c) || (c > b && b >a))
printf("%d",b);
else
printf("%d",c);
}
Output: 9
9 is neither maximum nor minimum
Explanation:
Neither recursion nor iteration takes place in the above code, every statement in the above program takes a constant amount of time
and hence order is θ (1)
Note All elements are distinct, select any three numbers and output 2nd largest from them. If in the same question 'distinct' keyword is not given, we will have to get 3 distinct elements and this would take O(n) time in the worst case. From these 3 distinct elements the middle element is neither minimum nor maximum. In this case it is O(n). We hope clear your doubt.
Match the following with respect to algorithm paradigms:
|
List - I |
|
List - II |
(a) |
The 8-Queen’s problem |
(i) |
Dynamic programming |
(b) |
Single-Source shortest paths |
(ii) |
Divide and conquer |
(c) |
STRASSEN’s Matrix multiplication |
(iii) |
Greedy approach |
(d) |
Optimal binary search trees |
(iv) |
Backtracking |
Answer (Detailed Solution Below)
Algorithm Design Techniques Question 11 Detailed Solution
Download Solution PDF8 - queen’s problem:
- In this, 8 queens are placed on a 8 × 8 chessboard such that none of them can take same place.
- It is the backtracking approach. In backtracking approach, all the possible configurations are checked and check whether result is obtained or not.
- A queen can only be attacked if it is in the same row or column or diagonal of another queen.
Single source shortest path:
- It is used to find the shortest path starting from a source to the all other vertices.
- It is based on greedy approach.
- Example of single source shortest path algorithm is Dijkstra’s algorithm which initially consider all the distance to infinity and distance to source is 0.
Strassen’s matrix multiplication:
- It is a method used for matrix multiplication. It uses divide and conquer approach to multiply the matrices.
- Time consumption is improved by using Strassen’s method as compared to standard multiplication method.
- It is faster than standard method. Strassen’s multiplication can be performed only on square matrices.
Optimal binary search tree:
- It is also known as weight balanced binary tree. In optimal binary search tree, dummy key is added in the tree by first constructing a binary search tree.
- It is based on dynamic programming approach. Total cost must be as small as possible.
Which is not the characteristic of good algorithm ?
Answer (Detailed Solution Below)
Algorithm Design Techniques Question 12 Detailed Solution
Download Solution PDFConcept:
An algorithm is a set of instructions for solving a problem or carrying out a computation. An algorithm is a precise list of instructions that, when implemented in a software or hardware-based procedure, carry out the predetermined activities in a sequential fashion.
Explanation:
Characteristics of a good algorithm are:-
- The algorithm does not terminate after a fixed number of iterations.
- There is ambiguity present.
- The algorithm acquires the input but does not process it.
- The algorithm contains a logical flaw.
- The algorithm produces invalid results.
- The output is not displayed by the algorithm.
- The algorithm does not precisely outline the execution steps.
- The algorithm is not optimized for optimal performance.
Hence, option 4) is not characteristic of a good algorithm.
A text is made up of the characters A, B, C, D, E each occurring with the probability 0.08, 0.40, 0.25, 0.15 and 0.12 respectively. The optimal coding technique will have the average length of:
Answer (Detailed Solution Below)
Algorithm Design Techniques Question 13 Detailed Solution
Download Solution PDFConcept:
Optimal coding technique merge the probabilities one by one starting from the lower one.
Explanation:
Characters are: A, B, C, D and E with probabilities 0.08, 0.40, 0.25, 0.15, 0.12 respectively.
Step 1: Merge 0.08 (A) and 0.12, (E)
Step 2: Merge 0.20 with 0.15(D)
Step 3: Merge 0.35 and 0.25 (C)
Step 4: Merge 0.60 with 0.40 (B), then assign 0 to all left edges and 1 to all right edges.
Code for A (0.08) = 1110 (length 4)
Code for B (0.40) = 0 (length 1)
Code for C (0.25) = 10(length 2)
Code for D (0.15) = 110 (length 3)
Code for E (0.12) = 1111 (length 4)
Average code length = [(0.08 × 4) + (0.40 × 1) + (0.25 × 2) + (0.15 × 3) + (0.12 × 4)] / 1 = 0.32 + 0.40 + 0.50 + 0.45 + 0. 48 = 2.15
Four matrices M1, M2, M3 and M4 of dimensions p × q, q × r, r × s and s × t respectively can be multiplied in several ways with different number of total scalar multiplications. For example when multiplied as ((M1 × M2) × (M3 × M4)), the total number of scalar multiplications is part rst+ prt. When multiplied as ((M1 × M2) × (M3 )× M4), the total number of scalar multiplications is pqr+ prs + pst .
If p = 10, g = 100, r = 20, s = 5, and t = 80, then the minimum number of scalar multiplications needed is
Answer (Detailed Solution Below)
Algorithm Design Techniques Question 14 Detailed Solution
Download Solution PDFThe correct answer is option 3
Concept:
If we multiply two matrices [A]l × m and [B]m × n
Then the number of scalar multiplications required = l × m × n
Data:
Given 4 matrix are given with their dimensions
Matrix |
M1 |
M2 |
M3 |
M4 |
Dimension |
p× q |
q× r |
r× s |
s× t |
Dimension | 10×100 | 100×20 | 20×5 | 5×80 |
Calculation:
Total number of ways of multiplication =\(\frac{^{2n}C_n}{n+1}\)
n = 4 - 1 = 3
Total number of ways of multiplication =\(\frac{^{2n}C_n}{n+1}\) =5
There are 5 ways in which we can multiply these 4 matrices.
- (M1M2)(M3M4)
- M1 ((M2M3) M4)
- M1(M2(M3M4))
- ((M1M2)M3)M4
- (M1(M2M3))M4
(M10×100 × M100× 20 )(M20× 5 × M5× 80) | 10×100×20 +20× 5×80 +10×20×80 =44,000 |
M10×100 × ( (M100× 20 × M20× 5 )× M5× 80) | 10×100×80 +100×20×5 +100×5×80 =130,000 |
M10×100 × ( M100× 20 × (M20× 5 × M5× 80)) | 10×100×80 +100×20×80 +20×5×80 = 248,000 |
( (M10×100 × M100× 20 )× M20× 5 )× M5× 80 | 10×100×20 +10×20×5 +10×5×80 =25,000 |
( (M10×100 ×( M100× 20 × M20× 5 ))× M5× 80 | 10×100×5 +100×20×5 +10×5×80 =19,000 |
The minimum number of scalar multiplication can find out using (M1(M2M3))M4
(M1(M2M3))M4 =19,000
Shortcut Trick
Frist find scaler multiplication of those which are common in some of the 5 ways of multiplication
then it will become easy to solve
(M1M2) is common in 1 and 4
(M2M3) is common in 2 and 5
(M3M4) is common in 1 and 3
Which of the following is a correct time complexity to solve the 0/1 knapsack problem where n and w represents the number of items and capacity of knapsack respectively?
Answer (Detailed Solution Below)
Algorithm Design Techniques Question 15 Detailed Solution
Download Solution PDFKnapsack problem has the following two variants-
- Fractional Knapsack Problem
- 0/1 Knapsack Problem
Time Complexity-
- Each entry of the table requires constant time θ(1) for its computation.
- It takes θ(nw) time to fill (n+1)(w+1) entries. Therefore, O(nw + n + w +1) = O(nw )
- It takes θ(n) time for tracing the solution since the tracing process traces the n rows.
- Thus, overall θ(nw) time is taken to solve 0/1 knapsack problem using dynamic programming.