wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Quiz 1 - Python

Total questions: 15

Worksheet time: 8mins

Name
Class
Date
1.

In programming, what is a variable?

a)
A variable is a symbolic name for a storage location that can hold data and whose value can change.
b)
A variable is a command that executes a function.
c)
A variable is a type of programming language.
2.

How many variables exist in the following code?

a)

Two - Num1 and Num2

b)

Three - if, elif and else

c)

Two - AND, OR

3.

What would be output if the following code was executed?

a)

Num1 is larger

b)

Num1 is smaller

c)

Both the same

4.

In python programming, what does the following code demonstrate?

a)

Selection

b)

Iteration

c)

Variable Assignment

5.

Which of the following is a valid variable name in Python?

a)

1variable

b)

variable_name

c)

variable-name

6.

Which of the following would produce an error?

a)

print(7 * 7)

b)

print(7 * "7")

c)

print("7" * "7")

7.

Which is the correct definition for "syntax"

a)

The rules of language

b)

The errors that a program produces

c)

The programming concepts such as variables and selection

8.

Which of the following data types is the value stored in myVariable?

a)

Integer

b)

Float

c)

String

9.

Which of the following data types is the value stored in myVariable?

a)

Integer

b)

Float

c)

String

10.

What is the result of the following expression in Python: 5 + 3 * 2?

a)

16

b)

11

c)

13

11.

What is the output of the following Python code: print(2 ** 3)?

a)

6

b)

8

c)

9

12.

What would the best explanation of the following code be?

a)

To tell somebody how long is left until they can vote

b)

To tell somebody whether they are old enough to vote, or not.

c)

To tell somebody how old they are.

13.

What is the correct way to use "input" in python?

a)

b)

c)

14.

Select the true statement:

a)

input() is always input as an integer

b)

input() is always input as a string

c)

input() is always input as a float

15.

What would the following code do: int(input())

a)

Take in some user input and store it as a string

b)

Nothing, it would return an error

c)

Take in some user input and store it as an integer