My Cart
Your Cart 0

    Your cart is empty.

  • Total (Amount) ₹0.00
Previous year question hub

Python Programming and Data Structures - Programming, Data Structures and Algorithms - Data Science & Artificial Intelligence Previous Year Questions

Practice Python Programming and Data Structures - Programming, Data Structures and Algorithms - Data Science & Artificial Intelligence previous year questions organised from real papers, with year-wise coverage and clear topic navigation.

3Papers
3Years
13Questions
1Topics

Python Programming and Data Structures question pattern

Every graph below is calculated only from this selection.

Questions by year

Year-wise coverage for Python Programming and Data Structures. Each bar uses a separate theme-derived color.

Difficulty distribution

How the classified questions are distributed by difficulty.

Easy 6 46.2%
Medium 6 46.2%
Hard 1 7.7%

Question type distribution

MCQ, numerical, multiple-select and other formats found in these papers.

MCQ 7 53.8%
Numerical Answer Type (NAT) 4 30.8%
MSQ 2 15.4%

Subject weightage

Top subjects by unique question coverage.

Data Science & Artificial Intelligence
13 Qs

Most asked topics

Top topics across the included previous year papers.

Programming, Data Structures and Algorithms
13 Qs

Subtopic coverage

Top subtopics inside this exact selection.

Python Programming and Data Structures
13 Qs

Paper coverage

Question coverage for the most populated papers. Every active PYP paper remains listed below.

Data Science and Artificial Intelligence (DA) 2026
4 Qs
Data Science & Artificial Intelligence (DA) 2025
4 Qs
Data Science & Artificial Intelligence (DA) 2024
5 Qs

Included previous year papers

Newest papers appear first. Sort by year, question coverage or name.

PaperYear / sessionQuestions in this viewOpen
Data Science and Artificial Intelligence (DA) 202620264View paper
Data Science & Artificial Intelligence (DA) 202520254View paper
Data Science & Artificial Intelligence (DA) 202420245View paper

All Python Programming and Data Structures previous year questions

Practice every matching question in batches of 20, with every available option.

1
2024 · Data Science & Artificial Intelligence · Programming, Data Structures and Algorithms · Python Programming and Data Structures
Data Science & Artificial Intelligence (DA) 2024
The fundamental operations in a double-ended queue D are:
insertFirst(e) – Insert a new element e at the beginning of D.
insertLast(e) – Insert a new element e at the end of D.
removeFirst() – Remove and return the first element of D.
removeLast() – Remove and return the last element of D.
In an empty double-ended queue, the following operations are performed:
insertFirst(10)
insertLast(32)
a ← removeFirst()
insertLast(28)
insertLast(17)
a ← removeFirst()
a ← removeLast()
The value of a is ______.
Open complete paper
2
2024 · Data Science & Artificial Intelligence · Programming, Data Structures and Algorithms · Python Programming and Data Structures
Data Science & Artificial Intelligence (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 child_dict[i]: ans += count(child_dict, j) return ans child_dict = dict() child_dict[0] = [1,2] child_dict[1] = [3,4,5] child_dict[2] = [6,7,8] print(count(child_dict, 0))
Which ONE of the following is the output of this code?
Open complete paper
3
2024 · Data Science & Artificial Intelligence · Programming, Data Structures and Algorithms · Python Programming and Data Structures
Data Science & Artificial Intelligence (DA) 2024
Consider the function \(\text{computeS}(X)\) whose pseudocode is given below:
computeS(X) S[1] ← 1 for i ← 2 to length(X) S[i] ← 1 if X[i-1] ≤ X[i] S[i] ← S[i] + S[i-1] end if end for return S
Which ONE of the following values is returned by the function \(\text{computeS}(X)\) for \(X = [6, 3, 5, 4, 10]\)?
Open complete paper
4
2024 · Data Science & Artificial Intelligence · Programming, Data Structures and Algorithms · Python Programming and Data Structures
Data Science & Artificial Intelligence (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-1)
What does this Python function fun() do? Select the ONE appropriate option below.
Open complete paper
5
2024 · Data Science & Artificial Intelligence · Programming, Data Structures and Algorithms · Python Programming and Data Structures
Data Science & Artificial Intelligence (DA) 2024
Let \( H, I, L \), and \( N \) represent height, number of internal nodes, number of leaf nodes, and the total number of nodes respectively in a rooted binary tree.
Which of the following statements is/are always TRUE?
Open complete paper
6
2025 · Data Science & Artificial Intelligence · Programming, Data Structures and Algorithms · Python Programming and Data Structures
Data Science & Artificial Intelligence (DA) 2025
Consider the following Python declarations of two lists.
A = [1, 2, 3]
B = [4, 5, 6]
Which one of the following statements results in A = [1, 2, 3, 4, 5, 6]?
Open complete paper
7
2025 · Data Science & Artificial Intelligence · Programming, Data Structures and Algorithms · Python Programming and Data Structures
Data Science & Artificial Intelligence (DA) 2025
Consider the following Python code snippet.

A={"this","that"}
B={"that","other"}
C={"other","this"}
while "other" in C:
    if "this" in A:
        A,B,C=A-B,B-C,C-A
    if "that" in B:
        A,B,C=C|A,A|B,B|C
When the above program is executed, at the end, which of the following sets contains "this"?
Open complete paper
8
2025 · Data Science & Artificial Intelligence · Programming, Data Structures and Algorithms · Python Programming and Data Structures
Data Science & Artificial Intelligence (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 b+f(a-1,b)
print(f(15,10))The value printed by the code snippet is __________(Answer in integer)
Open complete paper
9
2025 · Data Science & Artificial Intelligence · Programming, Data Structures and Algorithms · Python Programming and Data Structures
Data Science & Artificial Intelligence (DA) 2025
Consider the following pseudocode.
Create empty stack S
Set x=0, flag=0, sum=0
Push x onto S
while (S is not empty) {
if (flag equals 0) {
Set x = x+1
Push x onto S}
if (x equals 8) :
Set flag=1
if (flag equals 1) {
x = Pop(S)
if (x is odd) :
Pop(S)
Set sum = sum + x}
}
Output sumThe value of sum output by a program executing the above pseudocode is _________(Answer in integer)
Open complete paper
10
2026 · Data Science & Artificial Intelligence · Programming, Data Structures and Algorithms · Python Programming and Data Structures
Data Science and Artificial Intelligence (DA) 2026
Consider the given Python program.

def append_to_lst(val, lst=[]):
    lst.append(val)
    return lst
print(append_to_lst(1))
print(append_to_lst(2))
print(append_to_lst(3, []))

Which of the following is the correct output of this program?
Open complete paper
11
2026 · Data Science & Artificial Intelligence · Programming, Data Structures and Algorithms · Python Programming and Data Structures
Data Science and Artificial Intelligence (DA) 2026
A recursive function in Python is given.
def mystery(n):
if n <= 0:
return 1
else:
return mystery(n-1) + mystery(n-2)Now, consider the following function call:
mystery(4)
Assume that a typical runtime stack is used to manage function calls. Each function call is pushed onto the stack and removed only after it finishes execution.
Which of the following options denotes the total number of function calls (i.e., the total number of stack activations), including the initial call, to compute mystery(4)?
Open complete paper
12
2026 · Data Science & Artificial Intelligence · Programming, Data Structures and Algorithms · Python Programming and Data Structures
Data Science and Artificial Intelligence (DA) 2026
Consider the given Python program.
def outer():
    x = []
    def inner(val):
        x.append(val)
    return x
    return inner
f1 = outer()
f2 = outer()
print(f1(10))    # Line P
print(f1(20))    # Line Q
print(f2(30))    # Line R
print(f1(40))    # Line S
Which of the following options is/are correct?

Question diagram

Open complete paper
13
2026 · Data Science & Artificial Intelligence · Programming, Data Structures and Algorithms · Python Programming and Data Structures
Data Science and Artificial Intelligence (DA) 2026
Consider the given Python program.

def fun(L, i=0):
if i >= len(L)-1:
return 0
if L[i] > L[i+1]:
L[i+1], L[i] = L[i], L[i+1]
return 1+fun(L, i+1)
else:
return fun(L, i+1)

data = [5, 3, 4, 1, 2]
count = 0
for _ in range(len(data)):
count += fun(data)
print(count)

The output of the program is __________ . (Answer in integer)
Open complete paper