You are on page 1of 6

Sample CFG/ PDA Questions

A pushdown automaton employs ________datastructure.


a)Queue
b)LinkedList
c)HashTable
d)Stack
--------------------------------------------------------------------------------
.State true or false:
Statement:TheoperationsofPDAneverworkonelements,otherthanthetop.
a)true
b)false
--------------------------------------------------------------------------------
Which among the following is not a part of the Context free grammar tuple?
a) End symbol
b) Start symbol
c) Variable
d) Production
--------------------------------------------------------------------------------
A context free grammar is a ___________
a) English grammar
b) Regular grammar
c) Context sensitive grammar
d) None of the mentioned

--------------------------------------------------------------------------------
The production of the form A->B , where A and B are non terminals is called
a) Null production
b) Unit production
c) Greibach Normal Form
d) Chomsky Normal Form
--------------------------------------------------------------------------------

Which of the following correctly recognize the symbol ‘|-‘ in context to PDA?
a) Moves
b) transition function
c) or/not symbol
d) none of the mentioned
--------------------------------------------------------------------------------
Which of the following option resembles the given PDA?

a) {0n1n|n>=0}
b) {0n12n|n>=0}
c) {02n1n|n>=0}
d) None of the mentioned
--------------------------------------------------------------------------------

Which of the following correctly resembles the given state diagram?

a) {w| w in (a+b)* and w=wr. i.e., w reads same backwards and forwards.}
b) ε is called the initial stack symbol
c) {wwr|w=(a+b)*}
d) None of the mentioned
--------------------------------------------------------------------------------
Which of the following assertion is false?
a) If L is a language accepted by PDA1 by final state, there exist a PDA2 that accepts L by empty
stack i.e. L=L(PDA1)=L(PDA2)
b) If L is a CFL then there exists a push down automata P accepting CF; ; by empty stack i.e.
L=M(P)
c) Let L is a language accepted by PDA1 then there exist a CFG X such that L(X)=M(P)
d) None of the mentioned
--------------------------------------------------------------------------------
Which of the following is the correct representation of grammar for the given regular expression?
a(aUb)*b
a)
(1)S→aMb
(2)M→Mab
(3)M→aM
(4)M→bM
b)
(1)S→aMb
(2)M→ ε
(3)M→aM
(4)M→bM
c)
(1)S→aMb
(2)M→ ε
(3)M→aMb
(4)M→bMa

d) None of the above


--------------------------------------------------------------------------------
State true or false:
S-> 0S1|01
Statement: No regular expression exists for the given grammar.
a) true
b) false
--------------------------------------------------------------------------------
Let G=(V, T, P, S)
where a production can be written as:
S->aAS|a
A->SbA|ba|SS
Which of the following string is produced by the grammar?
a) aabbaab
b) aabbaa
c) baabab
d) None of the mentioned
--------------------------------------------------------------------------------
Statement 1: Ambiguity is the property of grammar but not the language.
Statement 2: Same language can have more than one grammar.
Which of the following options are correct with respect to the given statements?
a) Statement 1 is true but statement 2 is false
b) Statement 1 is false but statement 2 is true
c) Both the statements are true
d) Both the statements are false
--------------------------------------------------------------------------------
Which of the following are non essential while simplifying a grammar?
a) Removal of useless symbols
b) Removal of unit productions
c) Removal of null production
d) None of the mentioned
--------------------------------------------------------------------------------
L->rLr | tLt | t | r
The given grammar produces a language which is:
a) All palindromes
b) All even-length palindromes
c) All odd-length palindromes
d) Strings with same begin and end symbols
--------------------------------------------------------------------------------

Given Grammar: S->A, A->aA, A-> ε, B->bA


Which among the following productions are Useless productions?
a) S->A
b) A->aA
c) A-> ε
d) B->bA

--------------------------------------------------------------------------------
Given grammar G:
S->aS|A|C
A->a
B->aa
C->aCb
Find the set of variables that can produce strings only with the set of terminals.
a) {C}
b) {A,B}
c) {A,B,S}
d) None of the mentioned
--------------------------------------------------------------------------------
In order to simplify a context free grammar, we can skip the following operation:
a) Removal of null production
b) Removal of useless symbols
c) Removal of unit productions
d) None of the mentioned
--------------------------------------------------------------------------------

The variable which produces an epsilon is called:


a) empty variable
b) nullable
c) terminal
d) all of the mentioned
--------------------------------------------------------------------------------
In context to the process of removing useless symbols, which of the following is correct?
a) We remove the Nullable variables
b) We eliminate the unit productions
c) We eliminate products which yield no terminals
d) All of the mentioned
--------------------------------------------------------------------------------
Simplify the given grammar:
S->aXb
X->aXb | ε
a) S->aXb | ab, X-> aXb | ab
b) S->X | ab, X-> aXb | ab
c) S->aXb | ab, X-> S | ab
d) None of the mentioned
--------------------------------------------------------------------------------
Given Grammar:
T-> T+R| R
R-> R*V| V
V->(T)| u
When unit productions are deleted we are left with
T-> T+R| _______|(T)| u
R->R*V|(T)| u
V-> (T)| u
Fill in the blank:
a) T*V
b) T+V
c) R*T
d) R*V
--------------------------------------------------------------------------------
Given grammar G:
S-> ABA, A->aA| ε, B-> bB| ε
Eliminate ε and unit productions.

--------------------------------------------------------------------------------

Given grammar G:
S-> A| B| C
A-> aAa| B
B-> bB|bb
C->aCaa|D
D->baD|abD|aa
Eliminate ε and unit productions

--------------------------------------------------------------------------------
Every grammar in Chomsky Normal Form is:
a) regular
b) context sensitive
c) context free
d) all of the mentioned

You might also like