menu

Python Operators

Python Operators - Important Points


21.

What is the output of the following code?

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

A. 2.5

B. 3

C. 2

D. 2.25

Discuss Work Space

Answer: option a

Explanation:

The operator / performs floating-point division, which returns the quotient of the division as a floating-point number. In this case, 5 divided by 2 is equal to 2.5.


22.

What is the output of the following code?

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

A. 1

B. 0

C. Error

D. None of the above

Discuss Work Space

Answer: option a

Explanation:

The operator > compares two values and returns True if the left operand is greater than the right operand, and False otherwise. In this case, 5 is greater than 2, so the output is True.


23.

What is the output of the following code?

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

A. 1

B. 3

C. 0

D. 10

Discuss Work Space

Answer: option a

Explanation:

The % operator is used for modulo division in Python. It returns the remainder of the division. In this case, 10 % 3 is equal to 1.



Subscribe for Latest Career Trends
Subscribe Now
Use AI and ChatGPT for Career Guidance

Unlock Your Future

Join Now
Worried for Placements in 2024?

Join FAST TRACK Course

Join Now
Supercharge Your SUCCESS

Join All in One Placement Mock Tests-2024

Join Now