in Programming retagged by
4,478 views
6 votes
6 votes

Consider the following program in a language that has dynamic scooping:

var x: real;
procedure show:
    begin print(x);end;
procedure small;
    var x: real;
        begin x: = 0.125; show; end;
begin x:=0.25
    show; small
    end.

Then the output of the program is:

  1. 0.125 0.125
  2. 0.25 0.25
  3. 0.25 0.125
  4. 0.125 0.25
in Programming retagged by
4.5k views

2 Answers

17 votes
17 votes
Best answer
ans c)

In dynamic scoping, if a variable is not found in the local scope it is looked up on at the function from which the call is made.
selected by

4 Comments

finding outputs of procedural language is still in syllabus?
0
0

Its answer should be option: "b: .25 .25" because x is also declared in procedure small hence scope of variable x = .125 will be limited to procedure small only.

0
0
so if it would ask for static scope

then c would be the answer ?

@bikram sir
0
0
6 votes
6 votes

....

Answer:

Related questions