Q.Which of the following is an example of identity operators of Python ?
You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.
Start your 14-day free trial to unlock the full solution →Identity operators in Python check whether two objects refer to the same memory location. The correct identity operator from the given options is is.
Concept and Intuition
In Python, every object lives somewhere in memory. When you create a variable, it holds a reference to that memory location. Two variables might hold the same value but point to different objects in memory — or they might point to the exact same object.
Identity operators (is and is not) answer the question: "Do these two names refer to the same object in memory?" This is different from the == operator, which checks whether the values are equal. For example, a == b could be True even when a is b is False, because Python might create two separate objects with the same value.
The other operators listed — in and not in — are membership operators, not identity operators. They check whether a value exists inside a container (like a list, string, or tuple). The option on is not a Python operator at all.
A very common mistake is confusing is (identity) with == (equality). For small integers and short strings, Python sometimes reuses objects (interning), so a is b might accidentally be True — but you should never rely on this. Always use == to compare values and is only when you explicitly need to check object identity.
Step-by-Step Solution
-
Identify what Python identity operators are.
Python has exactly two identity operators:
isandis not. They returnTrueif the two operands refer to the same object in memory, andFalseotherwise. -
Examine each option against this definition.
- (a)
is— This is a valid identity operator. …
- (a)
Unlock everything free for 14 days
- Full step-by-step solutions
- Concept-first explanations
- Methods, shortcuts & mistakes
- PYQ mapping + timed mock tests
Full access for 14 days. No credit card required.