A directory of Objective Type Questions covering all the Computer Science subjects. Here you can access and discuss Multiple choice questions and answers for various compitative exams and interviews.

Discussion Forum

Que. Consider the program below in a hypothetical programming language which allows global variables and a choice of static or dynamic scoping
 
int i;
program Main( )
{
i = 10;
call f ( );
}
procedure f( )
{
int i = 20;
call g ( );
}
procedure g( )
{
print i;
}

Let x be the value printed under static scoping and y be the value printed under dynamic scoping. Then x and y are
a. x = 10, y = 20
b. x = 20, y = 10
c. x = 20, y = 20
d. x = 10, y = 10
Answer:x = 10, y = 10
thirupathi :(March 12, 2019) i have doubt how its come this answers
Click to Add Comment

Confused About the Answer? Ask for Details Here
Know Explanation? Add it Here

Similar Questions: