1
GATE CSE 2012
MCQ (Single Correct Answer)
+2
-0.6
Consider the following C code segment.
int a, b, c = 0;
void prtFun(void);
main( )
{ 
   static int a = 1; /* Line 1 */
   prtFun();
   a + = 1;
   prtFun();
   printf("\n %d %d ", a, b);
}
void prtFun(void)
{ 
   static int a=2;   /* Line 2 */
   int b=1;
   a+ = ++b;
   printf("\n %d %d ", a, b);
}
What output will be generated by the given code segment?
A
$$\eqalign{ & 3\,\,1 \cr & 4\,\,1 \cr & 4\,\,2 \cr} $$
B
$$\eqalign{ & 4\,\,2 \cr & 6\,\,1 \cr & 6\,\,1 \cr} $$
C
$$\eqalign{ & 4\,\,2 \cr & 6\,\,2 \cr & 2\,\,0 \cr} $$
D
$$\eqalign{ & 3\,\,1 \cr & 5\,\,2 \cr & 5\,\,2 \cr} $$
2
GATE CSE 2012
MCQ (Single Correct Answer)
+2
-0.6
Consider the following C code segment.
int a, b, c = 0;
void prtFun(void);
main( )
{ 
   static int a = 1; /* Line 1 */
   prtFun();
   a + = 1;
   prtFun();
   printf("\n %d %d ", a, b);
}
void prtFun(void)
{ 
   static int a=2;   /* Line 2 */
   int b=1;
   a+ = ++b;
   printf("\n %d %d ", a, b);
}
What output will be generated by the given code segment if:
Line 1 is replaced by auto int a = 1;
Line 2 is replaced by register int a = 2;
A
$$\eqalign{ & 3\,\,1 \cr & 4\,\,1 \cr & 4\,\,2 \cr} $$
B
$$\eqalign{ & 4\,\,2 \cr & 6\,\,1 \cr & 6\,\,1 \cr} $$
C
$$\eqalign{ & 4\,\,2 \cr & 6\,\,2 \cr & 2\,\,0 \cr} $$
D
$$\eqalign{ & 4\,\,2 \cr & 4\,\,2 \cr & 2\,\,0 \cr} $$
3
GATE CSE 2012
MCQ (Single Correct Answer)
+1
-0.3
What is the complement of the language accepted by the $$NFA$$ shown below?
Assume $$\sum { = \left\{ a \right\}\,\,} $$ and $$\varepsilon $$ is the empty string. GATE CSE 2012 Theory of Computation - Finite Automata and Regular Language Question 71 English
A
$$\phi $$
B
$$\left\{ \varepsilon \right\}$$
C
$$a{}^ * $$
D
$$\left\{ {a,\,\,\varepsilon } \right\}$$
4
GATE CSE 2012
MCQ (Single Correct Answer)
+2
-0.6
Consider the set of strings on $$\left\{ {0,1} \right\}$$ in which, every substring of $$3$$ symbols has at most two zeros. For example, $$001110$$ and $$011001$$ are in the language, but $$100010$$ is not. All strings of length less than $$3$$ are also in the language. A partially completed $$DFA$$ that accepts this language is shown below.

The missing arcs in the $$DFA$$ are

GATE CSE 2012 Theory of Computation - Finite Automata and Regular Language Question 35 English
A
GATE CSE 2012 Theory of Computation - Finite Automata and Regular Language Question 35 English Option 1
B
GATE CSE 2012 Theory of Computation - Finite Automata and Regular Language Question 35 English Option 2
C
GATE CSE 2012 Theory of Computation - Finite Automata and Regular Language Question 35 English Option 3
D
GATE CSE 2012 Theory of Computation - Finite Automata and Regular Language Question 35 English Option 4
EXAM MAP
Medical
NEET
Graduate Aptitude Test in Engineering
GATE CSEGATE ECEGATE EEGATE MEGATE CEGATE PIGATE IN
CBSE
Class 12