1
GATE CSE 2003
MCQ (Single Correct Answer)
+2
-0.6
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.
Px = new Q();
Qy = new Q();
Pz = new Q();
x.f(1); ((P)y).f(1); z.f(1);
Here ((P)y) denotes a typecast of y to P. The output produced by executing the above program fragment will be
Class P {
void f(int i) {
print(i);
}
}
Class Q subclass of P {
void f(int i) {
print(2*i);
}
}
Now consider the following program fragment:
Px = new Q();
Qy = new Q();
Pz = new Q();
x.f(1); ((P)y).f(1); z.f(1);
Here ((P)y) denotes a typecast of y to P. The output produced by executing the above program fragment will be
2
GATE CSE 2002
MCQ (Single Correct Answer)
+2
-0.6
Consider the following declaration of a two-dimensional array in C:
char a[100][100];
Assuming that the main memory is byte-addressable and that the array is stored starting from memory address 0, the address of a[40][50] is
char a[100][100];
Assuming that the main memory is byte-addressable and that the array is stored starting from memory address 0, the address of a[40][50] is
3
GATE CSE 2000
MCQ (Single Correct Answer)
+2
-0.6
The value of j at the end of the execution of the following C program
int incr (int i)
{
static int count = 0;
count = count + i;
return (count);
}
main () {
int i,j;
for (i = 0; i <= 4; i++)
j = incr(i);
}
is4
GATE CSE 1999
MCQ (Single Correct Answer)
+2
-0.6
Consider the following C function definition
int Trial (int a, int b, int c)
{
if ((a > = b) && (c < b)) return b;
else if (a > = b) return Trial (a,c,b);
else return Trial (b,a,c);
}
The function Trial:Questions Asked from Function and Recursion (Marks 2)
Number in Brackets after Paper Indicates No. of Questions
GATE CSE 2024 Set 1 (1)
GATE CSE 2022 (1)
GATE CSE 2021 Set 2 (1)
GATE CSE 2021 Set 1 (2)
GATE CSE 2020 (2)
GATE CSE 2019 (2)
GATE CSE 2018 (1)
GATE CSE 2015 Set 2 (1)
GATE CSE 2012 (1)
GATE CSE 2011 (2)
GATE CSE 2008 (1)
GATE CSE 2007 (1)
GATE CSE 2005 (2)
GATE CSE 2004 (2)
GATE CSE 2003 (1)
GATE CSE 2002 (1)
GATE CSE 2000 (1)
GATE CSE 1999 (1)
GATE CSE 1998 (2)
GATE CSE 1995 (1)
GATE CSE 1993 (1)
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