NEW
Font size
Worksheetswhile loop
Total questions: 10
Worksheet time: 5mins
What is the purpose of a while loop?
To execute a block of code based on a random condition
To repeatedly execute a block of code as long as a specified condition is true.
To execute a block of code only once
To skip over a block of code
Which loop do we use when we have to repeat a code unknown number of times?
Repeat loop
For loop
Forever loop
While loop
What is the role of a counter variable in a loop?
It is used to keep track of the number of iterations or the current position within the loop.
It is used to skip iterations in the loop
It is used to store the final result of the loop
It is used to define the loop condition
What value is assigned to the index variable when button A is pressed?
0
1
4
5
What is plotted on the LED grid during the loop?
The x-coordinate only.
The y-coordinate only.
Both x and y coordinates using the index value.
Random coordinates.
How many LEDs will be lit when button A is pressed?
2 LEDs
4 LEDs
5 LEDs
6 LEDs
Which coordinate pattern is displayed on the LED grid as the code runs?
A diagonal line from the top-left to the bottom-right.
A vertical line.
A horizontal line.
A square pattern.
Which type of numbers will be displayed by this code?
Odd numbers only.
Even numbers only
Both even and odd numbers.
Multiples of 10 only.
What is the highest value that will be displayed by this code if count is set to 10?
10
19
18
20
Which type of numbers will be displayed by this code?
Odd numbers only.
Even numbers only
Both even and odd numbers.
Multiples of 10 only.
