Function output tracing PYQ part 2
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 6508 · 2021 · 1 mark(s)
What will be the output of the following code?
value = 50
def display(N):
global value
value = 25
if N%7==0:
value = value + N
else:
value = value - N
print(value, end="#")
display(20)
print(value)
a) 50#50
b) 50#5
c) 50#30
d) 5#50#
Functions and Modules → Arguments parameters and scope, Function output tracing
Included
ID 6515 · 2021 · 1 mark(s)
What will be the output of the following code?
x = 3
def myfunc():
global x
x+=2
print(x, end=' ')
print(x, end=' ')
myfunc()
print(x, end=' ')
a) 3 3 3
b) 3 4 5
c) 3 3 5
d) 3 5 5
Functions and Modules → Arguments parameters and scope, Function output tracing
Included
ID 6112 · 2023 · 2 mark(s)
Write the output of the code given below :
a =30
def call (x):
global a
if a%2==0:
x+=a
else:
x-=a
return x
x=20
print (call(35),end="#")
print (call(40),end="@")
Functions and Modules → Arguments parameters and scope, Function output tracing
Included
ID 6308 · 2023 · 2 mark(s)
(a) Write the output of the Python code given below :
g=0
def fun1(x,y):
global g
g=x+y
return g
def fun2 (m,n):
global g
g=m-n
return g
k=fun1 (2,3)
fun2 (k,7)
print (g)
Functions and Modules → Arguments parameters and scope, Function output tracing
Included
ID 6309 · 2023 · 2 mark(s)
(b) Write the output of the Python code given below :
a=15
def update (x):
global a
a=2
if x%2==0:
a*=x
else:
a//=x
a=a+5
print (a,end="$")
update (5)
print (a)
Functions and Modules → Arguments parameters and scope, Function output tracing
Included
ID 6622 · 2024 · 1 mark(s)
What will be the output of the following code?
c = 10
def add():
global c
c = c + 2
print(c,end='#')
add()
c=15
print(c,end='%')
a) 12%15#
b) 15#12%
c) 12#15%
d) 12%15#
Functions and Modules → Arguments parameters and scope, Function output tracing
Included
ID 6380 · 2025 · 1 mark(s)
What will be the output of the following code segment ?
a=5
def func_1(b=10):
global a
a=b–10
b+=a
print(a,b)
func_1(a)
(A) 0 5
(B) 5 0
(C) 0 –5
(D) –5 0
Functions and Modules → Arguments parameters and scope, Function output tracing
Included
ID 6672 · 2025 · 1 mark(s)
What will be the output of the following Python code?
i = 5
print(i,end='@@')
def add():
global i
i = i+7
print(i,end='##')
add()
print(i)
a) 5@@12##15
b) 5@@5##12
c) 5@@12##12
d) 12@@12##12
Functions and Modules → Arguments parameters and scope, Function output tracing
Included
ID 6409 · 2025 · 3 mark(s)
(a) Write the output on execution of the following Python code :
P=[3,5,7,4]
P.insert(2,3)
P.extend([10, 6])
print(P)
print(P.index(7))
print(P[::2])
Functions and Modules → Function output tracing
Included
ID 6410 · 2025 · 3 mark(s)
(b) Write the output on execution of the following Python code :
def ALTER(Y=25):
global X
Y += X
X += Y
print(X,Y,sep="#")
X=5; Y=15
ALTER(Y)
ALTER()
print(X,Y,sep="@")
Functions and Modules → Arguments parameters and scope, Function output tracing
Included
ID 6226 · 2026 · 1 mark(s)
What will be the output of the following code ?
def f1(a,b=1):
print(a+b,end='-')
c=f1(1,2)
print(c,sep='*')
(A) 3-2
(B) 3-2*
(C) 3-None
(D) 3*None-
Functions and Modules → Function output tracing
Included
ID 6258 · 2026 · 3 mark(s)
(b) Write the output of the following code :
def Exam2026(given) :
new = 0
while given:
if new % 2:
new += given % 10
else:
new += given % 5
print(new, end='-')
given //= 10
Exam2026(123456)