wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python

Total questions: 24

Worksheet time: 12mins

Name
Class
Date
1.

What is Python ?

a)
A type of snake
b)
A high-level programming language
c)
A type of food
d)
A movie
2.

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

a)

int

b)

words

c)

string

d)

decimals

3.

A list is changeable and unordered

a)

True

b)

False

4.

What would be printed by the command

print('12-5')

a)

12-5

b)

'12-5'

c)

7

d)

'7'

5.

Which function changes a string to a float?

a)

float()

b)

num()

c)

print()

d)

change()

6.

What will be the output of the following statement?

type('5')

a)

str

b)

int

c)

float

d)

Boolean

7.
How would would you print a text string?
a)
output "Hello!"
b)
print ("Hello!")
c)
print (Hello!)
d)
output (Hello!)
8.

people = ["John", "Rob", "Bob"]

print (people[1])

what would this result be?

a)

John

b)

Rob

c)

Bob

9.

Python identifies blocks of code by

a)

(and)

b)

guessing

c)

aligning up the starts of lines (indentation)

10.

What will the output be from the following code?
print("Hello world!" * 2)

a)

TypeError

b)

Hello world! * 2

c)

Hello world!Hello world!

d)

Hello world world!

11.

What will the output be from the following code?
print(Hello world!)

a)

Hello world!

b)

Hello world

c)

SyntaxError

d)

print(Hello world!)

12.

What syntax can you use to insert a line break between strings so that they appear over multiple lines?

a)

/

b)

\n

c)

\l

d)

n/

13.

What will the output be from the following code?
print("Hello" + str(2) + "world!")

a)

Hello world! Hello! world!

b)

Hello2world!

c)

Hello Hello world! world!

d)

SyntaxError

14.

What will the output be from the following code?
print("Hello world!\nHello world!")

a)

Hello world! Hello world!

b)

SyntaxError

c)

Hello world!
Hello world!

d)

Hello world!

15.

What is syntax?

a)

Syntax is the rules of the programming language

b)

It is used to read information

c)

Syntax is the word used to describe an error

d)
A type of software
16.

Tells the interpreter that the code which follows is a function

a)

const

b)

def

c)

int

d)

elif

17.

What is python named after

a)

The snake

b)

Television show called Monty Python

18.

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

a)

Converts the var (variable) myAge to if statement

b)

Converts the var (variable) myAge to a integer

c)

Converts the var (variable) myAge to a string

d)

Converts the var (variable) myAge to a integer

19.


What is the position of the name "Robert" in the following list:

a)

0

b)

1

c)

2

d)

3

20.

What is the Python built-in function to converts a number to a string?

a)

str()

b)

int()

c)

parseint()

d)

convert

21.

What does the term 'debug' mean?

a)

Looking at code

b)

A set of instructions

c)

Identify errors and fix them.

d)

Making a calculation

22.

A location in memory used to store data that can be changed.

a)

Variable

b)

Iteration

c)

Constant

d)

Value

23.

What symbol do you use to make a comment in Python?

a)

;

b)

#

c)

@

24.

What extension must you add to the end of a file when saving?

a)

.png

b)

.py

c)

.xlsx

d)

.docx

e)

.jpeg