Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

KS3 Computing -- Iteration: FOR or WHILE?

Total questions: 10

Worksheet time: 6mins

Name
Class
Date
1.

Leo wants to write a program that will print out any times-table (up to 10 places) at the users request. Should he use:

a)

A FOR loop

b)

A WHILE loop

2.

Leah is writing a program that will ask the user to enter 10 numbers, and will then print the total. Should she use:

a)

A FOR loop

b)

A WHILE loop

3.

Maryam is writing a multi-choice quiz program. She wants to make sure that the user can only enter A, B or C for each question and that any other answer is rejected until an acceptable response is entered. She knows she will need a loop, but which one?

a)

a FOR loop

b)

a WHILE loop

4.

Aran has written an average program (shown here) Which of the following statements about his program are accurate? (select as many as appropriate)

a)

The program will not work & contains syntax errors

b)

The program is inefficient

c)

The program could be improved with the use of a WHILE loop

d)

The program could be improved with the use of a FOR loop

e)

The program is efficient

5.

Zoe is writing a program that will join letters together to form a single word. The user can enter as many letters as they want until the user quits by entering a * character. The program contains some errors. Are the errors in lines..

a)

2,3,6,9 ?

b)

3,6,7,8 ?

c)

2,4,6,8 ?

d)

3,6,7,9 ?

6.

A FOR loop is...

a)

A COUNT controlled loop

b)

A CONDITION controlled loop

7.

A WHILE loop is...

a)

A COUNT controlled loop

b)

A CONDITION controlled loop

8.

TRUE or FALSE - a computer program MUST contain ITERATION (i.e. a loop)

a)

TRUE

b)

FALSE

9.

In a CONDITION CONTROLLED loop, the code inside the loop will run until a particular "condition" has been met. Which of the following are possible examples of "conditions" that could be used in such a loop? (select as many as appropriate)

a)

number1 < number2

b)

answer == "True"

c)

Choice == "Y" or Choice == "N"

10.

Jaz is writing a program to count 60 seconds, printing the current time passed after each second. He will need to use a loop - should he use..

a)

a FOR loop?

b)

a WHILE loop?