551 views

1 Answer

0 votes
0 votes
In call by name, parameter is evaluated when it is used, not when the function is called. Hence every time in function P, a,b and c will refer to y,x and x respectively. However x is a local variable of P so x in function P will be value of 3.

In line b = b+x+6, b will refer to global variable x that will be equal to 5+3+6 = 14

In the next line c = c+a, again the value of global variable x will be equal to 14+10 = 24

So, finally value of x has become 24, whereas the value of y remains as it is that is 10.

Related questions

1.1k
views
0 answers
0 votes
Prince Sindhiya asked Dec 21, 2018
1,070 views
i am getting 12 please check it
567
views
1 answers
0 votes
DAWID15 asked Dec 23, 2022
567 views
What should be the answer?
559
views
0 answers
0 votes
Prince Sindhiya asked Dec 21, 2018
559 views
i have not read lvalue is it there in syllabus and how to do this