search
Log In

Recent questions tagged variable-binding

3 votes
3 answers
1
Consider the following psuedocode: x: integer := 1 y: integer := 2 procedure add x:= x + y procedure second (P: Procedure) x: integer := 2 p() procedure first y: integer := 3 second (add) first () write_integer(x) What does it print if the language uses dynamic scoping with deep binding? $2$ $3$ $4$ $5$
asked Apr 25, 2016 in Compiler Design makhdoom ghaya 5k views
7 votes
1 answer
3
Early binding refers to a binding performed at compile time and late binding refers to a binding performed at execution time. Consider the following statements: Static scope facilitates w1 bindings. Dynamic scope requires w2 bindings. Early bindings w3 execution efficiency ... , late, decrease, increase Late, early, increase, decrease Late, early, decrease, increase Early, late, increase, decrease
asked Oct 30, 2014 in Programming Ishrat Jahan 1.5k views
11 votes
4 answers
4
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 ... value printed under dynamic scoping. Then, x and y are: $x=10, y=20$ $x=20, y=10$ $x=10, y=10$ $x=20, y=20$
asked Oct 30, 2014 in Programming Ishrat Jahan 3.6k views
1 vote
1 answer
5
Consider the program below: Program main: var r:integer; procedure two: begin write (r); end procedure one: var r:integer; begin r:=5; two; end begin r:=2; two; one; two; end What is printed by the above program if Static scoping is assumed for all variables; Dynamic scoping is assumed for all variables. Give reasons for your answer.
asked Oct 6, 2014 in Programming Kathleen 817 views
6 votes
2 answers
6
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: 0.125 0.125 0.25 0.25 0.25 0.125 0.125 0.25
asked Sep 23, 2014 in Programming Kathleen 1.8k views
2 votes
3 answers
7
Consider the following class definitions in a hypothetical Object Oriented language that supports inheritance and uses dynamic binding. The language should not be assumed to be either Java or C++, though the syntax is similar. Class P { Class Q subclass of P { void f(int i) { void f(int i ... of y to P. The output produced by executing the above program fragment will be 1 2 1 2 1 1 2 1 2 2 2 2
asked Sep 17, 2014 in Programming Kathleen 2.5k views
To see more, click for the full list of questions or popular tags.
...