Q.Which of the following expressions in Python evaluates to True ? (A) 2>3 and 2<3 (B) 3>1 and 2 (C) 3>1 and 3>2 (D) 3>1 and 3<2
🔒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 →Concept understanding — Python Operators and Precedence
Python provides several kinds of operators: arithmetic (+, -, *, /, //, %, **), relational or comparison (==, !=, <, >, <=, >=), logical (and, or, not) and identity (is, is not). Operator precedence determines the order in which operators are evaluated in an expression, with exponentiation highest, followed by multiplication and division, then addition and subtraction, then comparisons, and log …
Rule: x and y returns x if x is falsy, otherwise it returns y — it only produces the boolean True when both operands are comparisons that are individually True.
| Option | Left | Right | Result |
|---|---|---|---|
(A) 2>3 and 2<3 | False | (skipped) | False |
(B) 3>1 and 2 | True | 2 | 2 — truthy, but not True |
(C) 3>1 and 3>2 | True | True | True |
Python's and returns its first falsy operand, or the second operand when the first is truthy. Only (C) 3>1 and 3>2 joins two True comparisons, so only (C) evaluates to the boolean True.
Concept — how and really works
x and y in Python does not always return a boolean:
- If
xis falsy (False,0,None, empty containers), it returnsximmediately — the right side is never evaluated (short-circuit). - If
xis truthy, it returnsy— whatever valueyis.
A comparison such as 3>1 always evaluates to a real boolean (True/False), so an and of two comparisons yields a boolean. But an and whose right operand is a plain number returns that number, not True.
Evaluating each option
| Option | Step 1 (left) | Step 2 (right) | Final value |
|---|---|---|---|
(A) 2>3 and 2<3 | 2>3 is False | skipped (short-circuit) | False |
(B) 3>1 and 2 | 3>1 is True | returns 2 itself | 2 (truthy, but not True) |
(C) 3>1 and 3>2 | 3>1 is True | 3>2 is True | True |
(D) 3>1 and 3<2 | 3>1 is True | 3<2 is False | False |
Why each wrong option fails:
- (A) — the left comparison
2>3is alreadyFalse, so the whole expression isFalse. …
- CBSE 2026Set 91/41 markMCQQ.Which of the following expressions in Python evaluates to True ? (A) 2>3 and 2<3 (B) 3>1 and 2 (C) 3>1 and 3>2 (D) 3>1 and 3<2
›Reveal solutionSolution
Python's
andreturns its first falsy operand, or the second operand when the first is truthy. Only (C)3>1 and 3>2joins twoTruecomparisons, so only (C) evaluates to the booleanTrue.Concept — how
andreally worksx and yin Python does not always return a boolean:- If
xis falsy (False,0,None, empty containers), it returnsximmediately — the right side is never evaluated (short-circuit). - If
xis truthy, it returnsy— whatever valueyis.
A comparison such as
3>1always evaluates to a real boolean (True/False), so anandof two comparisons yields a boolean. But anandwhose right operand is a plain number returns that number, notTrue.Evaluating each option
Option Step 1 (left) Step 2 (right) Final value (A) 2>3 and 2<32>3isFalseskipped (short-circuit) False(B) 3>1 and 23>1isTruereturns 2itself2(truthy, but notTrue)(C) 3>1 and 3>23>1isTrue3>2isTrueTrue(D) 3>1 and 3<23>1isTrue3<2isFalseFalseWhy each wrong option fails:
- (A) — the left comparison
2>3is alreadyFalse, so the whole expression isFalse. …
- If
- CBSE 2025Set 91/41 markMCQQ.What will be the output of the following statement?
(A) 16 (B) 64 (C) 20 (D) 256print(14%3**2*4)›Reveal solutionSolution
The expression
14%3**2*4is evaluated using Python's operator precedence: exponentiation first, then modulo and multiplication left to right, giving 20 — option (C).When evaluating an expression like
14%3**2*4in Python, the order of operations is decided by operator precedence, which is similar to BODMAS/PEMDAS but tailored to Python's operators.For the operators here:
**(exponentiation) has the highest precedence.*(multiplication) and%(modulo) share the same, lower precedence.- Operators of equal precedence are evaluated left to right.
Let's break it down step by step.
-
Exponentiation (
**) first.3**2means 3 raised to the power 2, i.e. 3 x 3 = 9. The expression becomes14 % 9 * 4. -
Modulo (
%) and multiplication (*), left to right. Both have equal precedence, so we go left to right. …
- CBSE 2025Set 91/41 markMCQQ.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) is (B) is not (C) and (D) or
›Reveal solutionSolution
The
isoperator in Python checks if two variables reference the exact same memory object (identity), not just equal values. The correct answer is (A) is.The question tests your understanding of Python’s identity operators —
isandis not. These are different from equality operators (==and!=). While==compares the value of two objects,iscompares their identity — that is, whether they are the same object in memory.Think of it like two people with identical names.
==asks “Do they have the same name?” — yes, they do.isasks “Are they the same person?” — no, they are two different individuals. In Python, two variables can hold equal values but point to different memory locations (e.g., two separate lists with the same elements). Theisoperator returnsTrueonly when both variables refer to the exact same object.Now let’s go through the options:
-
Option (A):
isThis operator evaluates to
Trueif the two operands refer to the same memory location (same object). For example:a = [1, 2, 3] b = a print(a is b) # True — both point to the same list objectThis matches the description in the question exactly.
-
Option (B):
is notThis is the negation of
is. It returnsTrueif the operands point to different memory locations. So it does the opposite of what the question asks. -
Option (C):
andThis is a logical operator that returns
Trueonly if both operands are truthy. It has nothing to do with memory location. -
Option (D):
or…
-
- CBSE 2024Set 91/41 markMCQQ.What will be the output of the following statement: print(165/42/5-8) (A) -3.33 (B) 6.0 (C) 0.0 (D) -13.33
›Reveal solutionSolution
*and/have equal precedence and are evaluated left to right; true division (/) always returns a float in Python 3. The chain collapses 16*5 → 80, /4 → 20.0, *2 → 40.0, /5 → 8.0, −8 → 0.0 — option (C).Concept — precedence and associativity
In Python,
*and/share the same precedence level and are left-associative: with no parentheses, the interpreter simply works through them in the order they appear.-(subtraction) has lower precedence, so it is applied last. One more Python-3 fact decides the form of the answer: the/operator performs true division and always returns a float, so the final result is0.0, not the integer0.Step-by-step evaluation
Expression:
16*5/4*2/5-8Step Operation Result Expression remaining 1 16 * 58080/4*2/5-82 80 / 420.0(float —/divides truly)20.0*2/5-83 20.0 * 240.040.0/5-84 40.0 / 58.08.0-85 8.0 - 80.0done Runnable check:
print(16*5/4*2/5-8)Expected output:
0.0Why the other options are wrong …
- CBSE 2023Set 91/11 markMCQQ.Consider the given expression: 5<10 and 12>7 or not 7>4 Which of the following will be the correct output, if the given expression is evaluated?(a) True(b) False(c) NONE(d) NULL
›Reveal solutionSolution
5<10 and 12>7 or not 7>4groups as((5<10) and (12>7)) or (not (7>4))=True or False= True. Correct option: (a) True.Concept — logical-operator precedence in Python
Among Python's logical operators the precedence order is:
not(highest) →and→or(lowest), and all comparison operators (<,>) bind tighter than any of them. So the expression is implicitly bracketed as:((5 < 10) and (12 > 7)) or (not (7 > 4))Step-by-step trace
Step Evaluates Result Expression so far 1 5 < 10TrueTrue and 12>7 or not 7>42 12 > 7TrueTrue and True or not 7>43 7 > 4TrueTrue and True or not True4 not True(not first)FalseTrue and True or False5 True and True(and next)TrueTrue or False6 True or False(or last)TrueTrueRun it:
print(5<10 and 12>7 or not 7>4)Output:
True(Short-circuit view: the left side of the
oris alreadyTrue, so the whole expression isTrueno matter whatnot 7>4gives.)Why the other options are wrong …
- CBSE 2023Set 91/11 markMCQQ.Which of the following operators will return either True or False?(a) +=(b) !=(c) =(d) *=
›Reveal solutionSolution
The
!=operator is a comparison operator that checks for inequality and returns eitherTrueorFalse.Concept and Intuition
In programming, operators perform operations on variables and values. These operations can broadly be categorized by what they do and what type of result they produce. Some operators perform assignments, changing the value of a variable. Others perform calculations. Crucially, a specific category of operators, known as comparison operators (or relational operators), are designed to evaluate a relationship between two values and always return a boolean result:
Trueif the relationship holds, andFalseotherwise.The question asks which operator returns
TrueorFalse. This immediately points us towards comparison operators, as they are the only ones whose direct output is a boolean value. Assignment operators, on the other hand, primarily perform a side effect (changing a variable's value) and do not return a boolean.Step-by-step Analysis
Let's examine each option:
-
(a) +=(Augmented Assignment Operator)- This is an augmented assignment operator. It combines an arithmetic operation (addition) with an assignment.
- For example,
x += 5is equivalent tox = x + 5. - Its purpose is to update the value of the variable
x. It does not return a boolean value. The expression itself evaluates toNonein many contexts, but its primary effect is the assignment.
-
(b) !=(Comparison Operator: Not Equal To)- This is a comparison operator that checks if two values are not equal.
- For example,
5 != 3would returnTrue, while5 != 5would returnFalse. - Comparison operators, by definition, evaluate to a boolean value (
TrueorFalse) based on the comparison. This matches the requirement of the question.
Comparison operators like
==,!=,<,>,<=,>=always return a boolean value. -
(c) =(Assignment Operator) …
-
- CBSE 2023Set 91/11 markMCQQ.What will the following expression be evaluated to in Python? print(4+3*5/3-5%2)(a) 8.5(b) 8.0(c) 10.2(d) 10.0
›Reveal solutionSolution
Python evaluates
4 + 3 * 5 / 3 - 5 % 2using operator precedence:*,/,%first (left to right), then+,-(left to right). The result is 8.0, so the answer is (b).When Python evaluates an arithmetic expression it does not simply read left to right — it follows operator precedence (which operations happen first) and associativity (the order among operators of equal precedence). This is the same BODMAS/PEMDAS idea from mathematics.
The operators here rank as follows:
Operator Meaning Precedence Associativity *Multiplication Higher Left to right /Division Higher Left to right %Modulo (remainder) Higher Left to right +Addition Lower Left to right -Subtraction Lower Left to right *,/and%share the same (higher) precedence, so they run left to right first; then+and-run left to right.Step by step for
4 + 3 * 5 / 3 - 5 % 2:3 * 5=15→4 + 15 / 3 - 5 % 2…
- CBSE 2023Set 91/41 markMCQQ.Consider the given expression : 7<4 or 6>3 and not 10==10 or 17>4 Which of the following will be the correct output if the given expression is evaluated ?(a) True(b) False(c) NONE(d) NULL
›Reveal solutionSolution
Evaluate the boolean expression left-to-right respecting operator precedence:
notbinds tightest, thenand, thenor. The expression evaluates to True.This is a question about operator precedence in boolean logic, exactly as implemented in most programming languages (Python, C, Java). You need to know which operators "grab" their operands first.
The precedence hierarchy for logical operators is:
not(highest - unary, binds to the immediate right)and(middle - binary)or(lowest - binary)
Think of it like arithmetic:
notbehaves like exponentiation,andlike multiplication, andorlike addition. Just as2 + 3 * 4means2 + (3 * 4), the expressionA or B and CmeansA or (B and C).Let me parse the given expression step by step.
Given:
7<4 or 6>3 and not 10==10 or 17>4-
Evaluate all comparison operators first (they have higher precedence than logical operators):
7 < 4->False6 > 3->True10 == 10->True17 > 4->True
So the expression becomes:
False or True and not True or True -
Apply
not(highest precedence among logical operators):not True->False
Now we have:
False or True and False or True -
Apply
and(next precedence):The
andoperator sits betweenTrueandFalse:True and False->False…
- CBSE 2023Set 91/41 markMCQQ.Which of the following is an example of identity operators of Python ?(a) is(b) on(c) in(d) not in
›Reveal solutionSolution
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 (
isandis 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 == bcould beTrueeven whena is bisFalse, because Python might create two separate objects with the same value.The other operators listed —
inandnot in— are membership operators, not identity operators. They check whether a value exists inside a container (like a list, string, or tuple). The optiononis not a Python operator at all.Watch outA very common mistake is confusing
is(identity) with==(equality). For small integers and short strings, Python sometimes reuses objects (interning), soa is bmight accidentally beTrue— but you should never rely on this. Always use==to compare values andisonly 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)
-
- CBSE 2023Set 91/41 markMCQQ.What will the following expression be evaluated to in Python ? print(6/3 + 4**3//8-4)(a) 6.5(b) 4.0(c) 6.0(d) 4
›Reveal solutionSolution
6/3 + 4**3//8 - 4evaluates as2.0 + 8 - 4 = 6.0— a float, because/in Python 3 always returns a float. Correct option: (c) 6.0.Concept — precedence and result types
Two rules decide this question:
- Precedence:
**(exponent) binds tightest; then/and//(evaluated left to right);+and-come last. - Types: true division
/always returns afloatin Python 3 (6/3is2.0, not2), while//between two ints returns anint. Any arithmetic mixing a float with an int produces a float.
Step-by-step trace
Step Sub-expression evaluated Result Expression so far 1 4**3(highest precedence)646/3 + 64//8 - 42 6/3(leftmost of/,//)2.0(float!)2.0 + 64//8 - 43 64//88(int)2.0 + 8 - 44 2.0 + 810.010.0 - 45 10.0 - 46.06.0Run it:
print(6/3 + 4**3//8-4)Output:
6.0Why the other options are wrong …
- Precedence:
🎓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.