Test Index

CBSE Class 12 Computer Science 2025 Paper Set 4 Get it on Google PlayDownload on the App Store

© examsnet.com
Question : 10 of 37
Marks: +1, -0
Consider the statements given below and then choose the correct output from the given options :
def Change(N):
N=N+10
print(N,end='$$')
N=15
Change(N)
print(N)
Solution:  
Concept:
A parameter is a local variable of the function. Assigning a new value to it inside the function does not change the global variable with the same name (integers are immutable).
Explanation:
Global N = 15. Change(N) passes 15; inside, local N = 15 + 10 = 25 and print(N,end='$$') prints 25$$ without a new line.
Back in the main program, the global N is still 15, so print(N) prints 15.
Output:
25$$15
Answer:
Option A (25$$15)
© examsnet.com
Advertisements
Go to Question: