wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Do-While Loop Quiz

Total questions: 13

Worksheet time: 7mins

Name
Class
Date
1.

What is required at the end of the do-while loop condition?

a)

A colon (:)

b)

A comma (,)

c)

A semicolon (;)

d)

A period (.)

2.

In a do-while loop, when is the condition checked?

a)

Before the loop starts

b)

After the loop has executed once

c)

At the beginning of each iteration

d)

It is not checked

3.

Which of the following is true about the do-while loop?

a)

It may never execute the loop body

b)

It always executes the loop body at least once

c)

It executes the loop body only if the condition is true initially

d)

It executes the loop body indefinitely

4.

In the flowchart of a do-while loop, what happens if the condition is false?

a)

The loop continues

b)

The loop terminates

c)

The loop restarts

d)

The loop skips an iteration

5.

What must follow the condition in a do-while loop?

a)

A colon :

b)

A comma ,

c)

A semicolon ;

d)

A period .

6.

Which of the following is true about the do-while loop?

a)

It never executes the loop body

b)

It executes the loop body only if the condition is false

c)

It executes the loop body at least once

d)

It executes the loop body only if the condition is true

7.

Which symbol is used to denote the end of the condition in a do-while loop?

a)

:

b)

;

c)

,

d)

.

8.

What is the purpose of the program in the provided code?

a)

To calculate the sum of three numbers

b)

To find the maximum of three scores

c)

To average three test scores

d)

To sort three numbers

9.

Which loop structure is used in the program?

a)

For loop

b)

While loop

c)

Do-while loop

d)

Infinite loop

10.

What is the purpose of using a do-while loop in a menu-driven program?

a)

To exit the program immediately

b)

To bring the user back to the menu to make another choice

c)

To process user input without any conditions

d)

To simplify the code structure

11.

What is the main difference between a while loop and a do-while loop?

a)

A while loop checks the condition after executing the loop body

b)

A do-while loop checks the condition before executing the loop body

c)

A while loop checks the condition before executing the loop body

d)

A do-while loop never checks the condition

12.

In a do-while loop, what happens if the condition is true?

a)

The loop terminates immediately

b)

The loop executes the body once and then terminates

c)

The loop continues to execute the body

d)

The loop skips the current iteration

13.

Which of the following scenarios is best suited for using a do-while loop?

a)

When the loop body should execute only if a condition is true

b)

When the loop body should execute at least once regardless of the condition

c)

When the loop body should never execute

d)

When the loop body should execute indefinitely