wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python

Total questions: 20

Worksheet time: 11mins

Name
Class
Date
1.
A syntax error means your code has a 'grammar' mistake or you used symbols/operations incorrectly
a)
True
b)
False
2.
What Python command lets the user enter an answer to a question?
a)
answer()
b)
open()
c)
print()
d)
input()
3.
Which statement correctly assigns the string "Tanner" to the variable name?
a)
name  = print( "Tanner")
b)
input("Tanner")
c)
name = "Tanner"
d)
name = input("Tanner")
4.

Python language was developed in what year?

a)

1985

b)

2001

c)

1991

d)

1820

5.

What output will the console show, if 15 and 30 are entered by the user?

a)

Syntax error

b)

The sum of the two numbers

c)

The concatenation of the two numbers

d)

Complier error

6.

Which one will display when this code is run?

a)
b)
c)
d)

None of the above

Wrong statement

7.

After which circus was Python named ??

(a)  

8.
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
9.

What extension must be added to the end of a file when saving in python ?

a)
.xlsx
b)
.pptx
c)
.docx
d)
.py
10.
I am 71 years old! What will the output be?: IF you are 70 or older, say “You are aged to perfection!” ELIF you are exactly 50, say “Wow, you are half a century old!” ELSE say “You are a spring chicken!”
a)
“You are aged to perfection!”
b)
"Wow, you are half a century old!"
c)
"You are a spring chicken!"
11.
what is the code for a STRING in python?
a)
str
b)
stri
c)
stg
12.
In python the ' FLOAT data type' can be defined as...?
a)
holds alphanumerical data
b)

holds whole numbers

c)

holds a decimal point in a number

d)
hold either true or false
13.

Which of the following is an acceptable variable name?

a)

no-text

b)

8text

c)

no_text

d)

no_text$

14.
What symbol do you use to make a comment in Python?
a)
@
b)
¬
c)
;
d)
#
15.

What would be printed by the command

print('12-5')

a)

12-5

b)

'12-5'

c)

7

d)

'7'

16.
What will the output be from the following code?
print(Hello world!)
a)
Hello world!
b)
SyntaxError
c)
Hello world
d)
print(Hello world!)
17.

Which one is NOT a legal variable name?

a)

my_var

b)

myvar

c)

_myvar

d)

my-var

18.

Which operator can be used to compare two values?

a)

=

b)

<>

c)

><

d)

==

19.

Which of the following is a data type in Python? Select multiple answers.

a)

int

b)

words

c)

string

d)

decimals

20.

How difficult was the quiz?

a)

Easy

b)

Medium

c)

Hard

d)

Extremely Difficult