Python Operators
Python Operators - Important Points
1. | Which operator is used for concatenation of two strings in Python? |
---|
A. +
B. -
C. *
D. /
View Answer Discuss Work SpaceAnswer: option a
Explanation:
The operator + is used for concatenation of two strings in Python. It combines the two strings into a single string. For example, "hello" + "world" returns "helloworld".
2. | Which of the following operators is used for floor division in Python? |
---|
A. //
B. %
C. /
D. *
View Answer Discuss Work SpaceAnswer: option a
Explanation:
3. | Which operator is used for checking if two values are equal in Python? |
---|
A. ==
B. =
C. !=
D. <>
View Answer Discuss Work SpaceAnswer: option a
Explanation:
4. | What is the output of the following code snippet? a = 5 b = 2 print(a//b) |
---|
A. 2.5
B. 2
C. 3
D. 2
View Answer Discuss Work SpaceAnswer: option d
Explanation:
The // operator performs integer division and returns the quotient without the remainder. In this case, 5//2 returns 2.
5. | Which operator is used for exponentiation in Python? |
---|
A. **
B. ^
C. *
D. //
View Answer Discuss Work SpaceAnswer: option a
Explanation: