1
GATE CSE 2026 Set 2
Numerical
+2
-0

Consider the following ANSI-C program.

#include <stdio.h>

int main( ) {

    int *ptr, a, b, c;

    a=5; b=11; c=20;

    ptr=&a; *ptr=c; ptr=&c;

    a=*(&b); c=*ptr-a;

    printf("%d",c);

    return(0);

}

The output of this program is $\_\_\_\_$ . (answer in integer)

Note: Assume that the program compiles and runs successfully.

Your input ____
2
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 ____
3
GATE CSE 2026 Set 2
MCQ (Single Correct Answer)
+1
-0

Which one of the following statements is equivalent to the following assertion?

Turing machine $M$ decides the language $L \subseteq\{0,1\}$.

A

Turing machine $M$ halts on all input strings in $\{0,1\}^*$

B

Turing machine $M$ accepts all input strings in $L$

C

Turing machine $M$ rejects all input strings in $\{0,1\}^*-L$

D

Turing machine $M$ accepts all input strings in $L$ and rejects all input strings in $\{0,1\}^*-L$

4
GATE CSE 2026 Set 2
MCQ (More than One Correct Answer)
+1
-0

Which of the following grammars is/are ambiguous?

A

$S \rightarrow a S b \mid \in$

B

$E \rightarrow E+E|E * E|$ id

C

$S \rightarrow a S|S a| \in$

D

$S \rightarrow a S \mid \in$