WorksheetsKS3 Computing -- Iteration: FOR or WHILE?
Total questions: 10
Worksheet time: 6mins
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 FOR loop
A WHILE loop
Leah is writing a program that will ask the user to enter 10 numbers, and will then print the total. Should she use:
A FOR loop
A WHILE loop
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 FOR loop
a WHILE loop
Aran has written an average program (shown here) Which of the following statements about his program are accurate? (select as many as appropriate)
The program will not work & contains syntax errors
The program is inefficient
The program could be improved with the use of a WHILE loop
The program could be improved with the use of a FOR loop
The program is efficient
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..
2,3,6,9 ?
3,6,7,8 ?
2,4,6,8 ?
3,6,7,9 ?
A FOR loop is...
A COUNT controlled loop
A CONDITION controlled loop
A WHILE loop is...
A COUNT controlled loop
A CONDITION controlled loop
TRUE or FALSE - a computer program MUST contain ITERATION (i.e. a loop)
TRUE
FALSE
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)
number1 < number2
answer == "True"
Choice == "Y" or Choice == "N"
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 FOR loop?
a WHILE loop?
