What is a nested loop?
A
A loop inside another loop
B
Two separate loops
C
A loop that never runs
D
A decision only
Explanation:
Hello superstar! A nested loop is when one loop is placed inside another. This is very useful for grids and patterns. You are doing wonderfully!
Next Question →
To draw a 3x3 grid of stars, you can use:
A
Outer loop for rows, inner loop for columns
B
One loop only
C
No loops
D
Random stars
Explanation:
Nested loops are perfect for 2D patterns like grids.
Next Question →
What does an IF statement do?
A
Makes a decision based on a condition
B
Repeats forever
C
Stores a number
D
Draws a picture
Explanation:
Conditionals (IF) allow the program to choose different actions.
Next Question →
REPEAT 3 TIMES: REPEAT 4 TIMES: print '*' . How many stars printed?
A
12
B
7
C
3
D
4
Explanation:
Outer loop 3 times, inner loop 4 times = 12 stars.
Next Question →
IF score > 50 THEN 'Pass' ELSE 'Try again'. This is an example of:
A
Conditional statement
B
Loop
C
Variable
D
Sequence only
Explanation:
IF-THEN-ELSE makes decisions.
Next Question →
A nested loop is useful for:
A
Creating tables or grids
B
Repeating one action
C
Making simple decisions
D
Storing one number
Explanation:
Perfect for 2D repeating tasks.
Next Question →
In coding, ELSE is used with:
A
IF statement
B
Loops only
C
Variables
D
Print command
Explanation:
ELSE gives the alternative action when IF is false.
Next Question →
Outer loop runs 2 times, inner loop runs 5 times. Total executions of inner code?
A
10
B
7
C
2
D
5
Next Question →
IF temperature > 30 THEN 'Wear shorts' is a:
A
Conditional
B
Loop
C
Sequence
D
Variable
Explanation:
It checks a condition and chooses action.
Next Question →
To print a triangle of stars with nested loops, the outer loop controls:
A
Number of rows
B
Number of columns only
C
Only stars
D
Nothing
Explanation:
Outer usually controls rows.
See My Score 🏆