IGCSE Computer Science Paper-1: Specimen Questions with Answers 54 - 54 of 164

Question 54

Edit

Appeared in Year: 2013

Describe in Detail

Essay▾

What are the different types of loop structure used in a typical programming language?

Explanation

  • A loop in programming is the combination of two parts, a body of a loop and a control statement.
  • A loop is mainly classified into two types Entry Controlled Loop and Exit Controlled Loop.
  • Entry controlled loop: A condition is checked before executing the body of a loop and is also called as a pre-checking loop.
  • Exit controlled loop: A condition is checked after executing the body of a loop and is also called as a post-checking loop.

Three types of loop constructs are provided by ‘C’ Programming language:

The while loop: In while loop, a condition is evaluated before processing a body of the loop. The body of a loop is executed if and only if the condition is true.

Format of while Loop

While (condition) {

Statements;

}

Do-While loop: . Here the condition is always executed after the body of the loop and therefore it is also known as an exit-controlled loopHere the body of the loop can be executed even if the condition is false.

Format of Do-While Loop

do {

Statements

} while (expression);

For loop: In this loop the initial value is performed only once. The condition is a Boolean expression. The loop stops when false is returned.

Example

For

Statements;

}

Choose Paper