Gradient LabSign up free

Home / GATE DA / 2025 / Q.23

GATE DA 2025, Q.23: Concatenate in place

ProgrammingPython lists1 markMCQFree

The question

A = [1, 2, 3] and B = [4, 5, 6]. Which statement makes A = [1, 2, 3, 4, 5, 6]?

A = [1, 2, 3]
B = [4, 5, 6]
A.extend(B)
print(A)

Watch it solved

Solve it step by step

  1. extend. Adds each element of B to the end of A: [1, 2, 3, 4, 5, 6].
  2. append. Adds B as one element: [1, 2, 3, [4, 5, 6]].
  3. Others. Lists have no update method, and insert needs an index.

Answer: (A) A.extend(B)

Official IIT Roorkee answer key: A.

Common mistake. Using append, which nests the list.

Remember. extend adds items; append adds one object.

Want every question solved? The past-paper pack has all 195 questions from 2024, 2025 and 2026 for ₹499. The cheat sheet pack has 23 printable sheets for ₹399.

See the past-paper pack See the cheat sheets

Source: official GATE DA 2025 question paper and answer key (IIT Roorkee). The question is lightly reworded; every number and option is kept.