Algorithms MCQ Questions And Answers
This section focuses on "Algorithms" in Data Structures. These Multiple Choice Questions (MCQ) should be practiced to improve the Data Structure skills required for various interviews (campus interviews, walk-in interviews, company interviews), placements, entrance exams and other competitive examinations.
1. ___________ is a step-by-step procedure, which defines a set of instructions to be executed in a certain order to get the desired output.
A. Code
B. Algorithm
C. Program
D. All of the above
View Answer
Ans : B
Explanation: Algorithm is a step-by-step procedure, which defines a set of instructions to be executed in a certain order to get the desired output.
2. Which of the following are characteristics of an algorithm?
A. Algorithm should be clear
B. Algorithm should be unambiguous
C. Algorithms must terminate after a finite number of steps
D. All of the above
View Answer
Ans : D
Explanation: All of the above are Characteristics of an Algorithm
3. Not all procedures can be called an algorithm
A. TRUE
B. FALSE
C. Can be true or false
D. Can not say
View Answer
Ans : A
Explanation: True, Not all procedures can be called an algorithm.
4. An algorithm should have _______ well-defined inputs.
A. 0
B. 1
C. 0 or more
D. 1 or more
View Answer
Ans : C
Explanation: An algorithm should have 0 or more well-defined inputs.
5. An algorithm should have __________ well-defined outputs
A. 0
B. 1
C. 0 or more
D. 1 or more
View Answer
Ans : D
Explanation: An algorithm should have 1 or more well-defined outputs, and should match the desired output.
6. Which of the following is a theoretical analysis of an algorithm?
A. Posterior Analysis
B. Priori Analysis
C. Simple Analysis
D. Preori Analysis
View Answer
Ans : B
Explanation: A Priori Analysis : This is a theoretical analysis of an algorithm. Efficiency of an algorithm is measured by assuming that all other factors, for example, processor speed, are constant and have no effect on the implementation.
7. _________ is measured by counting the number of key operations such as comparisons in the sorting algorithm.
A. Space
B. Lines
C. Time
D. None of the above
View Answer
Ans : C
Explanation: Time is measured by counting the number of key operations such as comparisons in the sorting algorithm.
8. The complexity of an algorithm f(n) gives the running time and/or the storage space required by the algorithm in terms of n as the size of input data.
A. Yes
B. No
C. Can be yes or no
D. Can not say
View Answer
Ans : A
Explanation: Yes, The complexity of an algorithm f(n) gives the running time and/or the storage space required by the algorithm in terms of n as the size of input data.
9. The space required by an algorithm is equal to the sum of ________ components.
A. 1
B. 2
C. 3
D. 4
View Answer
Ans : B
Explanation: The space required by an algorithm is equal to the sum of the following two components : fixed part and variable part.
10. Space complexity S(P) of any algorithm P is S(P) = C + SP(I), where C is the?
A. fixed part
B. variable part
C. space complexity
D. None of the above
View Answer
Ans : A
Explanation: Space complexity S(P) of any algorithm P is S(P) = C + SP(I), where C is the fixed part and S(I) is the variable part of the algorithm, which depends on instance characteristic I.
Discussion