NEW
Font size
WorksheetsProgramming Foundations Practice Quiz
Total questions: 20
Worksheet time: 10mins
What is the purpose of a variable in programming?
To delete files
To repeat a loop
To store data values
To power the computer
Which of these is a correct variable name in most programming languages?
2total
@name
firstName
total-amount
What data type would you use to store a person’s age?
String
Integer
Boolean
List
What value does a Boolean variable hold?
Numbers
Text
True or False
Multiple values
What does the equal sign (=) mean in programming?
Compare values
Multiply numbers
Assign a value
Show subtraction
What is a string in programming?
A group of numbers
A group of words or characters
A type of loop
A software function
What is the output of this code: print("5" + "3")
8
53
Error
5 + 3
What is a control structure in programming?
A tool to change brightness
A way to fix code
Code that controls the flow of a program
A button
Which keyword is used for a conditional statement in many programming languages?
if
do
stop
wait
What is the purpose of an "if" statement?
To show an image
To repeat a process
To make decisions in code
To end the program
What will this code print? x = 10 if x > 5: print("High")
High
Low
Error
5
What is a loop in programming?
A way to end the code
A mistake in code
Code that runs one time
Code that repeats
What is a common type of loop?
if loop
wait loop
for loop
math loop
How many times will this loop run? for i in range(3): print(i)
1
3
2
0
What is a function in programming?
A button
A block of code that performs a task
A print command
A game feature
What is the main benefit of using functions in programming?
Makes the computer faster
Helps find bugs
Allows code to be reused
Saves memory
Which keyword is used to define a function in Python?
make
new
def
create
What is a parameter in a function?
A button
A type of data
A name of a file
A value you pass into a function
What does this code return? def add(a, b): return a + b print(add(2, 3))
add
5
a + b
2, 3
What is modular programming?
A game design skill
Writing code in one long file
Breaking code into small parts or modules
Making websites
