Search Header Logo
The Loop Structure

The Loop Structure

Assessment

Presentation

Computers

11th Grade

Practice Problem

Medium

Created by

Leori Ignacio

Used 224+ times

FREE Resource

15 Slides • 9 Questions

1

The Loop Structure

media

2

Multiple Choice

An integer recognizes decimal numbers.

1

True

2

False

3

Multiple Choice

Which of the following is the correct way of writing a formula in C++?

1

sum = a + b

2

sum = a + b;

3

a + b = sum

4

Multiple Choice

Which of the following is the correct way of declaring an integer in C++?

1

int a;

2

Dim as Int

3

Dim as Integer

5

Multiple Choice

A loop statement is also known as an iterative statement.

1

True

2

False

6

Multiple Choice

It is the keyword that carries a conditional statement.

1

If

2

Then

3

Else

4

End If

7

LOOPING STATEMENTS

  • It is also known as ITERATIVE STATEMENTS.

  • ITERATION is the process where a set of instructions or statements is executed repeatedly until a condition is met.

  • Iterative statements also alter the control flow of the program and can be classified as control statements.

8

LOOPING STATEMENTS

  • A loop basically consists of three parts:

    • Initialization

    • Condition

    • Modification

9

PARTS OF ​LOOPING STATEMENTS

INITIALIZATION​ - it is an assignment statement that is used to set a loop control

CONDITION - the relational expression that determines when the loop will end by testing the loop control variable against some value.

MODIFICATION - it defines the loop control variable that will change each time the loop is repeated.​

10

Multiple Choice

It is a loop structure wherein the initialization, condition and modification are written in a single statement

1

For Loop

2

Do-While

3

While

11

FOR LOOP

Syntax:

for (initialization; condition; modification)

{execution statements}

​​

12

FOR LOOP

media

13

FOR LOOP

  • FOR LOOP is a repetition control structure that allows you to efficiently write a loop that needs to execute a specific number of times.

  • It is the most commonly used looping technique. The reason, why it is so popular, is because it has all three parts of the loop: initialization, condition, and modification in the same line.

14

Multiple Choice

It is a loop structure that continues the execution of the loop if the condition is true, and the initialization is written at the declaration area.

1

For

2

While

3

Do-While

15

while LOOP

Syntax:

initialization​

while (condition)

{execution statements}

16

while LOOP

media

17

while LOOP

  • A control structure that allows you to repeat a task a certain number of times.

  • A while loop will continue its execution of the loop if the condition is TRUE but will stop if the condition is already false.

18

Multiple Choice

It is a loop structure in which the condition is written at the end of the loop statement.

1

For

2

While

3

Do-While

19

Multiple Choice

It is a loop structure in which the execution is guaranteed to perform at least one time.

1

Do Loop While

2

For While

3

Do-While Loop

20

do-while LOOP

Syntax:

initialization​

do

{execution statements}

while (condition)

21

do-while LOOP

media

22

do-while LOOP

  • do-while is similar to while except that it is guaranteed to execute at least one time.

  • The conditional expression appears at the end of the loop, so the statement(s) in the loop executes once before the condition is tested.

23

C++ NESTED LOOP

  • A loop can be nested inside another loop. C++ allowsat least 256 levels of nesting.

24

JUMP STATEMENTS

Unconditionally transfer program control within a function.

​goto statement – allows jumping to another point in the program.

​break statement – when executed in a switch structure,provides an immediate exit from the switch structure.

continue statement – used in loops and causes a program toskip the rest of the body of the loop.​

The Loop Structure

media

Show answer

Auto Play

Slide 1 / 24

SLIDE