wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Python_Quiz_1

Total questions: 10

Worksheet time: 10mins

Name
Class
Date
1.

What will be the output of the following Python code?

a)

[‘ab’, ‘cd’]

b)

[‘AB’, ‘CD’]

c)

[None, None]

d)

none of the mentioned

2.

What will be the output of the following Python code?

a)

1 2

b)

1 2 3

c)

error

d)

none of the mentioned

3.

What will be the output of the following Python code?

a)

a b c d e f

b)

abcdef

c)

i i i i i i …

d)

error

4.

What will be the output of the following Python code?

a)

no output

b)

i i i i i i …

c)

a a a a a a …

d)

a b c d e f

5.

What will be the output of the following Python code?

a)

0 1 2 3 4 Here

b)

0 1 2 3 4 5 Here

c)

0 1 2 3 4

d)

1 2 3 4 5

6.

What will be the output of the following Python code?

a)

0 1 2

b)

error

c)

0 1 2 0 1 2

d)

none of the mentioned

7.

Suppose list1 is [4, 2, 2, 4, 5, 2, 1, 0], Which of the following is correct syntax for slicing operation?

a)

print(list1[2:])

b)

print(list1[:2])

c)

print(list1[:-2])

d)

all of the mentioned

8.

What will be the output of the following Python statement?

a)

a

b)

ab

c)

cd

d)

dc

9.

Suppose listExample is [3, 4, 5, 20, 5, 25, 1, 3], what is list1 after listExample.extend([34, 5])?

a)

[3, 4, 5, 20, 5, 25, 1, 3, 34, 5]

b)

[1, 3, 3, 4, 5, 5, 20, 25, 34, 5]

c)

[25, 20, 5, 5, 4, 3, 3, 1, 34, 5]

d)

[1, 3, 4, 5, 20, 5, 25, 3, 34, 5]

10.

What will be the output of the following Python code?

a)

2 3 4 5 6 1

b)

6 1 2 3 4 5

c)

2 3 4 5 6 6

d)

1 1 2 3 4 5