1
GATE CSE 2022
MCQ (Single Correct Answer)
+2
-0.67
What is printed by the following ANSI C program?
#include <stdio.h>
int main(int argc, char *argv[ ]) {
int a[3][3][3] = {{1, 2, 3, 4, 5, 6, 7, 8, 9},
{10, 11, 12, 13, 14, 15, 16, 17, 18},
{19, 20, 21, 22, 23, 24, 25, 26, 27}};
int i = 0, j = 0, k = 0;
for(i = 0; i < 3; i++) {
for(k = 0; k < 3; k++)
printf("%d"",a[i][j][k]);
printf("\n");
}
return 0;
}
2
GATE CSE 2021 Set 2
Numerical
+2
-0
Consider the following ANSI C program
#include <stdio.h>
int foo(int x, int y, int q)
{
if ((x <= 0 && (y <= 0))
return q;
if (x <= 0)
return foo(x, y - q, q);
if (y <= 0)
return foo(x - q, y, q);
return foo (x, y - q, q) + foo(x - q, y, q);
}
int main()
(
int r = foo(15, 15, 10);
printf("%d", r);
return 0;
}
The output of the program upon execution is ________
Your input ____
3
GATE CSE 2021 Set 1
MCQ (Single Correct Answer)
+2
-0.67
Consider the following ANSI C program.
#include <stdio.h>
int main( ) {
int i, j, count;
count = 0;
i = 0;
for (j = -3; j <= 3; j++) {
if ((j >= 0) && (i++))
count = count + j;
}
count = count + i;
printf("%d", count);
return 0;
}
Which one of the following options is correct?
4
GATE CSE 2021 Set 1
Numerical
+2
-0
Consider the following ANSI C function:
int SimpleFunction (int y[], int n, int x)
{
int total = y[0], loopIndex;
for (loopIndex = 1; loopIndex <= n - 1; loopIndex++)
total = x * total + y[loopIndex];
return total :
}
Let Z be an array of 10 elements with Z[i] = 1, for all i such that 0 ≤ i ≤ 9. The value returned by SimpleFunction (Z, 10, 2) is ______
Your input ____
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