wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Python basics

Total questions: 20

Worksheet time: 20mins

Name
Class
Date
1.
What is the word (command) used to display numbers and text on the screen?
a)
print
b)
input
c)
output
d)
command
2.
The number or word we give to a variable
a)
Value
b)
Bug
c)
Information
d)
Text
3.
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
4.
What symbol is used in python to assign values to a variable?
a)
equals =
b)
plus + 
c)
forward slash /
d)
asterisk *
5.
What will be the output?
name = 'Dave'
print (name)
a)
Dave
b)
'Dave'
c)
name
d)
(name)
6.
What would print (10 + 16) produce?
a)
20
b)
22
c)
24
d)
26
7.

Which is the Python logo?

a)
b)
c)
d)
8.

What is an input?

a)

A command that allows us to ask the user to enter some data.

b)

To plug in something.

c)

Data displayed on a screen.

d)

A function

9.

What is an output?

a)

A piece of data that is shown on the screen.

b)

Data that the user enters

c)

An output

d)

A orange

10.

To display the following on screen

Hello World!

the following command should be used:

a)

print(Hello World!)

b)

print("Hello World!")

c)

print("Hello World" + !)

d)

print"(Hello World!)"

11.

x = 5

y = 6

print("x*y")


The code above displays the following:

a)

11

b)

x*y

c)

Syntax Error

d)

30

12.

Choose the correct operators used in python:


divide, multiply, add, subtract

a)

/, *, +, -

b)

div, mul, +, -

c)

\, x, +, -

d)

~, *, +, -

13.
Which symbol do we use if we want to add a comment to our code?
a)
@
b)
#
c)
*
d)
&
14.

Which operator checks if a value is equal to another value?

a)

+

b)

=

c)

==

d)

!=

15.

Which operator checks if a value is not equal to another value?

a)

==

b)

+=

c)

!=

d)

=

16.

A data type that can have one of two values: True or False

a)

boolean

b)

variable

c)

modulo

d)

interpreter

17.
Which of the following is a float?
a)
new_var = 1234
b)
new_var = True
c)
new_var = 1.234
d)
new_var = "True"
18.
Which of the following is not a string?
a)
new_var = "True"
b)
new_var = "3123"
c)
new_var = "3.123"
d)
new_var = False
19.
What will the following code do? 
name = "Bob"
if name == "Bob": 
     print ("Hello " + name) 
else:  
     print ("I dont know you")
a)
prints bob
b)
prints Hello Bob
c)
nothing syntax error
d)
prints I don't know you
20.

Integers are ____________ and floats are _____________

a)

whole numbers and exponents

b)

powers and fractions

c)

fractions and whole numbers

d)

whole numbers and decimal numbers