1
GATE CSE 2024 Set 1
MCQ (Single Correct Answer)
+1
-0.33

Consider the following C program:


#include <stdio.h>

int main() {

   int a = 6;

   int b = 0;

   while(a < 10) {

      a = a / 12 + 1;

      a += b;}

   printf("%d", a);

   return 0;}

Which one of the following statements is CORRECT?

A

The program prints 9 as output

B

The program prints 10 as output

C

The program gets stuck in an infinite loop

D

The program prints 6 as output

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?

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

3
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

4
GATE CSE 2024 Set 1
MCQ (More than One Correct Answer)
+1
-0.33

Let $L_1, L_2$ be two regular languages and $L_3$ a language which is not regular. Which of the following statements is/are always TRUE?

A

$L_1 = L_2$ if and only if $L_1 \cap \overline{L_2} = \emptyset$

B

$L_1 \cup L_3$ is not regular

C

$\overline{L_3}$ is not regular

D

$L_1 \cup \overline{L_2}$ is regular

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