wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Python_MCQ_2

Total questions: 15

Worksheet time: 14mins

Name
Class
Date
1.

How many except statements can a try-except block have?

a)

zero

b)

one

c)

more than one

d)

more than zero

2.

Suppose t = (1, 2, 4, 3), which of the following is incorrect?

a)

print(t[3])

b)

t[3] = 45

c)

print(max(t))

d)

print(len(t))

3.

What will be the output of the following Python code?

a)

(1, 2)

b)

(1, 2, 4)

c)

(2, 4)

d)

(2, 4, 3)

4.

What will be the output of the following Python code?

a)

[1] [2] [3]

b)

[1] [1, 2] [1, 2, 3]

c)

[1, 2, 3]

d)

1 2 3

5.

What will be the output of the following Python code?

a)

4

b)

5

c)

8

d)

12

6.

What will be the output of the following Python code?

a)

True

b)

False

c)

Error

d)

None

7.

What will be the output of the following Python code?

a)

30

b)

24

c)

33

d)

12

8.

What is the value of the following expression?
2+4.00, 2**4.0

a)

(6.0, 16.0)

b)

(6.00, 16.00)

c)

(6, 16)

d)

(6.00, 16.0)

9.

What are the values of the following Python expressions?

a)

64, 512, 64

b)

64, 64, 64

c)

512, 512, 512

d)

512, 64, 512

10.

What will be the output of the following Python code?
print('Hello!2@#World'.istitle())

a)

True

b)

False

c)

None

d)

Error

11.

What will be the output of the following Python code?

a)

4

b)

5

c)

1

d)

An exception is thrown

12.

What will be the output of the following Python code?

a)

Integer

b)

Tuple

c)

Dictionary

d)

An exception is thrown

13.

If a function doesn’t have a return statement, which of the following does the function return?

a)

int

b)

null

c)

None

d)

An exception is thrown without the return statement

14.

What will be the output of the following Python code?


a)

212

32

b)

9

27

c)

567

98

d)

None of the mentioned

15.

What will be the output of the following Python code snippet?

a)

Error, dictionary in a dictionary can’t exist

b)

‘Numbers’: {1: 56, 3: 7}

c)

{‘Numbers’: {1: 56}, ‘Letters’: {4: ‘B’}}

d)

{‘Numbers’: {1: 56, 3: 7}, ‘Letters’: {4: ‘B’}}