Push Down Automata and Context Free Language · Theory of Computation · GATE CSE

Start Practice

Marks 1

1
Let L1 be a regular language and L2 be a context-free language. Which of the following languages is/are context-free?
GATE CSE 2021 Set 2
2
Suppose that L1 is a regular and L2 is a context-free language, Which one of the following languages is NOT necessarily context-free?
GATE CSE 2021 Set 1
3
Let $$\left\langle M \right\rangle $$ denote an encoding of an automation M. Suppose that ∑ = {0, 1}. Which of the following languages is/are NOT recursive?
GATE CSE 2021 Set 1
4
Which of the following languages is generated by the given grammar? $$$S \to aS|bS|\varepsilon $$$
GATE CSE 2016 Set 1
5
The lexical analysis for a modern computer language such as java needs the power of which one of the following machine model in a necessary and sufficient sense?
GATE CSE 2011
6
$$S \to aSa\,\left| {\,bSb\,\left| {\,a\,\left| {\,b} \right.} \right.} \right.$$
The language generated by the above grammar over the alphabet $$\left\{ {a,\,b} \right\}$$ is the set of
GATE CSE 2009
7
Which one of the following is FALSE?
GATE CSE 2009
8
Let $${L_1} = \left\{ {{0^{n + m}}{1^n}{0^m}\left| {n,m \ge 0} \right.} \right\},$$
$$\,\,\,{L_2} = \left\{ {{0^{n + m}}{1^{n + m}}{0^m}\left| {n,m \ge 0} \right.} \right\},$$ and
$$\,\,\,\,{L_3} = \left\{ {{0^{n + m}}{1^{n + m}}{0^{n + m}}\left| {n,m \ge 0} \right.} \right\},$$ Which of these languages are NOT context free?
GATE CSE 2006
9
Which of the following grammar rules violate the requirements of an operator grammar ? $$P,$$ $$Q, R$$ are non-terminals and $$r, s, t$$ are terminals. $$$\eqalign{ & 1)\,\,\,P \to Q\,R\,\,\,\,\,2)\,\,\,P \to Q\,s\,R \cr & 3)\,\,\,P \to c\,\,\,\,\,\,\,\,\,\,\,4)P \to Q\,t\,R\,r \cr} $$$
GATE CSE 2004
10
The language accepted by a pushdown Automation in which the stack is limited to $$10$$ items is best described as
GATE CSE 2002
11
Which of the following statement is true?
GATE CSE 2001
12
Context free languages are closed under:
GATE CSE 1999
13
Let $${L_D}$$ be the set of all languages accepted by a $$PDA$$ by final state and $${L_E}$$ the set of all languages accepted by empty stack. Which of the following is true?
GATE CSE 1999
14
Consider the grammar with the following productions.
$$S \to a\,\alpha \,\,b\left| {\,\,b\,\alpha } \right.\,c\,\left| {aB} \right.$$
$$S \to \alpha S\,\left| b \right.$$
$$S \to \alpha \,bb\,\left| {ab} \right.$$
$$S\alpha \to bdb\,\left| b \right.$$
the above grammar is
GATE CSE 1995
15
State whether the following statement is TRUE / FALSE.

A minimal $$DFA$$ that is equivalent to an $$NFDA$$ with $$n$$ modes has always 2n states

GATE CSE 1990
16
State whether the following statement is TRUE / FALSE.

Regularity is preserved under the operation of string reversal.

GATE CSE 1990
17
State whether the following statement is TRUE / FALSE.

All subjects of regular sets are regular.

GATE CSE 1990
18
State whether the following statement is TRUE / FALSE. The problem is to whether a Turing Machine M accepts input $$w$$ is un-decidable.

GATE CSE 1990
19
State whether the following statement is TRUE / FALSE.

A is recursive if both a and its complement are accepted by Turing Machine M accepts.

GATE CSE 1990
20
State whether the following statement is TRUE / FALSE.

The intersection of two $$CFL's$$ is also $$CFL.$$

GATE CSE 1990

Marks 2

1

Consider a context-free grammar $G$ with the following 3 rules.

$S \rightarrow aS, \ S \rightarrow aSbS, S \rightarrow c$

Let $w \in L(G)$.

Let $n_a(w)$, $n_b(w)$, $n_c(w)$ denote the number of times $a$, $b$, $c$ occur in $w$, respectively. Which of the following statements is/are TRUE?

GATE CSE 2024 Set 2
2

Let G = (V, Σ, S, P) be a context-free grammar in Chomsky Normal Form with Σ = { a, b, c } and V containing 10 variable symbols including the start symbol S. The string w = a30b30c30 is derivable from S. The number of steps (application of rules) in the derivation S ⟹ w is _______

GATE CSE 2024 Set 1
3

Consider the context-free grammar G below

$$\matrix{ S & \to & {aSb|X} \cr X & \to & {aX|Xb|a|b,} \cr } $$

where S and X are non-terminals, and a and b are terminal symbols. The starting non-terminal is S.

Which one of the following statements is CORRECT?

GATE CSE 2023
4

Consider the pushdown automation (PDA) P below, which runs on the input alphabet {a, b}, has stack alphabet {$$\bot$$, A}, and has three states {s, p, q}, with s being the start state. A transition from state u to state v, labelled c/X/$$\gamma$$, where c is an input symbol or $$\in $$, X is a stack symbol, and $$\gamma$$ is a string of stack symbols, represents the fact that in state u, the PDA can read c from the input, with X on the top of its stack, pop X from the stack, push in the string $$\gamma$$ on the stack, and go to state v. In the initial configuration, the stack has only the symbol $$\bot$$ in it. The PDA accepts by empty stack.

GATE CSE 2023 Theory of Computation - Push Down Automata and Context Free Language Question 5 English

Which one of the following options correctly describes the language accepted by P?

GATE CSE 2023
5

Consider the following languages:

L1 = {an wan | w $$\in$$ {a, b}*}

L2 = {wxwR | w, x $$\in$$ {a, b}*, | w | , | x | > 0}

Note that wR is the reversal of the string w. Which of the following is/are TRUE?

GATE CSE 2022
6

Consider the following languages:

$$\eqalign{ & {L_1} = \{ ww|w \in \{ a,b\} *\} \cr & {L_2} = \{ {a^n}{b^n}{c^m}|m,\,n \ge 0\} \cr & {L_3} = \{ {a^m}{b^n}{c^n}|m,\,n \ge 0\} \cr} $$

Which of the following statements is/are FALSE?

GATE CSE 2022
7

For a string w, we define wR to be the reverse of w. For example, if w = 01101 then wR = 10110.

Which of the following languages is/are context-free?

GATE CSE 2021 Set 2
8

In a pushdown automaton P = (Q, ∑, Γ, δ, q0, F), a transition of the form,

GATE CSE 2021 Set 1 Theory of Computation - Push Down Automata and Context Free Language Question 11 English 1

where p, q ∈ Q, a ∈ Σ ∪ {ϵ}, and X, Y ∈ Γ ∪ {ϵ}, represents

(q, Y) ∈ δ(p, a, X).

Consider the following pushdown automaton over the input alphabet ∑ = {a, b} and stack alphabet Γ = {#, A}.

GATE CSE 2021 Set 1 Theory of Computation - Push Down Automata and Context Free Language Question 11 English 2
The number of strings of length 100 accepted by the above pushdown automaton is ______

GATE CSE 2021 Set 1
9

Consider the following languages.

L1 = {wxyx | w, x, y ∈ (0 + 1)+}

L2 = {xy | x, y ∈ (a + b)*, |x| = |y|, x ≠ y}

Which one of the following is TRUE?

GATE CSE 2020
10

Which one of the following languages over $\Sigma=\{a, b\}$ is NOT context-free?

GATE CSE 2019
11
Consider the following languages:

$$\,\,\,\,\,\,\,\,{\rm I}.\,\,\,\,\,\,\,$$ $$\left\{ {{a^m}{b^n}{c^p}{d^q}} \right.|m + p = n + q,$$ where $$\left. {m,n,p,q \ge 0} \right\}$$
$$\,\,\,\,\,\,{\rm II}.\,\,\,\,\,\,\,$$ $$\left\{ {{a^m}{b^n}{c^p}{d^q}} \right.|m = n$$ and $$p=q,$$ where $$\left. {m,n,p,q \ge 0} \right\}$$
$$\,\,\,\,{\rm III}.\,\,\,\,\,\,\,$$ $$\left\{ {{a^m}{b^n}{c^p}{d^q}} \right.|m = n = p$$ and $$p \ne q,$$ where $$\left. {m,n,p,q \ge 0} \right\}$$
$$\,\,\,\,{\rm IV}.\,\,\,\,\,\,\,$$ $$\left\{ {{a^m}{b^n}{c^p}{d^q}} \right.|mn = p + q,$$ where $$\left. {m,n,p,q \ge 0} \right\}$$

Which of the languages above are context-free?

GATE CSE 2018
12
Consider the following context-free grammars:
$$\eqalign{ & {G_1}:\,\,\,\,\,S \to aS|B,\,\,B \to b|bB \cr & {G_2}:\,\,\,\,\,S \to aA|bB,\,\,A \to aA|B|\varepsilon ,\,\,B \to bB|\varepsilon \cr} $$

Which one of the following pairs of languages is generated by $${G_1}$$ and $${G_2}$$, respectively?

GATE CSE 2016 Set 1
13
Which of the following languages are context-free? $$$\eqalign{ & {L_1} = \left\{ {{a^m}{b^n}{a^n}{b^m}|m,n \ge 1} \right\} \cr & {L_2} = \left\{ {{a^m}{b^n}{a^m}{b^n}|m,n \ge 1} \right\} \cr & {L_3} = \left\{ {{a^m}{b^n}|m = 2n + 1} \right\} \cr} $$$
GATE CSE 2015 Set 3
14
Consider the following languages over the alphabet $$\sum { = \left\{ {0,\,1,\,c} \right\}:} $$
$$\eqalign{ & {L_1} = \left\{ {{0^n}\,{1^n}\,\left| {n \ge } \right.0} \right\} \cr & {L_2} = \left\{ {wc{w^r}\,\left| {w \in \left\{ {0,\,1} \right\}{}^ * } \right.} \right\} \cr & {L_3} = \left\{ {w{w^r}\,\left| {w \in \left\{ {0,\,1} \right\}{}^ * } \right.} \right\} \cr} $$

Here, $${w^r}$$ is the reverse of the string $$w.$$ Which of these languages are deterministic Context- free languages?

GATE CSE 2014 Set 3
15
Consider the $$DFA$$ $$A$$ given below. GATE CSE 2013 Theory of Computation - Push Down Automata and Context Free Language Question 25 English

Which of the following are FALSE?
$$1.$$ Complement of $$L(A)$$ is context - free.
$$2.$$ $$L(A)$$ $$ = \left( {{{11}^ * }0 + 0} \right)\left( {0 + 1} \right){}^ * {0^ * }\left. {{1^ * }} \right)$$
$$3.$$ For the language accepted by $$A, A$$ is the minimal $$DFA.$$
$$4.$$ $$A$$ accepts all strings over $$\left\{ {0,1} \right\}$$ of length at least $$2.$$

GATE CSE 2013
16
Consider the languages $${L_1}$$, $${L_2}$$ and $${L_3}$$ are given below. $$$\eqalign{ & {L_1} = \left\{ {{0^p}{1^q}\left| {p,q \in N} \right.} \right\} \cr & {L_2} = \left\{ {{0^p}{1^q}\left| {p,q \in N} \right.\,\,and\,\,p = q} \right\}\,\,and \cr & {L_3} = \left\{ {{0^p}{1^q}{0^r}\left| {p,q,r\, \in N\,\,\,and\,\,\,p = q = r} \right.} \right\}. \cr} $$$

Which of the following statements is not TRUE?

GATE CSE 2011
17
Consider the languages $$$\eqalign{ & {L_1} = \left\{ {{0^i}{1^j}\,\left| {i \ne j} \right.} \right\},\,{L_2} = \left\{ {{0^i}{1^j}\,\left| {i = j} \right.} \right\}, \cr & {L_3} = \left\{ {{0^i}{1^j}\,\left| {i = 2j + 1} \right.} \right\}, \cr & {L_4} = \left\{ {{0^i}{1^j}\,\left| {i \ne 2j} \right.} \right\}, \cr} $$$
GATE CSE 2010
18
Match the following List-$${\rm I}$$ with List - $${\rm II}$$

List-$${\rm I}$$
$$E)$$ Checking that identifiers are declared before their
$$F)$$ Number of formal parameters in the declaration of a function agrees with the number of actual parameters in a use of that function
$$G)$$ Arithmetic expression with matched pairs of parentheses
$$H)$$ Palindromes

List-$${\rm II}$$
$$P)$$ $$L = \left\{ {{a^n}{b^m}{c^n}{d^m}\,|\,n \ge 1,m \ge 1} \right\}$$
$$Q)$$ $$X \to XbX\,|\,XcX\,|\,dXf\,|g$$
$$R)$$ $$L = \left\{ {www\,|\,w \in \left( {a\,|\,b} \right){}^ * } \right\}$$
$$S)$$ $$X \to bXB\,|\,cXc\,|\,\varepsilon $$

GATE CSE 2008
19
Which of the following statement is false?
GATE CSE 2008
20
Which of the following statements are true?
$$1.$$ Every left-recursive grammar can be converted to a right-recursive grammar and vice-versa
$$2.$$ All ε-productions can be removed from any context-free grammar by suitable transformations
$$3.$$ The language generated by a context-free grammar all of whose productions are of the form $$X \to w$$ or $$X \to wY$$ (where, $$w$$ is a string of terminals and $$Y$$ is a non terminal), is always regular
$$4.$$ The derivation trees of strings generated by a context-free grammar in Chomsky Normal Form are always binary trees
GATE CSE 2008
21
Consider the $$CFG$$ with $$\left\{ {S,A,B} \right\}$$ as the non-terminal alphabet, $$\left\{ {a,b} \right\}$$ as the terminal alphabet, $$S$$ as the start symbol and the following set of production rules: GATE CSE 2007 Theory of Computation - Push Down Automata and Context Free Language Question 32 English

Which of the following strings is generated by the grammar?

GATE CSE 2007
22
Consider the $$CFG$$ with $$\left\{ {S,A,B} \right\}$$ as the non-terminal alphabet, $$\left\{ {a,b} \right\}$$ as the terminal alphabet, $$S$$ as the start symbol and the following set of production rules: GATE CSE 2007 Theory of Computation - Push Down Automata and Context Free Language Question 31 English

For the correct string of (earlier question) how many derivation trees are there?

GATE CSE 2007
23
The language $$L = \left\{ {{0^i}{{21}^i}\,|\,i \ge 0} \right\}$$ over the alphabet $$\left\{ {0,1,2} \right\}$$ is
GATE CSE 2007
24
Consider the following statements about the context-free grammar
$$G = \left\{ {S \to SS,\,S \to ab,\,S \to ba,\,S \to \varepsilon } \right\}$$
$$1.$$ $$G$$ is ambiguous
$$2.$$ $$G$$ produces all strings with equal number of $$a's$$ and $$b's$$
$$3.$$ $$G$$ can be accepted by a deterministic $$PDA$$.

Which combination below expresses all the true statements about $$G?$$

GATE CSE 2006
25
Let $${N_f}$$ and $${N_p}$$ denote the classes of languages accepted by non-deterministic finite automata and non-deterministic push-down automata, respectively. Let $${D_f}$$ and $${D_p}$$ denote the classes of languages accepted by deterministic finite automata and deterministic push-down automata, respectively. Which one of the following is TRUE?
GATE CSE 2005
26
Consider the language :
$${L_1} = \left\{ {{a^n}{b^n}{c^m}\left| {n,m > 0} \right.} \right\}$$ and $${L_2} = \left\{ {{a^n}{b^m}{c^m}\left| {n,m > 0} \right.} \right\}$$

Which of the following statement is FALSE?

GATE CSE 2005
27
Consider the language :
$${L_1}\, = \left\{ {w\,{w^R}\,\left| {w \in \left\{ {0,1} \right\}{}^ * } \right.} \right\}$$
$${L_2}\, = \left\{ {w\, \ne {w^R}\,\left| {w \in \left\{ {0,1} \right\}{}^ * } \right.} \right\}$$ where $$ \ne $$ is a special symbol
$${L_3}\, = \left\{ {w\,w\,\left| {w \in \left\{ {0,1} \right\}{}^ * } \right.} \right\}$$

Which one of the following is TRUE?

GATE CSE 2005
28
Let $$M = \left( {K,\,\sum {,\,F,\,\Delta ,\,s,\,F} } \right)$$ be a pushdown automation. Where $$K = \left\{ {s,\,f} \right\},\,F = \left\{ f \right\},\,\sum { = \left\{ {a,b} \right\},\,F = \left\{ a \right\}} $$ and $$\Delta = \left\{ {\left( {\left( {s,\,a,\, \in } \right)} \right.,\,\left. {\left( {s,\,a} \right)} \right),\,\left( {\left( {s,\,b,\, \in } \right),\,\left. {\left( {s,\,a} \right)} \right),\,} \right.} \right.$$ $$\left( {\left( {s,\,a,\, \in } \right),\,\left( {f,\, \in } \right),\,\left( {\left( {f,\,a,\,a} \right),\,\left. {\left( {f,\, \in } \right)} \right),\,\left( {\left( {f,\,b,\,a} \right),\,\left. {\left. {\left( {f,\, \in } \right)} \right)} \right\}} \right.} \right.} \right..$$

Which one of the following strings is not a number of $$L(M)?$$

GATE CSE 2004
29
The language $$\left\{ {{a^m}{b^n}{c^{m + n}}\left| {m,n \ge } \right.} \right\}$$ is
GATE CSE 2004
30
Consider the following grammar $$G:$$
$$\eqalign{ & S \to bS\,\left| {\,aA\,\left| {\,b} \right.} \right. \cr & A \to bA\,\left| {\,aB} \right. \cr & B \to bB\,\left| {\,aS\,\left| {\,a} \right.} \right. \cr} $$

Let $${N_a}\left( w \right)$$ and $${N_b}\left( w \right)$$ denote the number of $$a's$$ and $$b's$$ in a string $$w$$ respectively. The language
$$L\left( G \right)\,\,\, \subseteq \left\{ {a,b} \right\} + $$ generated by $$G$$ is

GATE CSE 2004
31
If $${L_1}$$ is a context free language and $${L_2}$$ is a regular which of the following is/are false?
GATE CSE 1999
32
Let $$L$$ be the set of all binary strings whose last two symbols are the same. The number of states in the minimum state deterministic finite-state automation accepting $$L$$ is
GATE CSE 1998
33
Which of the following statements is false?
GATE CSE 1998
34
Which of the following languages over $$\left\{ {a,b,c} \right\}$$ is accepted by Deterministic push down automata?
GATE CSE 1997
35
Let $$G$$ be a context free grammar where $$G = \left( {\left\{ {S,A,.B,C} \right\},\left\{ {a,b,d} \right\},P,S} \right)$$ with productions $$P$$ given below
$$\eqalign{ & S \to ABAC\,\,\,\,\,\,\,\,\,S \to aA{\mkern 1mu} \left| \varepsilon \right. \cr & S \to bB{\mkern 1mu} \left| \varepsilon \right.\,\,\,\,\,\,\,\,\,\,\,\,\,\,C \to d \cr} $$

($$\varepsilon $$ denotes the null string). Transform the given grammar $$G$$ to an equivalent context- free grammar $${G^1}$$ that has no $$\varepsilon $$ productions ($$A$$ unit production is of the from $$x \to y,\,x$$ and $$y$$ are non terminals).

GATE CSE 1996
36
If $${L_1}$$ and $${L_2}$$ are context free languages and $$R$$ a regular set, one of the languages below is not necessarily a context free language. Which one?
GATE CSE 1996
37
Which of the following features cannot be captured by context-free grammars?
GATE CSE 1994
38
Context-free languages are
GATE CSE 1992
39
Context free languages and regular languages are both closed under the operation(s) of :
GATE CSE 1989
40
FORTRAN is:
GATE CSE 1987
41
A context-free grammar is ambiguous if:
GATE CSE 1987
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