Static vs Dynamic Binding MCQs: 11 Solved Questions on Scope, Aliasing and Dispatch
Solve 11 binding questions from GATE and UGC NET papers by tracing lexical scope, runtime call chains, declared types and shared storage cells. Each answer shows why the tempting shortcuts fail.
KnowledgeGate Team
Exam prep & CS education

“Static” and “dynamic” can describe scope, binding time, typing or method dispatch; aliasing adds shared storage. For each of these 11 questions, choose first, then trace declarations, callers and values. The same tracing habits apply across Coding & DSA Courses for Placements.
1. Static vs dynamic binding MCQs: use a four-pass trace
Trace each question in four passes:
Identify the bound name, location, type or method.
Mark compile-time or runtime binding.
Separate lexical nesting from the runtime call chain.
For references, trace storage cells.
Question 6 sets the baseline: global i = 10; main calls f; f creates i = 20 and calls g. Static scope resolves i in g through source nesting to 10; dynamic scope finds f's active i = 20. Learn the full concept layer in Language Design: Syntax, Types, Scope, Worked Example, then apply it to the binding, scope, aliasing and dispatch traces below.

2. Binding definition and aliasing: Questions 1-3
Question 1
Which of the following best defines "binding" in programming languages?
A. Allocating memory
B. Attaching a value or property to a variable or function
C. Compiling code
D. Running a function
Answer: B. Attaching a value or property to a variable or function
Binding associates an entity with an attribute: a name with a type, storage cell or value, or a call with a method body. Only B states the general idea.
Question 2
UGC NET 2016, Computer Science, August
Aliasing in the context of programming languages refers to :
A. Multiple variables having the same location
B. Multiple variables having the same identifier
C. Multiple variables having the same value
D. Multiple use of same variable
Answer: A. Multiple variables having the same location
p and q point to the same cell, so writing 12 through q makes *p read 12. Equal names or values do not imply shared storage.
Question 3
GATE 2000, Computer Science
Aliasing in the context of programming languages refers to:
A. multiple variables having the same memory location
B. multiple variables having the same value
C. multiple variables having the same identifier
D. multiple uses of the same variable
Answer: A. multiple variables having the same memory location
Separate cells can hold equal values without being aliases. Aliases are two references to one location, so A is correct.
3. Early binding, late binding and static method calls: Questions 4-5
Question 4
GATE 2007, Computer Science and Information Technology
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:
i. Static scope facilitates w1 bindings.
ii. Dynamic scope requires w2 bindings.
iii. Early bindings w3 execution efficiency.
iv. Late bindings w4 execution efficiency.
The right choices of w1, w2, w3 and w4 (in that order) are
A. Early, late, decrease, increase
B. Late, early, increase, decrease
C. Late, early, decrease, increase
D. Early, late, increase, decrease
Answer: D. Early, late, increase, decrease
Static scope permits early lexical resolution; dynamic scope needs late call-chain resolution. Early binding raises execution efficiency, while late lookup lowers it: D.
Question 5
class Writer
{
public static void write()
{
System.out.println("Writing...");
}
}
class Author extends Writer
{
public static void write()
{
System.out.println("Writing book");
}
}
public class Programmer extends Author
{
public static void write()
{
System.out.println("Writing code");
}
public static void main(String[] args)
{
Author a = new Programmer();
a.write();
}
}A. Writing...
B. Writing book
C. Writing code
D. Compilation fails
Answer: B. Writing book
a is declared as Author, so static write() binds to Author.write() and prints Writing book; static methods are hidden, not overridden. Use Object Oriented Technology Explained and Java: Concepts, MCQs & Coding Questions for practice.

4. Static scope versus dynamic scope: Questions 6-7
Question 6
GATE 2007, Computer Science and Information Technology
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 static scoping and y be the value printed under dynamic scoping. Then, x and y are
A. x = 10, y = 10
B. x = 20, y = 10
C. x = 10, y = 20
D. x = 20, y = 20
Answer: C. x = 10, y = 20
Static scope resolves g's i to global 10; dynamic scope finds f's nearer active 20. Therefore x = 10, y = 20.
Question 7
GATE 1999, Computer Science
Consider the following program in a language that has dynamic scoping.
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:
A. 0.125 0.125
B. 0.25 0.25
C. 0.25 0.125
D. 0.125 0.25
Answer: C. 0.25 0.125
The first show finds main's 0.25; inside small, it finds the nearer 0.125. Output 0.25 0.125 makes C correct.
5. Lexical visibility and pass-by-reference binding: Questions 8-10
Question 8
GATE 1997, Computer Science
Given the following Pascal-like program segment
Procedure A;
x,y:integer;
Procedure B;
x,z:real
S1
end B;
Procedure C;
i:integer;
S2
end C;
end A;The variables accessible in S1 and S2 are
A. x of A, y, x of B and z in S1 and x of B, y and i in S2
B. x of B, y and z in S1 and x of B, i and z in S2
C. x of B, z and y in S1 and x of A, i and y in S2
D. None of the above
Answer: C. x of B, z and y in S1 and x of A, i and y in S2
S1 sees B's x and z plus A's y; B's x hides A's. S2 sees C's i plus A's x and y, because sibling B is not visible.
Question 9
GATE 2006, Computer Science
Consider the following code written in a pass-by-reference language like FORTRAN and these statements about the code.
subroutine swap(ix,iy)
it = ix
L1 : ix = iy
L2 : iy = it
end
ia = 3
ib = 8
call swap (ia, ib + 5)
print *, ia, ib
end S1: The compiler will allocate a temporary nameless cell, initialise it to 13, and pass its address to swap.
S2: Execution will produce a runtime error on line L1.
S3: Execution will produce a runtime error on line L2.
S4: The program will print 13 and 8.
S5: The program will print 13 and -2.
Exactly the following set of statement(s) is correct:
A. S1 and S2
B. S1 and S4
C. S3
D. S1 and S5
Answer: B. S1 and S4
The expression ib + 5 evaluates to 13. L1 changes ia to 13; L2 changes only the temporary to 3. Thus ib stays 8, the output is 13, 8, and S1 with S4 is correct.
Question 10
GATE 2001, Computer Science
Consider the following Pascal-like program:
Program P2
var n: int;
procedure W(var x: int)
begin
x = x + 1;
print x;
end
procedure D
begin
var n: int;
n = 3;
W(n);
end
begin
n = 10;
D;
end
If the language has dynamic scoping and parameters are passed by reference, what will be printed by the program?
A. 10
B. 11
C. 3
D. None of the above
Answer: D. None of the above
D passes local n = 3 by reference, so x aliases it. Then x = x + 1 gives 3 + 1 = 4, which W prints. A-C omit 4, so D is correct; global n = 10 is untouched.
6. Static typing is not static binding: Question 11
Question 11
UGC NET 2015, Computer Science, December
Match List I with List II for programming languages:
List I | List II |
|---|---|
(a) JAVA | (i) Dynamically object-oriented |
(b) Python | (ii) Statically non-object-oriented |
(c) Prolog | (iii) Statically object-oriented |
(d) ADA | (iv) Dynamically non-object-oriented |
Codes:
A. (a)-(iii), (b)-(i), (c)-(iv), (d)-(ii)
B. (a)-(i), (b)-(iii), (c)-(ii), (d)-(iv)
C. (a)-(i), (b)-(iii), (c)-(iv), (d)-(ii)
D. (a)-(ii), (b)-(iv), (c)-(i), (d)-(iii)
Answer: A. (a)-(iii), (b)-(i), (c)-(iv), (d)-(ii)
Here, static and dynamic describe typing. Java maps to static and object-oriented, Python to dynamic and object-oriented, Prolog to dynamic and non-object-oriented, and Ada to static and non-object-oriented. Therefore A matches. Typing remains distinct from scope and method binding.
7. Static vs dynamic binding: the exam map and next step
Phrase | Decision source | Worked value from this set | Common wrong shortcut |
|---|---|---|---|
Static scope | Lexical nesting | Question 6 gives | Follow the caller |
Dynamic scope | Active call chain | Question 6 gives | Follow source nesting |
Static method binding | Declared type | Question 5 prints | Use runtime object |
Aliasing | Shared cell | Question 10 changes | Same value means same cell |
GATE papers from 1997, 1999, 2000, 2001, 2006 and 2007 and UGC NET papers from 2015 and 2016 provide the questions; the spread of years does not imply current weightage.
Draw the lexical tree and call chain, distinguish declared from runtime type, and trace reference cells. Continue with NTA-UGC-NET Paper - 2.
Keep learning

Classes and Objects MCQs: 12 Solved OOP Questions with Explanations
Solve 12 classes and objects MCQs, check each explanation, and use a worked Java trace to separate instance state, constructors, overloading and nested classes.

Programming Language Syntax MCQs: 12 Solved Questions on Grammar, Tokens and Semantics
Solve 12 MCQs on syntax, tokens, pseudocode, C grammar and runtime behaviour. Each explanation identifies the rule and applies it.

Imperative Programming Structure and Flow Control MCQs: 12 Solved Questions
Test whether you can trace changing state, choose the right loop, read a flowchart, and follow event-driven or exceptional control paths through 12 solved MCQs.

TypeScript vs C# Typing: Structural Compatibility, Nominal Identity, Generics and Runtime Checks
Follow one User/Admin example through TypeScript and C# to predict assignments, generic conversions, branded IDs, and JSON behaviour at runtime.