1
GATE CSE 2003
MCQ (Single Correct Answer)
+2
-0.6
The following program fragment is written in a programming language that allows global
variables and does not allow nested declarations of functions.
global int i = 100, j = 5;
void P(x) {
int i = 10;
print(x + 10);
i = 200;
j = 20;
print (x);
}
main() {
P(i + j);
}
If the programming language uses dynamic scoping and call by name parameter
passing mechanism, the values printed by the above program are2
GATE CSE 2003
MCQ (Single Correct Answer)
+2
-0.6
The following program fragment is written in a programming language that allows global
variables and does not allow nested declarations of functions.
global int i = 100, j = 5;
void P(x) {
int i = 10;
print(x + 10);
i = 200;
j = 20;
print (x);
}
main() {
P(i + j);
}
If the programming language uses static scoping and call by need parameter
passing mechanism, the values printed by the above program are3
GATE CSE 2001
MCQ (Single Correct Answer)
+2
-0.6
What is printed by the print statements in the program P1 assuming call by
reference parameter passing?
Program P1()
{
x=10;
y=3;
func1(y,x,x);
print x;
print y;
}
func1(x,y,z)
{
y=y+4;
z=x+y+z;
}
4
GATE CSE 2001
MCQ (Single Correct Answer)
+2
-0.6
Consider the following 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 \\begin P2
n = 10;
D;
end
If the language has dynamic scooping and parameters are passed by reference,
what will be printed by the program?Questions Asked from Basic of Programming Language (Marks 2)
Number in Brackets after Paper Indicates No. of Questions
GATE CSE 2024 Set 2 (1)
GATE CSE 2023 (1)
GATE CSE 2022 (1)
GATE CSE 2015 Set 1 (1)
GATE CSE 2014 Set 2 (2)
GATE CSE 2013 (1)
GATE CSE 2008 (1)
GATE CSE 2003 (2)
GATE CSE 2001 (2)
GATE CSE 1999 (3)
GATE CSE 1998 (1)
GATE CSE 1997 (1)
GATE CSE 1996 (1)
GATE CSE 1994 (1)
GATE CSE 1990 (2)
GATE CSE 1989 (2)
GATE CSE Subjects
Theory of Computation
Operating Systems
Algorithms
Database Management System
Data Structures
Computer Networks
Software Engineering
Compiler Design
Web Technologies
General Aptitude
Discrete Mathematics
Programming Languages