WorksheetsRepetition and Loops Quiz
Total questions: 55
Worksheet time: 43mins
What is the primary purpose of a loop in programming?
To execute a block of code repeatedly
To store data temporarily
To manage memory allocation
To create a user interface
Which of the following is NOT a type of loop?
For loop
While loop
Switch loop
Do...While loop
What does a counted loop require to function correctly?
A string variable
A user input
A random number generator
A counter variable
In a for loop, what does STEP 1 signify?
Resetting the counter
Decrementing the counter
Stopping the loop
Incrementing the counter
What is the output of the following loop:
For x = 0 TO 4 STEP 1
Display x
0 1 2 3 4
0 1 2 3 4 5
1 2 3 4 5
5 4 3 2 1
What is a sentinel value?
A value that indicates the end of a loop
A value that starts a loop
A random number
A string input
Which loop will execute at least once regardless of the condition?
Do While loop
While loop
Counted loop
For loop
What is the correct syntax for a decrementing for loop?
For x = 10 TO 0 STEP -1
For x = 5 TO 0 STEP 1
For x = 0 TO 10 STEP 1
For x = 1 TO 5 STEP 2
In a while loop, when does the loop stop executing?
When the condition becomes false
When the condition is true
After a fixed number of iterations
When the loop is manually stopped
What will happen if the condition in a while loop is always true?
The program will crash
An infinite loop occurs
The loop will execute once
The loop will not execute
What is the output of the following code:
For x = 1 TO 5 STEP 1
Display x
5 4 3 2 1
1 2 3 4 5 6
0 1 2 3 4 5
1 2 3 4 5
Which of the following is a characteristic of a decrementing loop?
It requires a user input
It cannot be nested
It counts downwards
It counts upwards
What is the purpose of the 'EndFor' statement?
To indicate the end of a for loop
To stop the program
To declare a variable
To initialize a loop
In the context of loops, what does 'iteration' refer to?
The condition of the loop
The total number of loops
A single execution of the loop
The initialization of the loop
What will the following code output:
FOR x= 1 TO 3 STEP 1
Display 'Hello'
No output
Hello
Hello Hello
Hello Hello Hello
What is the main difference between a counted loop and a sentinel loop?
Counted loops have a fixed number of iterations
Sentinel loops do not require a counter
Counted loops can only count up
Sentinel loops are faster
What is the output of the following code: For x = 5 TO 0 STEP -1 Display x?
5 4 3 2 1 0 0
5 4 3 2 1
0 1 2 3 4 5
5 4 3 2 1 0
Which of the following statements is true about nested loops?
A loop inside another loop
Only one loop can exist in a program
Nested loops cannot be counted
They are less efficient than single loops
What is the purpose of the 'Display' command in a loop?
To output data to the screen
To initialize a variable
To stop the loop
To create a new loop
What will happen if you forget to update the counter in a loop?
It may create an infinite loop
The loop will run faster
The loop will execute only once
The program will terminate
What is an algorithm?
A programming language
A sequence of steps to solve a problem
A type of flowchart
A software tool
Which of the following is NOT a characteristic of an algorithm?
It must have a defined input
It must produce at least one output
It must be infinite in execution
It must be unambiguous
What is the primary purpose of a flowchart?
To write a program in a specific programming language
To depict the logical steps of an algorithm graphically
To replace algorithms completely
To execute a program
Which symbol represents a decision-making step in a flowchart?
Rectangle
Parallelogram
Diamond
Oval
What does a parallelogram symbol represent in a flowchart?
Process
Input/Output
Decision
Connector
In a flowchart, what do arrows indicate?
Start or End of the program
Decision-making steps
The flow of logic
Input and Output operations
What does a rectangle symbolize in a flowchart?
Input or Output
Processing (arithmetic or data manipulation)
Decision-making
Start or Stop
What is the general direction of flow in a flowchart?
Left to Right
Right to Left
Top to Bottom
Bottom to Top
Which of the following is NOT an advantage of using an algorithm?
It is dependent on a specific programming language
It provides a step-wise representation of a solution
It is easy to debug
It follows a definite procedure
What is the purpose of a connector in a flowchart?
To indicate the beginning or end of a process
To connect different parts of a flowchart without intersecting lines
To perform calculations
To represent input and output operations
Why should you use a flowchart before writing a program?
Because drawing is more fun than coding
Because debugging a bad program is like finding a needle in a haystack
Because computers refuse to run programs without flowcharts
Because flowcharts can double as modern art
What happens if you don’t follow a flowchart properly?
The program might develop self-awareness and rebel
You might create a loop that traps you in an infinite debugging cycle
Nothing, it’s just a suggestion... right?
Your computer will burst into flames
Why is the decision symbol in a flowchart a diamond?
Because making decisions is as hard as finding a real diamond
Because round symbols rolled off the paper
Because decisions are expensive like diamonds
Because rectangles were already taken
What should you do if your flowchart keeps looping infinitely?
Call it a "feature" and market it as artificial intelligence
Blame the computer and restart it
Add a stop condition before your brain overheats
Give up and become a professional artist instead
What is the main advantage of a flowchart over written instructions?
It makes you look super professional when explaining things
It lets you use cool shapes instead of boring words
It makes it easier to see where you totally messed up
All of the above
Draw a flowchart that calculates the area of a rectangle.
Instructions:
Your flowchart should take input for the length and width.
It should multiply these values to get the area.
Finally, it should display the result.

Create a flowchart that determines if a number is even or odd.
Instructions:
The program should ask for a number.
If the number is divisible by 2, print "Even."
Otherwise, print "Odd."
OR
Draw a horse.

Draw a celebrity
(extra points if we can guess who it is)

What is the best anime/series/movie and why?
How much wood would a woodchuck chuck if a woodchuck could chuck wood?
Which of the following is NOT a basic control structure in programming?
Sequence
Selection
Repetition
Compilation
A logical error occurs when:
The program has syntax errors
The program crashes upon execution
The program runs but produces incorrect results
The program runs infinitely
Which of the following operators is used for comparing two values in pseudocode?
=
==
!=
Both == and !=
In a sequence control structure, statements are executed:
Based on user input
One after the other, in order
Only if a condition is met
Repeatedly until a condition is false
Given the following pseudocode:
Start
num = -5
If num > 0
Display "Positive"
Else
Display "Negative"
EndIf
End
What will be displayed?
Positive
Negative
No output
Error due to syntax
A CASE statement is best used when:
You need to test multiple values for a variable
You want to loop through a set of instructions
You need to choose between only two options
You are performing arithmetic calculations
How many times will the following loop execute?
Start
x = 1
While (x <= 5)
Display x
x = x + 1
EndWhile
End
4 times
5 times
6 times
Infinite times
What will happen if the loop condition is incorrectly set, such as While (x > 0) without decrementing x inside the loop?
The loop will run indefinitely
The loop will execute only once
The loop will not execute at all
The program will produce an error
Start
For i = 1 to 3
For j = 1 to 2
Display "*"
EndFor
EndFor
End
How many times will the * be displayed?
3
5
6
9
Start
num = 10
While (num > 0)
Display num
num = num - 2
EndWhile
End
What will be the last number displayed?
0
2
1
-1
Start
total = 0
For i = 1 to 3
total = total + i
EndFor
Display total
End
What will the output be?
3
6
9
10
Start
pin = 0
While pin != 1234
Display "Enter PIN"
pin = get value
EndWhile
Display "Correct PIN entered"
End
What will the result be if we run this program?
It will terminate once the correct PIN (1234) is entered
It will run indefinitely
It will never execute the loop
It will display "Correct PIN entered" without user input
A WHILE loop is preferable over a FOR loop when:
The number of iterations is known in advance
The loop should execute at least once
The number of iterations is unknown and depends on a condition
You are iterating over a fixed range of numbers
Give me your best pickup line
What will be the output of the following nested condition?
num = 15
If (num > 10)
If (num < 20)
Display "Within Range"
Else
Display "Out of Range"
EndIf
Else
Display "Out of Range"
EndIf
Within Range
Out of Range
Error in logic
Nothing is displayed
