The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
+4 votes
724 views

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

 

asked in Programming by Veteran (59.4k points)
retagged by | 724 views

2 Answers

+11 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.
answered by Active (5.2k points)
selected by
0
Mam, can you explain what we mean by real data type?
0
Real data type used to represent Real numbers.
0
but sir is there any real keyword in c programming language practically?
0
Program given is in Pascal language, May be in Pascal there is keyword name real.

In c we use int, float, long int etc which are subset of real.

http://www.algorithmic-solutions.info/leda_manual/real.html
0
finding outputs of procedural language is still in syllabus?
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
so if it would ask for static scope

then c would be the answer ?

@bikram sir
0 votes

....

answered by Boss (12.6k points)
Answer:

Related questions



Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

35,487 questions
42,746 answers
121,458 comments
42,138 users