edited by
3,550 views
6 votes
6 votes

In the following procedure

Integer procedure P(X,Y);
Integer X,Y;
value x;
begin
      K=5;
      L=8;
      P=x+y;
end

$X$ is called by value and $Y$ is called by name. If the procedure were invoked by the following program fragment

K=0;
L=0;
Z=P(K,L);

then the value of $Z$ will be set equal to

  1. $5$
  2. $8$
  3. $13$
  4. $0$
edited by

1 Answer

4 votes
4 votes

X=call by value  hence we pass 0 ,

Y=call by name hence we pass expression or variable and evaluate every time

After passing the value as ‘0’ and name as ‘L’

P=0+L   // here L=8 ;

P=8; / return

Z=8

Answer  B

Answer:

Related questions

6 votes
6 votes
5 answers
2
Satbir asked Jan 13, 2020
3,711 views
What is the output of the code given below?# include<stdio.h int main() { char name[]="satellites"; int len; int size; len= strlen(name); size = sizeof(name); printf("%d"...
2 votes
2 votes
3 answers
3
Satbir asked Jan 13, 2020
1,785 views
Consider the following recursive C function that takes two argumentsunsigned int rer(unsigned int n, unsigned int r){ if(n>0)return(n%r + rer(n/r,r)); else retturn 0; }Wh...