CBSE Class 12 Computer Science Question 45 of 101

Functions — Question 13

Back to all questions
13
Question

Question 13(i)

What will be the output of the following program?

num = 1
def myfunc() :
    return num
print (num) 
print (myfunc())
print (num)
Answer
Output
1
1
1
Working

The code initializes a global variable num with 1. myfunc just returns this global variable. Hence, all the three print statements print 1.