KnowledgeBoat Logo
|

Informatics Practices

Assertion (A): The for loop is described as finite loop and while loop is described as unknown or indefinite iterative construct.

Reasoning (R): You cannot use while loop for menu-driven programs.

  1. Both A and R are true and R is the correct explanation of A.
  2. Both A and R are true but R is not the correct explanation of A.
  3. A is true but R is false.
  4. A is false but R is true.

Python Control Flow

4 Likes

Answer

A is true but R is false.

Explanation
The for loop is described as a finite loop because it iterates over a sequence of elements with a known length. The while loop is described as an indefinite iterative construct because it continues to execute as long as a condition is true, without a predetermined number of iterations. We can use a while loop for menu-driven programs to repeatedly display a menu and process user input until a certain condition is met.

Answered By

1 Like


Related Questions