Question Detail

COS 102 6 lecture note; fundamentals of programming Objective Question

Question

What is the purpose of an iteration statement (loop) in programming?
Options
A To execute instructions once and then stop.
B To define new functions or subroutines.
C To execute a block of code repeatedly until a certain condition is met or fulfilled.
Correct Answer
D To select a specific block of code to execute based on a condition.
Correct Answer

Option C is the correct answer.

Detailed Explanation

Page 58 states: 'Loops can execute a block of code number of times until a certain condition is met.' and 'The iteration statement allows instructions to be executed until a certain condition is to be fulfilled.'

Hint

The term 'iteration' itself implies repetition.

Question Info