What will be output of following code in different scoping and calling convention?

29 views Asked by At

int a = 2;
void f(int b){
b = b*a;
a = a-b;
}

void main(){
int a = 10;
f(a);
print a;
}

a) Call-By-Value and Lexical Scoping
b) Call-By-Value and Dynamic Scoping
c) Call-By-Reference and Lexical Scoping
d) Call-By-Reference and Dynamic Scoping

My answer :
a) 10
b) 10
c) 20
d) 100

Please suggest me if i am doing something wrong ?

0

There are 0 answers