1
GATE CSE 2005
MCQ (Single Correct Answer)
+2
-0.6
Consider the following C program:
double foo(double); /* Line 1 */
int main () {
double da, db;
//input da
db = foo(da);
}
double foo(double a){
return a;
}
The above code compiled without any error or warning. If Line 1 is deleted, the above code will show:2
GATE CSE 2004
MCQ (Single Correct Answer)
+2
-0.6
Consider the following C function:
int f(int n)
{
static int i = 1;
if(n>=5) return n;
n = n+1;
i++;
return f(n);
}
The value returned by f(1) is3
GATE CSE 2004
MCQ (Single Correct Answer)
+2
-0.6
Consider the following C program
main ( )
{
int x, y, m, n;
scanf("%d %d", &x, &y);
/* Assume x > 0 and y > 0 */
m=x; n=y;
while(m!=n)
{
if(m>n)
m=m-n;
else
n=n-m;
}
printf("%d", n);
}
The program computes4
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
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