Skip to content
GATEiit

GATE DA 2025 Q23: Python lists: which call gives A = [1, 2, 3, 4, 5, 6]?

Question

Consider the following Python declarations of two lists.

A=[1,2,3]\texttt{A=[1,2,3]}

B=[4,5,6]\texttt{B=[4,5,6]}

Which one of the following statements results in A=[1,2,3,4,5,6]\texttt{A}= [1, 2, 3, 4, 5, 6]?

Try it: multiple choice: exactly one correct option

Select one option
Wrong answer costs 1/3 mark in GATE.
Show answer and explanation

Answer: A (official GATE 2025 final answer key)

Concept used: Python list methods: extend vs append.

First step: append\texttt{append} adds its argument as a single element (giving a nested list), lists have no update\texttt{update} method, and insert\texttt{insert} needs an index. Which method adds each element of B?

Full step-by-step solution

Detailed working, common mistakes and linked mock tests will be available with a free GATEiit account. Log-in is coming soon.

Share this question

WhatsAppDownload image

Source: official GATE 2025 DA question paper and final answer key, organised by IIT Roorkee. Question paper · Answer key