1
GATE CSE 2026 Set 2
Numerical
+2
-0
Consider the following ANSI-C function.
int func(int start, int end){
int length = end + 1 - start;
if((length<1)| (start < 0)||(end<0)){ return(0); }
if(length%3 == 0){
return(func(start+1, end));
} else if(length%3 == 1){
return(1 + func(start, end -1));
} else {
return(func(start + 2, end));
}
}
The maximum possible value that can be returned from this function is $\_\_\_\_$ . (answer in integer)
Note: Ignore syntax errors (if any) in the function.
Your input ____
2
GATE CSE 2026 Set 1
Numerical
+2
-0
Consider the recursive functions represented by the following code segment:
int bar(int n){
if (n == 1) return 0;
else return 1 + bar(n/2);
}
int foo(int n){
if (n == 1) return 1;
else return 1 + foo(bar(n));
}
The smallest positive integer n for which foo(n) returns 5 is $\_\_\_\_$ . (answer in integer)
Note: Ignore syntax errors (if any) in the function.
Your input ____
3
GATE CSE 2024 Set 1
MCQ (More than One Correct Answer)
+2
-0
Consider the following C function definition.
int f(int x, int y) {
for (int i=0; i<y; i++) {
x=x+x+y;
}
return x;
}
Which of the following statements is/are TRUE about the above function?
4
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;
}
GATE CSE Subjects
Browse all chapters by subject
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