Test Index

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

© examsnet.com
Question : 9 of 37
Marks: +1, -0
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='*')
Solution:  
Explanation:
c=f1(1,2) → a = 1, b = 2 (the passed value replaces the default 1). The function prints a+b = 3 followed by end='-', so '3-' is printed and the cursor stays on the same line.
f1 has no return statement, so it returns None; hence c = None.
print(c,sep='*') prints None. sep is used only between two or more values; with one value it has no effect.
Output:
3-None
Key point: A function without return returns None, and sep does not print anything when only one value is printed.
Answer:
Option C (3-None)
© examsnet.com
Advertisements
Go to Question: