1
GATE CSE 2025 Set 1
Numerical
+2
-0

Consider the following C program :

#include < stdio.h>
int gate (int n) {
    int d, t, newnum, turn;
    newnum = turn = 0; t=1;
    while (n>= t) t*= 10;
    t/=10;
    while (t>0) {
        d=n/t;
        n=n%t;
        t/= 10;
        if (turn) newnum = 10*newnum + d;
        turn = (turn + 1) % 2;
    }
    return newnum;
}
int main( ) {
    printf("%d", gate(14362));
    return 0;
}

The value printed by the given C program is _________. (Answer in integer)

Your input ____
2
GATE CSE 2025 Set 1
MCQ (Single Correct Answer)
+1
-0.33

Consider the following context-free grammar $G$, where $S, A$, and $B$ are the variables (nonterminals), $a$ and $b$ are the terminal symbols, $S$ is the start variable, and the rules of $G$ are described as:

$$\begin{aligned} & S \rightarrow a a B \mid A b b \\ & A \rightarrow a \mid a A \\ & B \rightarrow b \mid b B \end{aligned}$$

Which ONE of the languages $L(G)$ is accepted by $G$ ?

A
$L(G)=\left\{a^2 b^n \mid n \geq 1\right\} \cup\left\{a^n b^2 \mid n \geq 1\right\}$
B
$L(G)=\left\{a^n b^{2 n} \mid n \geq 1\right\} \cup\left\{a^{2 n} b^n \mid n \geq 1\right\}$
C
$L(G)=\left\{a^n b^n \mid n \geq 1\right\}$
D
$L(G)=\left\{a^{2 n} b^{2 n} \mid n \geq 1\right\}$
3
GATE CSE 2025 Set 1
MCQ (Single Correct Answer)
+1
-0

A regular language $L$ is accepted by a non-deterministic finite automaton (NFA) with $n$ states. Which of the following statement(s) is/are FALSE?

A
$L$ may have an accepting NFA with $< n$ states.
B
$L$ may have an accepting DFA with $< n$ states.
C
There exists a DFA with $\leq 2^n$ states that accepts $L$.
D
Every DFA that accepts $L$ has $>2^n$ states.
4
GATE CSE 2025 Set 1
MCQ (Single Correct Answer)
+2
-0

Consider the following two languages over the alphabet $\{a, b\}$ :

$$\begin{aligned} & L_1=\left\{\alpha \beta \alpha \mid \alpha \in\{a, b\}^{+} \text {AND } \beta \in\{a, b\}^{+}\right\} \\ & L_2=\left\{\alpha \beta \alpha \mid \alpha \in\{a\}^{+} \text {AND } \beta \in\{a, b\}^{+}\right\} \end{aligned}$$

Which ONE of the following statements is CORRECT?

A
Both $L_1$ and $L_2$ are regular languages.
B
$L_1$ is a regular language but $L_2$ is not a regular language.
C
$L_1$ is not a regular language but $L_2$ is a regular language.
D
Neither $L_1$ nor $L_2$ is a regular language.
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