GATE DA 2025, Q.23: Concatenate in place
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)
- (A) A.extend(B)
- (B) A.append(B)
- (C) A.update(B)
- (D) A.insert(B)
Watch it solved
Solve it step by step
- extend. Adds each element of B to the end of A: [1, 2, 3, 4, 5, 6].
- append. Adds B as one element: [1, 2, 3, [4, 5, 6]].
- 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 sheetsSource: official GATE DA 2025 question paper and answer key (IIT Roorkee). The question is lightly reworded; every number and option is kept.