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
View Answer Discuss Work SpaceAnswer: 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
View Answer Discuss Work SpaceAnswer: 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
View Answer Discuss Work SpaceAnswer: 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. /
View Answer Discuss Work SpaceAnswer: option b
Explanation:
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
View Answer Discuss Work SpaceAnswer: 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.