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?

  1. A.Input
  2. B.Definiteness
  3. C.FinitenessCorrect answer
  4. 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

All of Introduction to Problem Solving

Practise more Computer Science

Sign up free for adaptive practice on this chapter, with instant feedback and hints on every question.

Start practising free

Free to start · No credit card needed