wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Functions & NameSpace in Python -1

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

What will be the output of the following Python code?

a)

Hello World!

Hello World!

b)

'Hello World!'

'Hello World!'

c)

Hello

Hello

d)

None of the mentioned

2.

What will be the output of the following Python code?

a)

3

b)

4

c)

4 is maximum

d)

None of the mentioned

3.

What will be the output of the following Python code?

a)

x is 50

Changed local x to 2

x is now 50

b)

x is 50

Changed local x to 2

x is now 2

c)

x is 50

Changed local x to 2

x is now 100

d)

None of the mentioned

4.

What will be the output of the following Python code?

a)

x is 50

Changed global x to 2

Value of x is 50

b)

x is 50

Changed global x to 2

Value of x is 2

c)

x is 50

Changed global x to 50

Value of x is 50

d)

None of the mentioned

5.

What will be the output of the following Python code?

a)

Hello

WorldWorldWorldWorldWorld

b)

Hello

World 5

c)

Hello

World,World,World,World,World

d)

Hello

HelloHelloHelloHelloHello

6.

What will be the output of the following Python code?

a)

a is 7 and b is 3 and c is 10

a is 25 and b is 5 and c is 24

a is 5 and b is 100 and c is 50

b)

a is 3 and b is 7 and c is 10

a is 5 and b is 25 and c is 24

a is 50 and b is 100 and c is 5

c)

a is 3 and b is 7 and c is 10

a is 25 and b is 5 and c is 24

a is 100 and b is 5 and c is 50

d)

None of the mentioned

7.

What will be the output of the following Python code?

a)

2

b)

3

c)

The numbers are equal

d)

None of the mentioned

8.

Which of the following is a feature of DocString?

a)

Provide a convenient way of associating documentation with Python modules, functions, classes, and methods

b)

All functions should have a docstring

c)

Docstrings can be accessed by the __doc__ attribute on objects

d)

All of the mentioned

9.

What will be the output of the following Python code?

a)

9

b)

3

c)

27

d)

30

10.

What will be the output of the following Python code?

a)

212

32

b)

314

24

c)

567

98

d)

None of the mentioned