Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

What is the correct file extension for Python files?

a)

.pp

b)

.pt

c)

.py

d)

.pn

2.

What is a correct way to declare a Python variable?

a)

var x = 5

b)

#x = 5

c)

$x = 5

d)

x = 5

3.

x = "John"

# is the same as

x = 'John'

a)

True

b)

False

4.

a = 5

# is the same as

A = 5

a)

True

b)

False

5.

Insert the missing part of the code below to output “SSIT".

__________ (“SSIT")

a)

Print

b)

Type

c)

Write

6.

Which character is used to define a Python comment:

a)

'

b)

//

c)

#

d)

/*

7.

Which is NOT a legal variable name?

a)

my-var = 20

b)

my_var = 20

c)

Myvar = 20

d)

_myvar = 20

8.

Consider the following code:

print('Hello', 'World')

What will be the printed result?

a)

Hello, World

b)

Hello World

c)

HelloWorld

9.

Consider the following code:

a = 'Hello'

b = 'World'

print(a + b)

What will be the printed result?

a)

a + b

b)

Hello World

c)

HelloWorld

10.

Consider the following code:

a = 4

b = 5

print(a + b)

What will be the printed result?

a)

45

b)

9

c)

4 + 5