wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Python Quiz

Total questions: 10

Worksheet time: 6mins

Name
Class
Date
1.

Which one of the following is not a valid variable name.

a)

a2

b)

a2a

c)

22a

d)

_abc

2.

Guess the output:


a = 255

b = 255

print(a == b)

a)

True

b)

False

3.

Guess the output:


a = 257

b = 257

print(a is b)

a)

True

b)

False

4.

Guess the output:


p, q, r = 10, 20 ,30

print(p, q, r)

a)

10 20 30

b)

10, 20, 30

c)

Invalid Syntax

5.

Guess the output:


name = "Rahul"

print(name[::])

a)

"Rahul"

b)

Syntax error

c)

" "

6.

Guess the output:


name = "Rahul"

print(name[2::-1])

a)

"Rah"

b)

"ha"

c)

"luh"

d)

"haR"

7.

Guess the output:


a = 0

b = 1

c = "2"

print(a + b + c)

a)

3

b)

"012"

c)

2

d)

TypeError

8.

Guess the output:


value = "Rahul" * 2

print(value)

a)

SyntaxError

b)

"RahulRahul"

c)

"Rahul"

9.

Guess the output:


for i in range(1, 7, 2):

print(i, end=",")

a)

1 2 3 4 5 6 7,

b)

1,3,5,

c)

1,3,5

d)

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

10.

Guess the output:


li = [2, 3, 5]

li.append("Rahul")

print(li)

a)

SyntaxError

b)

[2, 3, 5, 'Rahul']

c)

['Rahul', 2, 3, 5]