Consider the following program in C:
#include <stdio.h>
void func(int i, int j) {
if(i < j) {
int i = 0;
while (i < 10) {
j += 2;
i++;
}
}
printf("%d", i);
}
int main() {
int i = 9, j = 10;
func(i, j);
return 0;
}
The output of the program is $\_\_\_\_$ . (answer in integer)
Note: Assume that the program compiles and runs successfully.
Consider the recursive functions represented by the following code segment:
int bar(int n){
if (n == 1) return 0;
else return 1 + bar(n/2);
}
int foo(int n){
if (n == 1) return 1;
else return 1 + foo(bar(n));
}
The smallest positive integer n for which foo(n) returns 5 is $\_\_\_\_$ . (answer in integer)
Note: Ignore syntax errors (if any) in the function.
Consider the following grammar where $S$ is the start symbol, and $a$ and $b$ are terminal symbols.
$$ S \rightarrow a S b S|b S| \in $$
Which of the following statements is/are true?
Let $M$ be a non-deterministic finite automaton (NFA) with 6 states over a finite alphabet. Which of the following options CANNOT be the number of states in the minimal deterministic finite automaton (DFA) that is equivalent to $M$ ?
GATE CSE Papers
All year-wise previous year question papers