Introduction to Problem Solving · Class 11 · CBSE · Science Computer Science
Consider the following pseudocode: set n to 5; while n > 0, display n. Which essential property of an algorithm is not satisfied?
Practice question from Introduction to Problem Solving (Class 11 · CBSE · Science Computer Science), with the correct answer and a step-by-step solution.
hard · MCQ · Q-640FE5
Consider the following pseudocode: set n to 5; while n > 0, display n. Which essential property of an algorithm is not satisfied?
- A.Input
- B.Definiteness
- C.FinitenessCorrect answer
- D.Effectiveness
Solution
The value of n never changes, so the condition n > 0 remains true forever. Therefore, the pseudocode does not terminate and violates the finiteness property of an algorithm.
More from Introduction to Problem Solving
- Which sequence best represents the main stages of solving a programming problem?
- Explain how problem decomposition helps in solving a programming problem. Use the task of preparing a student's result as an example and me…
- Which statement correctly describes an algorithm?
- Consider the following pseudocode for finding the largest of three numbers: read a, b, c; largest = a; if b > largest then largest = b; if…
Practise more Computer Science
Sign up free for adaptive practice on this chapter, with instant feedback and hints on every question.
Start practising freeFree to start · No credit card needed