menu

Python Operators

Python Operators - Important Points


11.

What is the output of the following code?

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

A. 0

B. 1

C. 2

D. 3

Discuss Work Space

Answer: option b

Explanation:

The modulus operator (%) returns the remainder of the division of the first operand by the second operanSo, the output of the code will be 1.


12.

What is the output of the following code?

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

A. 5

B. 6

C. 8

D. 9

Discuss Work Space

Answer: option c

Explanation:

The exponentiation operator (**) raises the first operand to the power of the second operanSo, the output of the code will be 8.


13.

What is the output of the following code?

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

A. 2.5

B. 2

C. 3

D. 3.5

Discuss Work Space

Answer: option b

Explanation:

The floor division operator (//) returns the quotient of the division of the first operand


14. Which of the following is the correct operator for exponentiation in Python?

A. ^

B. **

C. %

D. /

Discuss Work Space

Answer: option b

Explanation:

The ** operator is used for exponentiation in Python. It raises the first operand to the power of the second operand.

15.

What is the output of the following code?

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

A. 3.33

B. 3

C. 3

D. 10

Discuss Work Space

Answer: option c

Explanation:

The // operator performs integer division in Python. It divides the first operand by the second operand and returns the quotient as an integer. In this case, the output is 3.



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