The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
+4 votes
900 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.7k points)
retagged by | 900 views

2 Answers

+13 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 Loyal (5.3k 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
+3 votes

....

answered by Boss (13.4k points)
Answer:

Related questions

+6 votes
2 answers
7


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

44,255 questions
49,750 answers
164,116 comments
65,848 users