wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Ms. Ayesha's Python Quiz

Total questions: 20

Worksheet time: 14mins

Name
Class
Date
1.

What in the name of the variable in this Python code?

a)

name

b)

input

c)

print

d)

("What is your name")

2.
what is python?
a)
a programming language 
b)
a code 
c)
nothing 
d)
a game 
3.

What does the following code do? myAge = int (myAge)

a)

Converts the var (variable) myAge to a string

b)

Converts the var (variable) myAge to a integer

c)

Converts the var (variable) myAge from a integer to a string

d)

Converts the var (variable) myAge to if statement

4.
What does the term 'debug' mean?
a)
Identify errors and fix them.
b)
Making a calculation
c)
A set of instructions
d)
Looking at code
5.

is integer a number

a)

true

b)

false

6.

is boolean a data type or a condition

a)

data type only

b)

data type and condition only

c)

condition only

7.
In the following code, "city" is an example of a what?
a)
List
b)
Loop
c)
Variable
d)
Array
8.
What does the print function do in python?
a)
It's a variable.
b)
It can input data.
c)

It displays an output

d)
It loops the code.
9.
What is a variable?
a)
A box(memory location) where you store values
b)
a type of graphics
c)
Data type
d)
a type of memory
10.
What symbol is used in python to assign values to a variable?
a)
equals =
b)
plus + 
c)
forward slash /
d)
asterisk *
11.

light_sensor= int(input("Enter the light sensor reading value (between 0 - 1023): "))

if light_sensor< 100:

print("Dark")

else:

print("Light")

What will be printed when the user enters the number 55?

a)

Light

b)

Dark

c)

Nothing

d)

Error

12.

mark =95

print ("mark")

what is the output?

a)

mark

b)

95

c)

mark =95

13.

mark =95

print (mark)

what is the output?

a)

mark

b)

95

c)

mark =95

14.

What is the final value of the variable?

a)

4

b)

5

c)

9

15.

What is the data type of the variable number?

a)

string

b)

int

c)

float

16.
What will the output be from the following code?
print(3*4+5)
a)
27
b)
17
c)
12
d)
SyntaxError
17.
What symbol is used in python to assign values to a variable?
a)
equals =
b)
plus + 
c)
forward slash /
d)
asterisk *
18.
What symbol do you use to make a comment in Python?
a)
@
b)
¬
c)
;
d)
#
19.

fruits = ["apple","banana","orange"]

print(fruit[0])

What will be the output of this program?

a)

["apple","banana","orange"]

b)

apple

c)

banana

d)

orange

20.

What will be printed after running this FOR loop:

for number in range(0, 6):  
    print(number)

a)

b)

0, 1, 2, 3, 4, 5

c)

5

d)

0, 1, 2, 3, 4, 5, 6