menu

Python Operators


1.

What is the output of the following code?

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

1

0

Error

None of the above


2.

What is the output of the following code snippet?

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

1

0

Syntax Error

None of the above


3.

What is the output of the following code?

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

5

6

8

9


4.

What is the output of the following code?

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

3.33

3

3

10


5.

What is the output of the following code?

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

2.5

3

2

3


6.

What is the output of the following code?

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

2.5

3

2

2.25


7.

What is the output of the following code?

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

2.5

2

1

0.5


8. Which operator is used for exponentiation in Python?

**

^

*

//


9.

What is the output of the following code snippet?

a = 3
b = 3
print(a is b)

1

0

Syntax Error

None of the above


10.

What is the output of the following code snippet?

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

2.5

2

1.5

1