wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Programming Foundations Practice Quiz

Total questions: 20

Worksheet time: 10mins

Name
Class
Date
1.

What is the purpose of a variable in programming?

a)

To delete files

b)

To repeat a loop

c)

To store data values

d)

To power the computer

2.

Which of these is a correct variable name in most programming languages?

a)

2total

b)

@name

c)

firstName

d)

total-amount

3.

What data type would you use to store a person’s age?

a)

String

b)

Integer

c)

Boolean

d)

List

4.

What value does a Boolean variable hold?

a)

Numbers

b)

Text

c)

True or False

d)

Multiple values

5.

What does the equal sign (=) mean in programming?

a)

Compare values

b)

Multiply numbers

c)

Assign a value

d)

Show subtraction

6.

What is a string in programming?

a)

A group of numbers

b)

A group of words or characters

c)

A type of loop

d)

A software function

7.

What is the output of this code: print("5" + "3")

a)

8

b)

53

c)

Error

d)

5 + 3

8.

What is a control structure in programming?

a)

A tool to change brightness

b)

A way to fix code

c)

Code that controls the flow of a program

d)

A button

9.

Which keyword is used for a conditional statement in many programming languages?

a)

if

b)

do

c)

stop

d)

wait

10.

What is the purpose of an "if" statement?

a)

To show an image

b)

To repeat a process

c)

To make decisions in code

d)

To end the program

11.

What will this code print? x = 10 if x > 5: print("High")

a)

High

b)

Low

c)

Error

d)

5

12.

What is a loop in programming?

a)

A way to end the code

b)

A mistake in code

c)

Code that runs one time

d)

Code that repeats

13.

What is a common type of loop?

a)

if loop

b)

wait loop

c)

for loop

d)

math loop

14.

How many times will this loop run? for i in range(3): print(i)

a)

1

b)

3

c)

2

d)

0

15.

What is a function in programming?

a)

A button

b)

A block of code that performs a task

c)

A print command

d)

A game feature

16.

What is the main benefit of using functions in programming?

a)

Makes the computer faster

b)

Helps find bugs

c)

Allows code to be reused

d)

Saves memory

17.

Which keyword is used to define a function in Python?

a)

make

b)

new

c)

def

d)

create

18.

What is a parameter in a function?

a)

A button

b)

A type of data

c)

A name of a file

d)

A value you pass into a function

19.

What does this code return? def add(a, b): return a + b print(add(2, 3))

a)

add

b)

5

c)

a + b

d)

2, 3

20.

What is modular programming?

a)

A game design skill

b)

Writing code in one long file

c)

Breaking code into small parts or modules

d)

Making websites