wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Python Test-2A

Total questions: 11

Worksheet time: 4mins

Name
Class
Date
1.

Which of the following is true for variable names in Python?

a)

underscore and ampersand are the only two special characters allowed

b)

unlimited length

c)

all private members must have leading and trailing underscores

d)

none of the mentioned

2.

What will be the value of the following Python expression?

4 + 3 % 5

a)

7

b)

2

c)

4

d)

1

3.

What will be the output of the following Python code snippet if x=1?

x<<2

a)

4

b)

2

c)

1

d)

8

4.

What are the values of the following Python expressions?

2**(3**2)

(2**3)**2

2**3**2

a)

512, 64, 512

b)

512, 512, 512

c)

64, 512, 64

d)

64, 64, 64

5.

Which of the following is the truncation division operator in Python?

a)

|

b)

//

c)

/

d)

%

6.

What will be the output of the following Python expression if x=56.236?

print("%.2f"%x)

a)

56.236

b)

56.23

c)

56.0000

d)

56.24

7.

What will be the output of the following Python statement?

"a"+"bc"

a)

bc

b)

abc

c)

a

d)

bca

8.

Which one of the following is not a keyword in Python language?

a)

pass

b)

eval

c)

assert

d)

nonlocal

9.

What arithmetic operators cannot be used with strings in Python?

a)

*

b)

c)

+

d)

All of the mentioned

10.

What is the maximum possible length of an identifier in Python?

a)

79 characters

b)

31 characters

c)

63 characters

d)

none of the mentioned

11.

Which of the following is the use of id() function in python?

a)

Every object doesn’t have a unique id

b)

Id returns the identity of the object

c)

All of the mentioned

d)

None of the mentioned