Skip to content
Question 41 of 97

Q.Q. Nos. 20 and 21 are Assertion (A) and Reason (R) based questions. Mark the correct choice as : (A) Both Assertion (A) and Reason (R) are true and Reason (R) is the correct explanation for Assertion (A). (B) Both Assertion (A) and Reason (R) are true and Reason (R) is not the correct explanation for Assertion (A). (C) Assertion (A) is true, but Reason (R) is false. (D) Assertion (A) is false, but Reason (R) is true. Assertion (A) : [1,2,3]+'123' is an invalid expression in Python. Reason (R) : In Python, a list cannot be concatenated with a string.

Odisha ChseCBSE Class XII Board 2026MCQ· 1mImportance★★★★★
42% · 41/97 Questions
🔒 Locked · start free trial →

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 →

The expression [1,2,3]+'123' is invalid in Python because the + operator cannot directly concatenate a list with a string, which means both the assertion and reason are true, and the reason correctly explains the assertion.

In Python, the + operator is versatile, but its behavior depends entirely on the types of the operands it's working with. This concept is known as operator overloading. For example, + performs arithmetic addition for numbers, but for sequences like strings and lists, it performs concatenation. The crucial point is that for concatenation, Python generally requires the operands to be of compatible types. You can concatenate a string with a string, or a list with a list, but not a string with an integer, or a list with a string. This strict type checking prevents unexpected behavior and helps catch programming errors early.

Let's break down the given assertion and reason:

  1. Analyze Assertion (A): [1,2,3]+'123' is an invalid expression in Python.

    • Here, [1,2,3] is a list, and '123' is a string.
    • When the + operator is used with a list, Python expects the other operand to also be a list for concatenation. It does not perform implicit type conversion between lists and strings for this operation.
    • If you try to execute this expression in a Python interpreter, it will raise a TypeError:
      >>> [1,2,3] + '123'
      TypeError: can only concatenate list (not "str") to list
      
    • Since the expression causes a TypeError, it is indeed an invalid expression.
    • Therefore, Assertion (A) is True.
  2. Analyze Reason (R): In Python, a list cannot be concatenated with a string.

    • As discussed above, the + operator in Python does not support direct concatenation between a list and a string. They are distinct sequence types, and Python's type system enforces this separation for the + operator. …

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.