Question 1 of 10
count starts at 0. How many times does DISPLAY run?
REPEAT 4 TIMES
{
count ← count + 1
DISPLAY (count)
}
- A. 4
- B. 5
- C. 0
- D. 3
count starts at 0. How many times does DISPLAY run?
REPEAT 4 TIMES
{
count ← count + 1
DISPLAY (count)
}
n starts at 1. What is displayed when the loop finishes?
n ← 1
REPEAT UNTIL (n > 3)
{
DISPLAY (n)
n ← n + 1
}
k starts at 5. How many times does the body execute?
k ← 5
REPEAT UNTIL (k >= 5)
{
k ← k + 1
}
total starts at 0. What value is displayed?
total ← 0
REPEAT 3 TIMES
{
total ← total + 2
}
DISPLAY (total)
c starts at 0. Which statement is correct?
c ← 0
REPEAT UNTIL (c = 3)
{
c ← c + 1
DISPLAY (c)
}
How many robot steps forward occur?
REPEAT 5 TIMES
{
MOVE_FORWARD
}
x starts at 2. What is the final value of x?
x ← 2
REPEAT UNTIL (x >= 10)
{
x ← x * 2
}
t starts at 1. Loop: REPEAT UNTIL (t > 4) { t ← t + 1 }. Sequence of t values right after each body run until stop?
| Check | Body? |
|---|---|
| t > 4? | runs if false |
sum starts at 0 and i starts at 1. What is displayed?
sum ← 0
i ← 1
REPEAT UNTIL (i > 4)
{
sum ← sum + i
i ← i + 1
}
DISPLAY (sum)
Which loop is guaranteed to run its body exactly 7 times?