1
GATE CSE 2024 Set 2
MCQ (Single Correct Answer)
+1
-0.33
Consider the following C program. Assume parameters to a function are evaluated from right to left.
#include <studio.h>
int g(int p) { printf("%d", p); return p; }
int h(int q) { printf("%d", q); return q; }
void f(int x, int y) {
g(x);
h(y);
}
int main() {
f(g(10),h(20));
}
Which one of the following options is the CORRECT output of the above C program?
2
GATE CSE 2024 Set 1
MCQ (Single Correct Answer)
+1
-0.33
Consider the following C program:
#include <stdio.h>
void fX();
int main() {
fX();
return 0;}
void fX() {
char a;
if ((a = getchar()) != '\n')
fX();
if (a != '\n')
putchar(a);}
Assume that the input to the program from the command line is 1234 followed by a newline character. Which one of the following statements is CORRECT?
3
GATE CSE 2023
Numerical
+1
-0.33
The integer value printed by the ANSI-C program given below is ___________.
#include<stdio.h>
int funcp(){
static int x = 1;
x++ ;
return x;
}
int main(){
int x,y;
x = funcp();
y = funcp()+x;
printf("%d\n", (x+y));
return 0;
}
Your input ____
4
GATE CSE 2021 Set 2
Numerical
+1
-0
Consider the following ANSI C function:
int SomeFunction (int x, int y)
{
if ( (x == 1) I I (y == 1)) return 1;
if (x == y) return x;
if (x > y) return SomeFunction(x - y, y);
if (y > x) return SomeFunction(x, y - x);
}
The value returned by SomeFunction(15, 255) is _______.
Your input ____
Questions Asked from Function and Recursion (Marks 1)
Number in Brackets after Paper Indicates No. of Questions
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