No student devices needed. Know more
15 questions
In programming, what is iteration?
The repetition of steps within a program
The order in which instructions are carried out
A decision point in a program
Why is iteration important?
It determines the order in which instructions are carried out
It allows code to be simplified by removing duplicated steps
It allows multiple paths through a program
What is iteration known as?
Looping
Crashing
Repeating
Which two statements are used to implement iteration?
IF..ELSE and WHILE
DO and WHILE
FOR and WHILE
In programming, what is a statement?
A statement is a block of code
A statement is a repeated instruction
A statement is a single instruction
Which type of loop iterates until instructed otherwise?
A condition-controlled loop
A count-controlled loop
A repeat-once loop
Look at the following code and identify the variables.
x=0
while x<4:
x=x+1
print ('x is ',+ x)
2 variables
1 variable
4 variables
3 variables
How many times will the variable loop?
for i in range (1,11):
i= i+i
print(i)
9
11
10
8
The following loop displays:
for i in range (1,11):
i= i+i
print(i)
18
20
10
19
I want to print "Password matched" if the user enters the correct password, otherwise allow them to try again. What is wrong with the code above?
The last line should be outside the loop
A For loop needed to be used
What is the advantage of using a while loop versus a for loop?
You can repeat the code continuously
There is a pre-defined number of repetitions
What is a Count-Controlled loop?
for loop
while loop
A count controlled loop will..
Repeat code until a condition is met
Repeat code a specific amount of times
Repeat code a random amount of times
None of the above
A condition controlled loop is...
A while loop
A for loop
Explore all questions with a free account