1
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?

A

The program will not terminate

B

The program will terminate with no output

C

The program will terminate with 4321 as output

D

The program will terminate with 1234 as output

2
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 ____
3
GATE CSE 2022
MCQ (Single Correct Answer)
+1
-0.33

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;
   }

A
$$\matrix{ 1 & 2 & 3 \cr {10} & {11} & {12} \cr {19} & {20} & {21} \cr } $$
B
$$\matrix{ 1 & 4 & 7 \cr {10} & {13} & {16} \cr {19} & {22} & {25} \cr } $$
C
$$\matrix{ 1 & 2 & 3 \cr 4 & 5 & 6 \cr 7 & 8 & 9 \cr } $$
D
$$\matrix{ 1 & 2 & 3 \cr {13} & {14} & {15} \cr {25} & {26} & {27} \cr } $$
4
GATE CSE 2019
Numerical
+1
-0.33
Consider the following C program:

        #include < stdio.h >
         int jumble (int x, int y)  {
               x = 2 * x + y ;
               return x ;
         }
         int main ( )  {
               int x=2, y=5 ;
               y = jumble (y, x) ;
               x = jumble (y, x) ;
               printf ("%d \n", x) ;
               return 0 ;
         }


The value printed by the program is ______.
Your input ____
GATE CSE Subjects
Software Engineering
Web Technologies
EXAM MAP
Medical
NEET
Graduate Aptitude Test in Engineering
GATE CSEGATE ECEGATE EEGATE MEGATE CEGATE PIGATE IN
Civil Services
UPSC Civil Service
Defence
NDA
CBSE
Class 12