wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

2.3 Programming Data Review

Total questions: 16

Worksheet time: 9mins

Name
Class
Date
1.

Which of the following is the BEST example of a variable name?

a)

a1

b)

x

c)

high_score

d)

123score

2.

What is the main purpose of a variable in programming?

a)

To store data

b)

To print data

c)

To delete data

d)

To sort data

3.

Which of the following would be considered a constant?

a)

Number of goals scored in a game

b)

Today’s lunch menu

c)

The value of pi (3.14159)

d)

A student’s daily attendance count

4.

A variable that does not change during a program is called a (a)   .

5.

A variable can only change once in a program.

a)

True

b)

False

6.

What is the difference between a variable and a constant?

a)

A constant never changes, but a variable can

b)

A variable never changes, but a constant can

c)

Both can change values

d)

Constants are always numbers, variables are words

7.

Which of these is NOT a good variable name?

a)

total_points

b)

playerLives

c)

score2

d)

thing

8.

In the our example, “spread peanut butter” would be considered a _______.

a)

Variable

b)

Constant

c)

Function

d)

Container

9.

Why do programmers use functions?

a)

To make code longer

b)

To break complex tasks into smaller steps

c)

To erase data

d)

To rename variables

10.

Which of the following is an example of an array?

a)

high_score = 500

b)

snacks = ["Chips", "Cookies", "Candy"]

c)

gravity = 9.8

d)

make_sandwich()

11.

What is the FIRST element of the array pets = ["Dog", "Cat", "Fish"]?

a)

"Cat"

b)

"Dog"

c)

"Fish"

d)

pets[3]

12.

In most programming languages, what index number does the first element of an array start at?

a)

1

b)

0

c)

-1

d)

10

13.

Which Python structure is most similar to an array?

a)

Loop

b)

List

c)

Constant

d)

Function

14.

What would scores[2] return if scores = [10, 20, 30, 40]?

a)

10

b)

20

c)

30

d)

40

15.

Which of the following is an advantage of using arrays/containers?

a)

They make code shorter and more organized.

b)

They delete unused variables.

c)

They can only hold one number.

d)

They automatically sort data.

16.

What is a vector in programming?

a)

Another name for a constant

b)

A special type of array

c)

A type of function

d)

A mathematical equation only