menu

Python Operators


1. Which operator is used for checking if two values are equal in Python?

==

=

!=

<> 


2.

What is the output of the following code?

a = 2
b = 5
print(a * b ** 2)

50

35

20

10


3.

What is the output of the following code?

a = 10
b = 3
print(a % b)

1

3

0

10


4.

What is the output of the following code snippet?

a = 10
b = 5
print(a>b or a/b==2)

1

0

Syntax Error

None of the above


5. Which operator is used for exponentiation in Python?

**

^

*

//


6.

What is the output of the following code?

x = 5
y = 2
print(x // y)

2.5

3

2

3


7.

What is the output of the following code snippet?

a = 2
b = 3
print(a**b)

6

8

9

27


8.

What is the output of the following code?

x = 5
y = 2
print(x % y)

2.5

3

2

1


9.

What is the output of the following code snippet?

a = 5
b = 2
print(a%b)

2.5

2

1.5

1


10. Which operator is used to perform exponentiation in Python?

**

^

%

//