Theory of Computation questions

Q10

GATE CS 2017 CS-1Context Free LanguagesMCQ1 mark−1/3 if wrong
Consider the following context-free grammar over the alphabet Σ={a,b,c}\Sigma = \{a, b, c\} with SS as the start symbol:

S→abScT∣abcTS \to abScT \mid abcT
T→bT∣bT \to bT \mid b

Which one of the following represents the language generated by the above grammar?
Show answer without attempting

Answer: B

Q17

GATE CS 2017 CS-1Context Free LanguagesMCQ1 mark−1/3 if wrong
Consider the following grammar:

P→xQRSQ→yz∣zR→w∣εS→y\begin{aligned} P & \to xQRS \\ Q & \to yz \mid z \\ R & \to w \mid \varepsilon \\ S & \to y \end{aligned}

What is FOLLOW(Q)\text{FOLLOW}(Q)?
Show answer without attempting

Answer: C

Q22

GATE CS 2017 CS-1Regular LanguagesNAT1 mark
Consider the language LL given by the regular expression (a+b)∗b(a+b)(a+b)^*b(a+b) over the alphabet {a,b}\{a, b\}. The smallest number of states needed in a deterministic finite-state automaton (DFA) accepting LL is ____________.
Show answer without attempting

Answer: 4.0

Q34

GATE CS 2017 CS-1Context Free LanguagesMCQ2 marks−2/3 if wrong
If GG is a grammar with productions

S→SaS∣aSb∣bSa∣SS∣εS \to SaS \mid aSb \mid bSa \mid SS \mid \varepsilon

where SS is the start variable, then which one of the following strings is not generated by GG?
Show answer without attempting

Answer: D

Q37

GATE CS 2017 CS-1Context Free LanguagesMCQ2 marks−2/3 if wrong
Consider the context-free grammars over the alphabet {a,b,c}\lbrace a, b, c \rbrace given below. SS and TT are non-terminals.

G1:S→aSb∣T,T→cT∣εG_1: S \to aSb \mid T, T \to cT \mid \varepsilon
G2:S→bSa∣T,T→cT∣εG_2: S \to bSa \mid T, T \to cT \mid \varepsilon

The language L(G1)∩L(G2)L(G_1) \cap L(G_2) is
Show answer without attempting

Answer: B

Q38

GATE CS 2017 CS-1Context Free LanguagesMCQ2 marks−2/3 if wrong
Consider the following languages over the alphabet Σ={a,b,c}\Sigma = \lbrace a, b, c \rbrace. Let L1={anbncm∣m,n≥0}L_1 = \lbrace a^n b^n c^m \mid m, n \ge 0 \rbrace and L2={ambncn∣m,n≥0}L_2 = \lbrace a^m b^n c^n \mid m, n \ge 0 \rbrace.

Which of the following are context-free languages?

I. L1∪L2L_1 \cup L_2
II. L1∩L2L_1 \cap L_2
Show answer without attempting

Answer: A

Q39

GATE CS 2017 CS-1ComputabilityMCQ2 marks−2/3 if wrong
Let AA and BB be finite alphabets and let #\# be a symbol outside both AA and BB. Let ff be a total function from A∗A^* to B∗B^*. We say ff is computable if there exists a Turing machine MM which given an input xx in A∗A^*, always halts with f(x)f(x) on its tape. Let LfL_f denote the language {x#f(x)∣x∈A∗}\lbrace x\#f(x) \mid x \in A^* \rbrace.
Which of the following statements is true:
Show answer without attempting

Answer: A

Q4

GATE CS 2017 CS-2Context Free LanguagesMCQ1 mark−1/3 if wrong
Let L1,L2L_1, L_2 be any two context-free languages and RR be any regular language. Then which of the following is/are CORRECT?

I. L1∪L2L_1 \cup L_2 is context-free.
II. L1‾\overline{L_1} is context-free.
III. L1−RL_1 - R is context-free.
IV. L1∩L2L_1 \cap L_2 is context-free.
Show answer without attempting

Answer: B

Q16

GATE CS 2017 CS-2Context Free LanguagesMCQ1 mark−1/3 if wrong
Identify the language generated by the following grammar, where SS is the start variable.

<br>S→XY<br>X→aX∣a<br>Y→aYb∣ϵ<br>\begin{aligned}<br>S &\rightarrow XY \\<br>X &\rightarrow aX \mid a \\<br>Y &\rightarrow aYb \mid \epsilon<br>\end{aligned}
Show answer without attempting

Answer: C

Q25

GATE CS 2017 CS-2Regular LanguagesNAT1 mark
The minimum possible number of states of a deterministic finite automaton that accepts the regular language L={w1aw2∣w1,w2∈{a,b}∗,∣w1∣=2,∣w2∣≥3}L = \{w_1 a w_2 \mid w_1, w_2 \in \{a, b\}^*, \lvert w_1 \rvert = 2, \lvert w_2 \rvert \ge 3\} is ____________.
Show answer without attempting

Answer: 8.0

Q39

GATE CS 2017 CS-2Regular LanguagesMCQ2 marks−2/3 if wrong
Let δ\delta denote the transition function and δ^\widehat{\delta} denote the extended transition function of the ϵ\epsilon-NFA whose transition table is given below:
δ\deltaϵ\epsilonaabb
→q0\rightarrow q_0{q2}\{q_2\}{q1}\{q_1\}{q0}\{q_0\}
q1q_1{q2}\{q_2\}{q2}\{q_2\}{q3}\{q_3\}
q2q_2{q0}\{q_0\}∅\emptyset∅\emptyset
q3q_3∅\emptyset∅\emptyset{q2}\{q_2\}
Then δ^(q2,aba)\widehat{\delta}(q_2, aba) is
Show answer without attempting

Answer: C

Q40

GATE CS 2017 CS-2Regular LanguagesMCQ2 marks−2/3 if wrong
Consider the following languages.

L1={ap∣p is a prime number}L_1 = \{a^p \mid p \text{ is a prime number}\}
L2={anbmc2m∣n≥0,m≥0}L_2 = \{a^n b^m c^{2m} \mid n \ge 0, m \ge 0\}
L3={anbnc2n∣n≥0}L_3 = \{a^n b^n c^{2n} \mid n \ge 0\}
L4={anbn∣n≥1}L_4 = \{a^n b^n \mid n \ge 1\}

Which of the following are CORRECT?

I. L1L_1 is context-free but not regular.
II. L2L_2 is not context-free.
III. L3L_3 is not context-free but recursive.
IV. L4L_4 is deterministic context-free.
Show answer without attempting

Answer: D

Q41

GATE CS 2017 CS-2ComputabilityMCQ2 marks−2/3 if wrong
Let L(R)L(R) be the language represented by regular expression RR. Let L(G)L(G) be the language generated by a context free grammar GG. Let L(M)L(M) be the language accepted by a Turing machine MM.
Which of the following decision problems are undecidable?

I. Given a regular expression RR and a string ww, is w∈L(R)w \in L(R)?
II. Given a context-free grammar GG, is L(G)=∅L(G) = \emptyset?
III. Given a context-free grammar GG, is L(G)=Σ∗L(G) = \Sigma^* for some alphabet Σ\Sigma?
IV. Given a Turing machine MM and a string ww, is w∈L(M)w \in L(M)?
Show answer without attempting

Answer: D

0/130 correct0 marks

Related topics in GATE CS