menu

Python Operators

Python Operators - Important Points


1.

Which operator is used for concatenation of two strings in Python?

A. +

B. -

C. *

D. /

Discuss Work Space

Answer: 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. *

Discuss Work Space

Answer: option a

Explanation:

The // operator is used for floor division in Python. It returns the quotient of the division, rounded down to the nearest integer. For example, 7 // 3 returns 2.

3. Which operator is used for checking if two values are equal in Python?

A. ==

B. =

C. !=

D. <> 

Discuss Work Space

Answer: option a

Explanation:

The operator == is used for checking if two values are equal in Python. It returns True if the two values are equal, and False otherwise.

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

Discuss Work Space

Answer: 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. //

Discuss Work Space

Answer: option a

Explanation:

The ** operator is used for exponentiation in Python. For example, 2**3 returns 8 (i.e., 2 raised to the power of 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