1
GATE CSE 2024 Set 1
MCQ (More than One Correct Answer)
+2
-0.66

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?

A

If the inputs are x=20, y=10, then the return value is greater than 220

B

If the inputs are x=20, y=20, then the return value is greater than 220

C

If the inputs are x=20, y=10, then the return value is less than 210

D

If the inputs are x=10, y=20, then the return value is greater than 220

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

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 } $$
3
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 ____
4
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?

A
The program will compile successfully and output 10 when executed.
B
The program will compile successfully and output 8 when executed.
C
The program will compile successfully and output 13 when executed.
D
The program will not compile successfully.
GATE CSE Subjects
Software Engineering
Web Technologies
EXAM MAP
Medical
NEETAIIMS
Graduate Aptitude Test in Engineering
GATE CSEGATE ECEGATE EEGATE MEGATE CEGATE PIGATE IN
Civil Services
UPSC Civil Service
Defence
NDA
Staff Selection Commission
SSC CGL Tier I
CBSE
Class 12