Computer Science Engineering (CSE) Exam  >  Computer Science Engineering (CSE) Tests  >  Question Bank for GATE Computer Science Engineering  >  Test: Normal Forms of Context Free Grammar - Computer Science Engineering (CSE) MCQ

Test: Normal Forms of Context Free Grammar - Computer Science Engineering (CSE) MCQ


Test Description

10 Questions MCQ Test Question Bank for GATE Computer Science Engineering - Test: Normal Forms of Context Free Grammar

Test: Normal Forms of Context Free Grammar for Computer Science Engineering (CSE) 2024 is part of Question Bank for GATE Computer Science Engineering preparation. The Test: Normal Forms of Context Free Grammar questions and answers have been prepared according to the Computer Science Engineering (CSE) exam syllabus.The Test: Normal Forms of Context Free Grammar MCQs are made for Computer Science Engineering (CSE) 2024 Exam. Find important definitions, questions, notes, meanings, examples, exercises, MCQs and online tests for Test: Normal Forms of Context Free Grammar below.
Solutions of Test: Normal Forms of Context Free Grammar questions in English are available as part of our Question Bank for GATE Computer Science Engineering for Computer Science Engineering (CSE) & Test: Normal Forms of Context Free Grammar solutions in Hindi for Question Bank for GATE Computer Science Engineering course. Download more important topics, notes, lectures and mock test series for Computer Science Engineering (CSE) Exam by signing up for free. Attempt Test: Normal Forms of Context Free Grammar | 10 questions in 30 minutes | Mock test for Computer Science Engineering (CSE) preparation | Free important questions MCQ to study Question Bank for GATE Computer Science Engineering for Computer Science Engineering (CSE) Exam | Download free PDF with solutions
Test: Normal Forms of Context Free Grammar - Question 1

Let G = (V, T, S, P) be any context-free grammar without any λ-productions or unit productions. Let K be the maximum number of symbols on the right of any production in P. The maximum number of production rules for any equivalent grammar in Chomsky normal form is given by:
Where |⋅| denotes the cardinality of the set.

Detailed Solution for Test: Normal Forms of Context Free Grammar - Question 1

Concept:
Context free grammar : A grammar G = (V, T ,S, P) is said to be context- free if all productions in P have the form A -> x where A ϵ V and x ϵ (V U T)*.
If context free grammar G = (V, T, S, P) is without λ-productions or unit productions.
K = maximum number of symbols on right side of production.
The maximum number of production rules for equivalent grammar in CNF:
(K - 1)|P| + |T|
A context free grammar is in CNF (Chomsky normal form) if it satisfies these conditions:
1) Should not contains null or unit productions.
2) A non-terminal symbol generating two non-terminals. For example, S -> AB
3) A non- terminal generating a terminal. Example: S -> a

Test: Normal Forms of Context Free Grammar - Question 2

One of the uses of CNF is to turn parse tree into:

Detailed Solution for Test: Normal Forms of Context Free Grammar - Question 2

CNF (Chomsky’s normal form). A grammar is in the form of CNF is as follows:
S → AB
S → a
Where A, B are non-terminals and a is the terminal.
All productions should be of length 2.

  • In this, first eliminate useless symbols for CNF. Eliminate the null productions and unit productions.
  • In CFL it is possible to find atmost two short substrings that we can pump i times for any integer i.
  • Pumping Lemma for CFL is used to examine the size of parse trees. One of the uses of CNF is to turn the parse into binary trees. 
1 Crore+ students have signed up on EduRev. Have you? Download the App
Test: Normal Forms of Context Free Grammar - Question 3

A CFG (Context Free Grammar) is said to be in Chomsky Normal Form (CNF), if all the productions are of the form A → BC or A → a. Let G be a CFG in CNF. To derive a string of terminals of length x, the number of products to be used is

Detailed Solution for Test: Normal Forms of Context Free Grammar - Question 3

Concept:
A context-free grammar is in Chomsky Normal Form if all productions are of the form
A → BC or A → a
{A, B, C} ϵ V and a ϵ T
V is variable(non-terminal) and a is terminal

Formula:
n = 2x - 1
number of productions required to generates string of length x.
where x is the length of the string

Production:
S → XY
X → a
Y → b
Derive the string ab
S → XY
S → aY
S → ab
Number of productions needed = 3
Verification
2x - 1 = 2(2) - 1 = 3

Test: Normal Forms of Context Free Grammar - Question 4

What is the minimum number of productions present in the below given context free grammar to make it Chomsky Normal Form?
S → XYx
X → xxy
Y → Xz

Detailed Solution for Test: Normal Forms of Context Free Grammar - Question 4

Concepts:
A context-free grammar is in Chomsky Normal Form if all productions are of the form
A → BC or A → a
{A, B, C} ϵ V and a ϵ T
V is variable(non-terminal) and a is terminal

Calculation:
S → XA
A → YB
B → x
X → BC
C → BD
D → y
Y → XE
E → z

*Answer can only contain numeric values
Test: Normal Forms of Context Free Grammar - Question 5

If a Context Free Grammar G is in Chomsky Normal Form, to derive a string of length 101 number of productions needed is _____.


Detailed Solution for Test: Normal Forms of Context Free Grammar - Question 5

Concepts:
A context-free grammar is in Chomsky Normal Form if all productions are of the form
A → BC or A → a
{A, B, C} ϵ V and a ϵ T
V is variable(non-terminal) and a is terminal

Data:
x = 101
n → number of productions required to generates string of length x.

Formula:
n = 2x – 1
where x is the length of the string

Calculation:
n = 2(101) – 1
∴ n = 201

Test: Normal Forms of Context Free Grammar - Question 6

 The format: A->aB refers to which of the following?

Detailed Solution for Test: Normal Forms of Context Free Grammar - Question 6

A context free grammar is in Greibach Normal Form if the right hand sides of all the production rules start with a terminal, optionally followed by some variables.

Test: Normal Forms of Context Free Grammar - Question 7

Every grammar in Chomsky Normal Form is:

Detailed Solution for Test: Normal Forms of Context Free Grammar - Question 7

Conversely, every context frr grammar can be converted into Chomsky Normal form and to other forms.

Test: Normal Forms of Context Free Grammar - Question 8

Given grammar G:

  1. S->AS
  2. S->AAS
  3. A->SA
  4. A->aa

Which of the following productions denies the format of Chomsky Normal Form?

Detailed Solution for Test: Normal Forms of Context Free Grammar - Question 8

The correct format: A->BC, A->a, X->e.

Test: Normal Forms of Context Free Grammar - Question 9

With reference to the process of conversion of a context free grammar to CNF, the number of variables to be introduced for the terminals are:
S->ABa
A->aab
B->Ac

Detailed Solution for Test: Normal Forms of Context Free Grammar - Question 9

According to the number of terminals present in the grammar, we need the corresponding that number of terminal variables while conversion.

Test: Normal Forms of Context Free Grammar - Question 10

Let G be a grammar. When the production in G satisfy certain restrictions, then G is said to be in ___________

Detailed Solution for Test: Normal Forms of Context Free Grammar - Question 10

When the production in G satisfy certain restrictions, then G is said to be in ‘normal form’.

63 videos|7 docs|165 tests
Information about Test: Normal Forms of Context Free Grammar Page
In this test you can find the Exam questions for Test: Normal Forms of Context Free Grammar solved & explained in the simplest way possible. Besides giving Questions and answers for Test: Normal Forms of Context Free Grammar, EduRev gives you an ample number of Online tests for practice

Top Courses for Computer Science Engineering (CSE)

Download as PDF

Top Courses for Computer Science Engineering (CSE)