Python Identity and Operator Precedence MCQs: 12 Solved Questions with Explanations
Solve 12 Python MCQs on identity, membership, precedence and associativity. Commit to an option, trace the expression, then check the fresh explanation.
KnowledgeGate Team
Exam prep & CS education

Python is, == and in are individually simple, but 12 MCQs become error-prone when identity, membership and precedence share one option set. Choose A, B, C or D, reduce one operation at a time and compare the result with the explanation. Python Relational and Logical Operator MCQs: 10 Solved Questions owns comparison symbols, truthiness, short-circuiting and operand-return behaviour. This set owns membership, object identity, grouping, powers and associativity. For a teaching-first map across every operator family, read Python Operators and Expressions: Precedence, Types and Worked Output Traces. Write each intermediate value rather than relying on a mnemonic. The Identity & Precedence PYQ Questions hub keeps the remaining topic practice together, while Coding & DSA Courses for Placements places it in the broader learning route.
1. Identity, membership and precedence rules to keep beside you

Keep these three tests separate:
Expression | What Python asks | Example result |
|---|---|---|
| Do both names refer to the same object? |
|
| Do the values compare equal? |
|
| Does the collection contain the value? |
|
For those results, use left = {2, 4}, alias = left and twin = {2, 4}. The alias refers to the original set, so left is alias is True. The separately created set has equal elements, so left == twin is True while left is twin is False. Membership is separate again: 2 in left is True.
The needed precedence order, from earlier to later evaluation, is grouping (), exponentiation **, multiplication group * / // %, addition group + -, comparisons including membership and identity, not, and, then or. Operators at the same level normally evaluate left to right. Exponentiation is the important exception because it groups right to left.
Therefore, 2**3**2 = 2**(3**2) = 2**9 = 512. Explicit left grouping changes it: (2**3)**2 = 8**2 = 64. Build this foundation in sequence with the Python course on concepts, MCQs and coding course.
2. Python MCQs 1-3: recognise membership operators
Question 1 (EMRS 2023, Computer Science)
Which out of the following is considered as a membership operator in Python?
A.
inB.
orC.
notD.
is
Answer: A. in
Membership means containment. For example, 3 in [1, 2, 3] evaluates to True because the list contains the value 3. The other choices have different jobs: or combines boolean conditions, not negates a condition, and is tests whether two references point to the same object. It does not test value equality.
Question 2 (module hub; question page unavailable) (KVS 2026, Computer Science)
Which of the following is a membership operator in Python?
A.
==B.
inC.
notD.
+=
Answer: B. in
The expression 'py' in 'python' is True because the substring appears in the string. Classification removes the distractors: == compares values, not performs logical negation, and += is augmented assignment. Only in asks whether one value occurs inside another object.
Question 3 (module hub; question page unavailable) (HTET 2024, Computer Science)
In Python .......... operator is used to determine the element's presence or absence in list.
A.
findB.
inC.
searchD.
lookup
Answer: B. in
With values = [4, 7, 9], the test 7 in values is True, while 5 in values is False. Python has no membership operators named find, search or lookup. Repeat the same check with a string and a tuple before moving on.
3. Python MCQs 4-6: identity and the highest-precedence choice
Question 4 (module hub; question page unavailable) (Bihar STET 2025, Computer Science)
Which of the following operator evaluates to True if the variable on either side of the operator points towards the same memory location and False otherwise?
A.
isB.
is notC.
andD.
or
Answer: A. is
The safer way to read "same memory location" here is same object identity. Let p = {'x': 1} and q = p. Both names refer to one dictionary, so p is q is True. If r = {'x': 1}, then p == r is True because their values match, but p is r is False because they are distinct objects. is not gives the opposite identity result.
Question 5 (module hub; question page unavailable) (KVS 2026, Computer Science)
Which of the following operators has the highest order of precedence in Python?
A.
**B.
/C.
+D.
-
Answer: A. **
Trace 2 + 3 * 4**2 in precedence order. First, 4**2 = 16. Next, 3 * 16 = 48. Finally, 2 + 48 = 50. Among the four listed operators, exponentiation is evaluated before division, addition and subtraction.
Question 6
Which of the following operators has the highest precedence?
A.
+B.
*C.
**D.
//
Answer: C. **
For 20 // 3 + 2**3 * 2, exponentiation gives 2**3 = 8. Floor division gives 20 // 3 = 6, while multiplication gives 8 * 2 = 16. Addition then produces 6 + 16 = 22. The operators * and // share one precedence level, while ** sits above both.
4. Python MCQs 7-9: read arithmetic and Boolean precedence
Question 7 (Cognizant 2024)
What is the order of precedence in python?
A. Exponential, Parentheses, Multiplication, Division, Addition, Subtraction
B. Exponential, Parentheses, Division, Multiplication, Addition, Subtraction
C. Parentheses, Exponential, Multiplication, Division, Subtraction, Addition
D. Parentheses, Exponential, Multiplication, Division, Addition, Subtraction
Answer: D. Parentheses, Exponential, Multiplication, Division, Addition, Subtraction
D is the intended answer among the supplied choices: grouping comes first, then exponentiation, then the multiplicative level, followed by the additive level. Multiplication and division actually share a level, just as addition and subtraction do. Their sequence in the option does not make them separate levels. For example, 18 / 3 * 2 evaluates left to right: 18 / 3 = 6.0, then 6.0 * 2 = 12.0.
Question 8 (module hub; question page unavailable) (KVS 2026, Computer Science)
Which of the following correctly shows the usual precedence order in Python?
A.
**, (), (*, /), (+, -)B.
(), **, (+, -), (*, /)C.
**, (), (/, *), (+, -)D.
(), **, (*, /), (+, -)
Answer: D. (), **, (*, /), (+, -)
Parentheses control grouping before the listed arithmetic operators. Exponentiation follows, then the multiplicative group, then the additive group. In (2 + 3) * 4**2, grouping gives 5, exponentiation gives 16, and multiplication gives 5 * 16 = 80. Here () should be understood as grouping parentheses rather than an arithmetic operator.
Question 9 (module hub; question page unavailable) (EMRS 2023, Computer Science)
Which of the following is the correct precedence of operators in Python?
A. Braces, or, and, not
B. not, Braces, and, or
C. not, Braces, or, and
D. Braces, not, and, or
Answer: D. Braces, not, and, or
The option uses "Braces" for grouping, although Python uses parentheses for grouping. Evaluate not (False or True) and True in order. Grouping gives True; not True gives False; then False and True gives False. Among boolean operators, the precedence order is not, and, or.
5. Python MCQ 10: trace not, and and or
Question 10 (module hub; question page unavailable) (KVS 2023, Computer Science)
Evaluate the following expression: not True or not False and False
A.
TrueB.
FalseC.
NoneD.
will generate an Error
Answer: B. False
Keep all four states visible. First, not True becomes False. Second, not False becomes True. Third, True and False becomes False. The remaining expression is False or False, which is False. Evaluating or before and is the trap.
6. Python MCQs 11-12: associativity and mixed arithmetic output
Question 11 (KVS 2026, Computer Science)

What will be the output of the following Python function?
print(2**3**2, (2**3)**2, 2**(3*2))A.
512 64 64B.
512 512 512C.
64 64 64D.
64 64 512
Answer: A. 512 64 64
Precedence decides which kind of operation comes first, while associativity decides how repeated operators at one level group. Python groups the unparenthesised exponent chain on the right: 2**3**2 = 2**(3**2) = 2**9 = 512. The explicit left grouping gives (2**3)**2 = 8**2 = 64. The multiplication inside the third exponent gives 2**(3*2) = 2**6 = 64. The printed sequence is therefore 512 64 64.
Question 12 (module hub; question page unavailable) (KVS 2023, Computer Science)
Identify the correct output of the following Python arithmetic expression:
1+(2-3)*4**5//6A.
-171 / -171B.
172 / 172C.
-170 / -170D.
170 / 170
Answer: C. -170 / -170
Work from the grouping outward. First, (2-3) = -1. Exponentiation gives 4**5 = 1024. Multiplication gives -1 * 1024 = -1024. Python floor division then gives -1024 // 6 = -171, because floor division rounds down towards negative infinity. Finally, 1 + (-171) = -170. The slash-separated form in the option repeats the same value. The computed Python value itself is -170.
7. The short version and the next practice step
Use
isfor object identity.Use
==for value equality.Use
infor membership.Evaluate
notbeforeand, andandbeforeor.Remember that
**associates right to left, while equal-level arithmetic operators normally evaluate left to right.
For a final no-options check, start with left = {2, 4} and alias = left. After alias.add(6), the expression left is alias and 6 in left reduces to True and True, so it is True. A new set made with twin = set(left) has equal elements, so left == twin is True, while left is twin is False.
If these distinctions are new, use Python course on concepts, MCQs and coding for the next lesson sequence, then return to the question hub and solve without looking at the options first.
Keep learning
Operator Precedence MCQs: 10 Solved Grammar and Parse-Tree Questions
Solve 10 published Operator Precedence questions on grammar rules, precedence, associativity, parser facts, and expression trees, with fresh explanations.
Python Relational and Logical Operator MCQs: 10 Solved Questions
Solve 10 Python operator MCQs step by step. Trace precedence, truthiness, operand-return behaviour, Boolean arithmetic, equality, and invalid symbols.
Operator Precedence Parsing: Build the Table and Parse an Expression Step by Step
Build an operator-precedence table from a grammar, then use it to trace every shift and reduction for i+i*i.
Operator Precedence and Associativity in C: The Table, the Traps and Solved Output Questions
Parse C expressions before evaluating them, using a focused precedence ladder and worked output questions on increments, assignment and comma.





