wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

python operators MCQ

Total questions: 45

Worksheet time: 15mins

Name
Class
Date
1.

Which python operator means 'less than or equal to'?

a)

>=

b)

>

c)

<

d)

<=

2.

What is the value of the expression 100 / 25?

a)

4

b)

4.0

c)

"4.0"

d)

'4.0'

3.

What is the output of the following code :


print 9//2

a)

4.5

b)

4.0

c)

4

d)

3

4.

Which is the correct operator for power(x^y)?

a)

X^y

b)

X**y

c)

X^^y

d)

None of the mentioned

5.

Which one of these is floor division?

a)

/

b)

//

c)

%

d)

None of the mentioned

6.

What is the answer of this expression, 22 % 3 is?

a)

7

b)

1

c)

0

d)

5

7.

x = 4.5

y = 2

print(x//y)

a)

2.0

b)

2

c)

9

d)

9.0

8.

x = 5


print(x > 3 and x < 10)

a)

True

b)

False

9.

x = 10


print(x > 3 and x < 9)

a)

True

b)

False

10.

x = 8


print(x > 3 or x < 20)

a)

True

b)

False

11.

x = 14


print(x > 10 or x < 3)

a)

True

b)

False

12.

x = 5


print(x < 2 or x < 3)

a)

True

b)

False

13.

x = 5


print(not(x > 3 and x < 10))

a)

True

b)

False

14.

x = 5


print(not(x > 3 or x < 2))

a)

True

b)

False

15.

x = 5


print(not(x > 6 or x < 3 ))

a)

True

b)

False

16.

x = 5

y = 3


print(x == y)

a)

True

b)

False

17.

x = "5"

y = 5


print(x == y)

a)

True

b)

False

18.

x = 5

y = 3


print(x != y)

a)

True

b)

False

19.

x = 10

y = 10


print(x != y)

a)

True

b)

False

20.

x = 5


x%=3


print(x)

a)

2

b)

2.0

c)

3

d)

3.0

21.
Stores whole numbers only
a)
INTEGER
b)
REAL (Float)
c)
STRING
d)
CHARACTER
22.
Stores decimal numbers
a)
INTEGER
b)
REAL (Float)
c)
STRING
d)
CHARACTER
23.
Stores single characters
a)
INTEGER
b)
REAL (Float)
c)
STRING
d)
CHARACTER
24.
Stores more than one character
a)
INTEGER
b)
REAL (Float)
c)
STRING
d)
CHARACTER
25.
Stores True or False
a)
INTEGER
b)
REAL (Float)
c)
STRING
d)
BOOLEAN
26.
3 == 3.0
a)
TRUE
b)
FALSE
27.
30 == 3.0
a)
TRUE
b)
FALSE
28.

Which operator is known as ternary operator in python?

a)

Assignment

b)

Conditional

c)

Relational

d)

Comparative

29.

Which symbol is used to print more than one item on a single line?

a)

$

b)

:

c)

,

d)

;

30.

If p=25 , what is p**2?

a)

50

b)

125

c)

600

d)

625

31.

c=35 if 34<43 else 43

a)

34

b)

43

c)

35

d)

1

32.

Who developed python?

a)

Ritchie

b)

Bill gates

c)

Guido van Rossum

d)

Sunder

33.

Which character is used to denote long integer?

a)

D

b)

N

c)

LO

d)

L

34.

In Python script editor, the errors will be shown in ----- color in the IDLE window?

a)

green

b)

black

c)

red

d)

orange

35.

Which is known as simple assignment operator?

a)

==

b)

=

c)

+=

d)

#

36.

Which function accepts all data as string or characters but not as numbers?

a)

int()

b)

output()

c)

input()

d)

print()

37.

print(7//2)

a)

2

b)

3

c)

4

38.

print(9>2 and 6<=6)

a)

TRUE

b)

FALSE

39.

print(8!=8)

a)

TRUE

b)

FALSE

40.

print(2**3)

a)

6

b)

12

c)

8

41.

print("3"+"3")

a)

33

b)

6

c)

INVALID OUTPUT

42.

print(2%2==0 or 3%2==0)

a)

TRUE

b)

FALSE

c)

INVALID OUTPUT

43.

print(4+"2")

a)

6

b)

42

c)

TYPE ERROR

44.

 xy x^{y\ }  

a)

x^^y

b)

x^y

c)

x**y

d)

x pow y

45.

the output of: x >= y

a)

Adjust x so that it is greater than or equal y

b)

True if x is greater than or equal y

c)

x is shifted y bits to the right

d)

False if x equals y in value