Computer Science Engineering (CSE) Exam  >  Computer Science Engineering (CSE) Test  >  Theory of Computation  >  Test: DPDA & Ambiguous Grammars - Computer Science Engineering (CSE) MCQ

DPDA & Ambiguous Grammars - Free MCQ Practice Test with solutions, GATE


MCQ Practice Test & Solutions: Test: DPDA & Ambiguous Grammars (10 Questions)

You can prepare effectively for Computer Science Engineering (CSE) Theory of Computation with this dedicated MCQ Practice Test (available with solutions) on the important topic of "Test: DPDA & Ambiguous Grammars". These 10 questions have been designed by the experts with the latest curriculum of Computer Science Engineering (CSE) 2026, to help you master the concept.

Test Highlights:

  • - Format: Multiple Choice Questions (MCQ)
  • - Duration: 10 minutes
  • - Number of Questions: 10

Sign up on EduRev for free to attempt this test and track your preparation progress.

Test: DPDA & Ambiguous Grammars - Question 1

CFGs are more powerful than:

Detailed Solution: Question 1

Context-free grammars are strictly more powerful than regular expressions:
1) Any language that can be generated using regular expressions can be generated by a context-free grammar.
2) There are languages that can be generated by a context-free grammar that cannot be generated by any regular expression.
As a corollary, CFGs are strictly more powerful than DFAs and NDFAs.

Test: DPDA & Ambiguous Grammars - Question 2

State true or false:S-> 0S1|01Statement: No regular expression exists for the given grammar.

Detailed Solution: Question 2

 The grammar generates a language L such that L={0n1n|n>=1} which is not regular. Thus, no regular expression exists for the same.

Test: DPDA & Ambiguous Grammars - Question 3

For the given set of code, the grammar representing real numbers in Pascal has error in one of the six lines. Fetch the error.

  1. (1) ->
  2. (2) -> | epsilon
  3. (3) -> | epsilon
  4. (4) -> ‘E’ | epsilon
  5. (5) -> + | – | epsilon
  6. (6) -> 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9

Detailed Solution: Question 3

Answer: Option A - 3

The production given in line 3 is incorrect because the fractional part of a real number must allow a decimal point followed by digits; the current line has no token for the decimal point.

The minimal correct form for the fractional part is: '.' digits | epsilon, where digits denotes one or more digits defined by line 6.

Line 6 correctly lists the digits. Line 5 correctly provides an optional sign. Line 4 supplies the exponent marker 'E' or epsilon, so the only syntactic error that must be fixed to allow fractional numbers is in line 3.

Therefore the erroneous line is 3.

Test: DPDA & Ambiguous Grammars - Question 4

Which among the following is incorrect with reference to a derivation tree?

Detailed Solution: Question 4

The root or interms of the grammar, starting variable can not be a terminal.

Test: DPDA & Ambiguous Grammars - Question 5

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?

Detailed Solution: Question 5

he step wise grammar translation can be written as:
aAS->aSbaA->aabAS->aabbaa

Test: DPDA & Ambiguous Grammars - Question 6

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?

Detailed Solution: Question 6

One language can more than one grammar. Some can be ambiguous and some cannot.

Test: DPDA & Ambiguous Grammars - Question 7

Which of the following are non essential while simplifying a grammar?

Detailed Solution: Question 7

Here are some process used to simplify a CFG but to produce an equivalent grammar:
a) Removal of useless symbols(non terminal) b) Removal of Unit productions and c) Removal of Null productions.

Test: DPDA & Ambiguous Grammars - Question 8

Which of the following are context free language?

Detailed Solution: Question 8

C is correct. Both languages are context-free.

For L1, a context-free grammar that generates the language is S → a S b | ε. This grammar produces strings with equal numbers of as followed by bs, so L1 is context-free.

For L2, a nondeterministic pushdown automaton (NPDA) recognises the language by nondeterministically guessing the midpoint: it pushes symbols of the first half of the input onto the stack, then switches to popping and matching symbols while reading the second half. This accepts exactly strings of the form wwr, so L2 is context-free.

Therefore both languages are context-free and the correct option is C.

Test: DPDA & Ambiguous Grammars - Question 9

The language L ={ai2bi|i>=0} is:

Detailed Solution: Question 9

The language is recursive and every recursive language is a CFL.

Test: DPDA & Ambiguous Grammars - Question 10

 L->rLt|tLr|t|r
The given grammar produces a language which is:

Detailed Solution: Question 10

As there exists no production for the palindrome set, even palindromes like abba, aabbaa, baaaaaab, etc will not be generated.

18 videos|100 docs|44 tests
Information about Test: DPDA & Ambiguous Grammars Page
In this test you can find the Exam questions for Test: DPDA & Ambiguous Grammars solved & explained in the simplest way possible. Besides giving Questions and answers for Test: DPDA & Ambiguous Grammars, EduRev gives you an ample number of Online tests for practice
18 videos|100 docs|44 tests
Download as PDF