Python Programming
10 past exam problems with worked solutions.
Practise them on GATE DA →
Programming in Python
- GATE DA 2024: Consider the following Python code: def count(child_dict, i): if i not in child_dict.keys(): return 1 ans = 1 for j in…
- GATE DA 2025: Consider the following Python code snippet. A="this","that" B="that","other" C="other","this" while "other" in C: if…
- GATE DA 2025: Consider the following Python code snippet. def f(a,b): if (a==0): return b if (a%2==1): return 2*f((a-1)/2,b) return…
- GATE DA 2026: Consider the given Python program. def append_to_lst(val, lst=[]): lst.append(val) return lst print(append_to_lst(1))…
- GATE DA 2026: Consider the given Python program. def outer(): x = [] def inner(val): x.append(val) return x return inner f1 =…
- Curated: Consider the following program written in pseudo-code. Assume that x and y are integers. Count(x, y) if (y!= 1) if…
- GATE DA 2024: Consider the function computeS(X) whose pseudocode is given below: underlinecomputeS(X) S[1] ← 1 for i ← 2 to…
- GATE DA 2024: Consider the following Python function: def fun(D, s1, s2): if s1 < s2: D[s1], D[s2] = D[s2], D[s1] fun(D, s1 + 1, s2…
- GATE DA 2025: Consider the following Python declarations of two lists: A = [1, 2, 3], B = [4, 5, 6] Which one of the following…
- GATE DA 2026: A recursive function in Python is given. def mystery(n): if n <= 0: return 1 return mystery(n - 1) + mystery(n - 2)…
GATE DA practice: past exam problems by chapter, with worked solutions · gatedaprep.com