Check sibling questions
Computer Science - Class 12
Solutions to CBSE Sample Paper - Computer Science Class 12

(a) Write the output of the code given below:


def sum(q,r=2):

global p


print(p, end= '#')








Question 32(Choice 1)(a) -Teachoo.png

Output: 105#6#


In the first function call, a and b are passed as parameters. This assigns ‘q’ the value 10 and ‘r’ the value 5. This gives p the value 105 and it is printed with a ‘#’ after.

In the second function call, ‘q’ is assigned the value 1 and ‘r’ is assigned the value 5. This gives p the value 6. 

Now the output will be: 105#6#

Learn in your speed, with individual attention - Teachoo Maths 1-on-1 Class

Ask a doubt
Davneet Singh's photo - Co-founder, Teachoo

Made by

Davneet Singh

Davneet Singh has done his B.Tech from Indian Institute of Technology, Kanpur. He has been teaching from the past 13 years. He provides courses for Maths, Science, Social Science, Physics, Chemistry, Computer Science at Teachoo.