GATE 2012 Computer Science and Information Technology (CS) Questions with Solutions

GATE 2012

82 questions

MCQ 821-mark 39 · 2-mark 43

Questions 41–45 of 82

Q41Undecidability1 markMCQ−0.33 if wrong
Which of the following problems are decidable?
1) Does a given program ever produce an output?
2) If L is a context-free language, then, is Lˉ\bar{L} also context-free?
3) If L is a regular language, then, is Lˉ\bar{L} also regular?
4) If L is a recursive language, then, is Lˉ\bar{L} also recursive?

Q42Parsing2 marksMCQ−0.67 if wrong
For the grammar below, a partial LL(1) parsing table is also presented along with the grammar. Entries that need to be filled are indicated as E1, E2, and E3. ε\varepsilon is the empty string, $ indicates end of input, and, | separates alternate right hand sides of productions.
S→aAbB∣bAaB∣εS\rightarrow aAbB|bAaB|\varepsilon
A→SA\rightarrow S
B→SB\rightarrow S
a b $ S E1 E2 S → ε A A → S A → S error B B → S B → S E3
The appropriate entries for E1, E2, and E3 are

Q43Parsing2 marksMCQ−0.67 if wrong
For the grammar below, a partial LL(1) parsing table is also presented along with the grammar. Entries that need to be filled are indicated as E1, E2, and E3. ε\varepsilon is the empty string, $ indicates end of input, and, | separates alternate right hand sides of productions.
S→aAbB∣bAaB∣εS\rightarrow aAbB|bAaB|\varepsilon
A→SA\rightarrow S
B→SB\rightarrow S
a b $ S E1 E2 S → ε A A → S A → S error B B → S B → S E3
The FIRST and FOLLOW sets for the non-terminals A and B are

Q44Runtime Environment2 marksMCQ−0.67 if wrong
Consider the program given below, in a block-structured pseudo-language with lexical scoping and nesting of procedures permitted.
Program main;
   Var ...

   Procedure A1;
      Var ...
      Call A2;
   End A1

   Procedure A2;
      Var ...

      Procedure A21;
         Var ...
         Call A1;
      End A21

      Call A21;
   End A2

   Call A1;
End main.

Consider the calling chain: Main →\rightarrow A1 →\rightarrow A2 →\rightarrow A21 →\rightarrow A1
The correct set of activation records along with their access links is given by
(A) Main A1 A2 A21 A1 FRAME POINTER ACCESS LINKS (B) Main A1 A2 A21 A1 FRAME POINTER ACCESS LINKS (C) Main A1 A2 A21 FRAME POINTER ACCESS LINKS (D) Main A1 A2 A21 A1 FRAME POINTER ACCESS LINKS

Q45System Call1 markMCQ−0.33 if wrong
A process executes the code
fork();
fork();
fork();
The total number of child processes created is