wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

ZeroToMastery

Total questions: 20

Worksheet time: 7mins

Name
Class
Date
1.

What will be output of given code?

a)

[4, 6, 7]

b)

[2, 6, 0]

c)

[2, 5, 4]

d)

[7, 1, 0]

2.

Which method is used to add element to the end of the list?

a)

add()

b)

len()

c)

push()

d)

append()

3.

Which of the following is immutable data structure?

a)

Set

b)

Tuple

c)

List

d)

Dictionary

4.

What will be the output of 5//2 in python?

a)

2.0

b)

2.5

c)

2

d)

SyntaxError

5.

Choose the correct output.

a)

11

b)

10

c)

12

d)

1

6.

What will be the output of 3**4 in python?

a)

12

b)

0

c)

81

d)

SyntaxError

7.

Choose the correct output

a)

10001000

b)

2000

c)

True

d)

False

8.

Which data structure doesn't allow duplicated elements?

a)

Set

b)

Tuple

c)

List

d)

Dictionary

9.

What will be the output of the following code snippet?

a)

0

b)

1

c)

3

d)

9

10.

Which is the symbol of XOR ? 

a)

^

b)

&

c)

|

d)

~

11.

What will be the output?

a)

TypeError

b)

[2, 2, 3]

c)

(2, 2, 3)

d)

[1, 0, 3]

12.

Method used to remove the item at given index

a)

insert()

b)

remove()

c)

index()

d)

pop()

13.

Choose the correct output.

a)

0 1 2 3 4 ........... 19

b)

1 2 3 5 6 7 9 ....... 21

c)

0 4 8 12 16 20

d)

Error

14.

 Which of the following type of loop is not supported in Python?

a)

for

b)

while

c)

do - while

d)

None of the above

15.

Choose the correct output.

a)

[2, 5, 4, 6, 3, 4, 1, 0]

b)

[0, 1, 4, 3, 6, 4, 5, 2]

c)

[0, 1, 3, 7, 6, 5, 2]

d)

[2, 5, 6, 7, 3, 1, 0]

16.

Choose the correct output.

a)

[2, 4, 6, 0]

b)

[5, 7, 1]

c)

[0, 1, 2, 4, 5, 6, 7]

d)

[0, 1, 7, 6, 4, 5, 2]

17.

Choose the correct output.

a)

['hello world']

b)

['hello', 'world']

c)

['h', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd']

d)

['hello'],['world']

18.

Choose the correct output.

a)

False

b)

HELLO WORLD

c)

True

d)

HelloWorld

19.

Choose the correct output.

a)

{1, 2, 3, 4, 5, 6}

b)

{2, 4}

c)

{1, 2, 2, 3, 4, 4, 5, 6}

d)

{1, 3, 5, 6}

20.

Which of the following is an invalid escape sequences in Python?

a)

\t

b)

\n

c)

\\

d)

None of the above