The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
+3 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

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 (69k points)
retagged by | 640 views

2 Answers

+10 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 Boss (5.1k points)
selected by
Mam, can you explain what we mean by real data type?
Real data type used to represent Real numbers.
but sir is there any real keyword in c programming language practically?
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.
finding outputs of procedural language is still in syllabus?

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.

so if it would ask for static scope

then c would be the answer ?

@bikram sir
0 votes


answered by Veteran (17k points)

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

33,593 questions
40,128 answers
38,389 users