CBSE Class 12 Computer Science
Question 70 of 103
Working with Functions — Question 3
Back to all questions300 @ 200
300 @ 100
120 @ 100
300 @ 120
- Function Call is defined with two parameters
PandQwith default values 40 and 20 respectively. - Inside the function Call,
Pis reassigned to the sum of its original valuePand the value ofQ. Qis reassigned to the difference between the new value ofPand the original value ofQ.- Prints the current values of
PandQseparated by @. - The function returns the final value of
P. - Two variables
RandSare initialized with values 200 and 100 respectively. - The function Call is called with arguments
RandS, which are 200 and 100 respectively. Inside the function,Pbecomes 200 + 100 = 300 andQbecomes 300 - 100 = 200. So, 300 and 200 are printed. The function returns 300, which is then assigned toR. Therefore,Rbecomes 300. S = Call(S)— The function Call is called with only one argumentS, which is 100. Since the default value ofQis 20,Pbecomes 100 + 20 = 120, andQbecomes 120 - 20 = 100. So, 120 and 100 are printed. The function returns 120, which is then assigned toS. Therefore,Sbecomes 120.