Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

LOOPS IN C++

Total questions: 10

Worksheet time: 20mins

Name
Class
Date
1.

How many loops are there in C++

a)

2

b)

3

c)

4

d)

1

2.

What is currect syntax of for loop?

a)

for(initialization;condition; increment/decrement)

b)

for(increment/decrement; initialization; condition)

c)

for(initialization, condition, increment/decrement

d)

None of These

3.

Can a for loop contain another for loop?

a)

No

b)

Yes

c)

Compilation Error

d)

Runtime Error

4.

Each pass through a loop is called a/an

a)

pass through

b)

enumeration

c)

iteration

d)

culmination

5.

Which looping process checks the test condition at the end of the loop?

a)

for

b)

while

c)

do-while

d)

no looping process checks the test condition at the end

6.

In a group of nested loops, which loop is executed the most number of times?

a)

the outermost loop

b)

the innermost loop

c)

all loops are executed the same number of times

d)

cannot be determined without knowing the size of the loops

7.

The statement i++; is equivalent to

a)

i = i + i;

b)

i = i + 1;

c)

i = i - 1;

d)

i --;

8.

Which looping process is best used when the number of iterations is known?

a)

for

b)

while

c)

do-while

d)

all looping processes require that the iterations be known

9.

What's wrong? for (int k = 2, k <=12, k++)

a)

the increment should always be ++k

b)

the variable must always be the letter i when using a for loop

c)

there should be a semicolon at the end of the statement

d)

the commas should be semicolons

10.

If there is more than one statement in the block of a for loop, which of the following must be placed at the beginning and the ending of the loop block?

a)

parentheses ( )

b)

braces { }

c)

brackets [ ]

d)

arrows < >