Function output tracing PYQ part 1
PYQ PRACTICE SCOPE: Function output tracing.
Concept ID: U1_FUNCTION_OUTPUT_TRACE.
Use only previous-year questions whose concept_ids include U1_FUNCTION_OUTPUT_TRACE.
Key things we'll cover
Function output tracing
PYQ references used by both prompts12 included0 excluded
Flagged questions are excluded from both Study Notes and PPT references until corrected in Paper Analyzer.
Included
ID 6505 · 2021 · 1 mark(s)
What will be the output of the following Python code?
def add(num1, num2):
sum = num1 + num2
sum = add(20,30)
print(sum)
a) 50
b) 0
c) Null
d) None
Functions and Modules → Function output tracing
Included
ID 6507 · 2021 · 1 mark(s)
What will be the output of the following code?
def my_func(var1=100, var2=200):
var1+=10
var2 = var2 - 10
return var1+var2
print(my_func(50),my_func())
a) 100 200
b) 150 300
c) 250 75
d) 250 300
Functions and Modules → Function output tracing
Included
ID 6551 · 2022 · 2 mark(s)
Predict the output of the Python code given below:
def Diff(N1,N2):
if N1>N2:
return N1-N2
else:
return N2-N1
NUM= [10,23,14,54,32]
for CNT in range(4,0,-1):
A=NUM[CNT]
B=NUM[CNT-1]
print(Diff(A,B),'#', end=' ')
Functions and Modules → Function output tracing
Included
ID 6552 · 2022 · 2 mark(s)
Predict the output of the Python code given below:
tuple1 = (11, 22, 33, 44, 55, 66)
list1 =list(tuple1)
new_list = []
for i in list1:
if i%2==0:
new_list.append(i)
new_tuple = tuple(new_list)
print(new_tuple)
Functions and Modules → Function output tracing
Included
ID 6111 · 2023 · 2 mark(s)
(a) Write the output of the code given below :
def short_sub (lst,n):
for i in range (0,n):
if len (lst[i])>4:
lst [i]=lst [i]+lst[i]
else:
lst [i]=lst[i][1]
subject=['CS', 'HINDI', 'PHYSICS', 'CHEMISTRY', 'MATHS']
short_sub(subject,5)
print (subject)
Functions and Modules → Function output tracing
Included
ID 6597 · 2023 · 2 mark(s)
Predict the output of the following code:
def Changer(P,Q=10):
P=P/Q
Q=P%Q
return P
A=200
B=20
A=Changer(A,B)
print(A,B, sep='$')
B=Changer(B)
print(A,B, sep='$', end='###')
Functions and Modules → Function output tracing
Included
ID 6338 · 2024 · 1 mark(s)
What will be the output of the given code ?
a=10
def convert(b=20):
a=30
c=a+b
print(a,c)
convert(30)
print(a)
Functions and Modules → Function output tracing
Included
ID 6152 · 2024 · 2 mark(s)
Write the output of the following Python code:
def Mycode(a,b=10):
c=a+b
a=c-2*b
print(a,b,c,sep="#")
Mycode(b=3,a=5)
Functions and Modules → Function output tracing
Included
ID 6355 · 2024 · 2 mark(s)
Predict the output of the following code :
def Total (Num=10):
Sum=0
for C in range(1,Num+1):
if C%2!=0:
continue
Sum+=C
return Sum
print(Total(4),end="$")
print(Total(),sep="@")
Functions and Modules → Function output tracing
Included
ID 6650 · 2024 · 3 mark(s)
Predict the output of the following code:
d = {"apple": 15, "banana": 7, "cherry": 9}
str1 = ""
for key in d:
str1 = str1 + str(d[key]) + "@" + "\n"
str2 = str1[:-1]
print(str2)
Functions and Modules → Function output tracing
Included
ID 6651 · 2024 · 3 mark(s)
Predict the output of the following code:
line=[4,9,12,6,20]
for I in line:
for j in range(1,I%5):
print(j,'#',end="")
print()
Functions and Modules → Function output tracing
Included
ID 6194 · 2025 · 2 mark(s)
Write the output of the following Python code:
def Newdict(dict1):
dict1['R']='S01'
dict1['T']='S02'
print(dict1)
dict1={'P':10,'Q':20}
Newdict(dict1)
print(dict1)