The GATE Grind

GATE Programming, Data Structures and Algorithms: Programming in Python – Previous Year Questions

10 GATE previous year questions on Programming in Python (Programming, Data Structures and Algorithms, Data Science and Artificial Intelligence) with answers and explanations, from every paper.

  1. GATE 2024 DA Q38 (2 marks, Multiple choice) – Consider the following Python code: Which ONE of the following is the output of this code?
  2. GATE 2024 DA Q39 (2 marks, Multiple choice) – Consider the function computeS(X) whose pseudocode is given below: Which ONE of the following values is returned by the function computeS(X) for X =…
  3. GATE 2024 DA Q41 (2 marks, Multiple choice) – Consider the following Python function: What does this Python function fun() do? Select the ONE appropriate option below.
  4. GATE 2025 DA Q23 (1 mark, Multiple choice) – Consider the following Python declarations of two lists. Which one of the following statements results in A= [1, 2, 3, 4, 5, 6]?
  5. GATE 2025 DA Q47 (2 marks, Multiple choice) – Consider the following Python code snippet. When the above program is executed, at the end, which of the following sets contains "this"?
  6. GATE 2025 DA Q63 (2 marks, Numerical answer) – Consider the following Python code snippet. The value printed by the code snippet is (*Answer in integer*)
  7. GATE 2026 DA Q16 (1 mark, Multiple choice) – Consider the given Python program. Which of the following is the correct output of this program?
  8. GATE 2026 DA Q39 (2 marks, Multiple choice) – A recursive function in Python is given. Now, consider the following function call: Assume that a typical runtime stack is used to manage function…
  9. GATE 2026 DA Q50 (2 marks, Multiple select) – Consider the given Python program. Which of the following options is/are correct?
  10. GATE 2026 DA Q58 (2 marks, Numerical answer) – Consider the given Python program. The output of the program is . (*Answer in integer*)