Paper Tayyari

Lecture 31: Context Free Grammar (CFG)

MCQs, short and long questions from lecture 31.Lecture 31 ki MCQs, short aur long sawal.

31 MCQs · 3 short · 2 long questions · 31 MCQs from past papers31 MCQs · 3 short · 2 long sawal · 31 MCQs past papers se

Start mock testMock test shuru karein
DoneHal kiye 0/31
– correctsahi
1.
★ Final term Fall 2012

In CFG, the symbols that can't be replaced by anything are called ________.

  1. ATerminal
  2. BNon-Terminal
  3. CProduction
  4. DAll of given

Terminals are the final letters of words and are never rewritten.

2.
★ Final term Spring 2010

Left hand side of a production in CFG consists of:

  1. AOne terminal
  2. BMore than one terminal
  3. COne non-terminal
  4. DTerminals and non-terminals

Every CFG production rewrites exactly one nonterminal.

3.
★ Final term Spring 2007

The symbols that cannot be replaced by anything are called terminals

  1. ATrue
  2. BFalse

Terminals are never rewritten.

4.
★ Final term Spring 2005

CFG given S → bS | Sb | aa represents language

  1. Ab*aa
  2. Baab*
  3. Cb*aab*
  4. Db*(aa)*b*

b's can be added on either side of the single aa, giving b*aab*.

5.
★ Final term past paper

In CFG, the symbols that cannot be replaced by anything are called

  1. ATerminals
  2. BNon terminals
  3. CProductions
  4. DNone of the given options

Terminals are never rewritten.

6.
★ Final term past paper

The grammatical rules which involves meaning of words are called:

  1. ASemantic
  2. BSytactics
  3. CAlphabets
  4. DNone of the given options

Rules about meaning are semantics; rules about form are syntax.

7.
★ Final term past paper

The CFG S --> aSa | bSb | a | b | Λ represents the language

  1. AEVEN-EVEN
  2. BPALINDROME
  3. CEQUAL
  4. DODD-ODD

Adding the same letter on both sides around a, b or Λ builds every palindrome.

8.
★ Final term past paper

The major problem in the earliest computers was

  1. ATo store the contents in the registers
  2. BTo display mathematical formulae
  3. CTo load the contents from the registers
  4. DTo calculate the mathematical formula

The handout says early computers had trouble handling mathematical formulae, which led to grammars and parsing.

9.
★ Final term past paper

The production S --> SS | a | b | Λ can be expressed by RE

  1. A(a+b)+
  2. B(a+b)
  3. C(a+b)*
  4. D(ab)*

S can produce any sequence of a's and b's, including Λ.

10.
★ Final term past paper

"CFG" stands for ________

  1. AContext Free Graph
  2. BContext Free Grammar
  3. CContext Finite Graph
  4. DContext Finite Grammar

CFG means Context Free Grammar.

11.
★ Final term past paper

The high level language is converted into assembly language codes by a program called compiler.

  1. ATRUE
  2. BFALSE

A compiler translates high-level code into lower-level code.

12.
★ Final term past paper

Grammatical rules which involve the meaning of words are called ________

  1. ASemantics
  2. BSyntactic
  3. CBoth a and b
  4. DNone of given

Rules about meaning are semantics.

13.
★ Final term past paper

Grammatical rules which do not involve the meaning of words are called ________

  1. ASemantics
  2. BSyntactic
  3. CBoth a and b
  4. DNone of given

Rules about form only are syntactic rules.

14.
★ Final term past paper

The symbols that must be replaced by other things are called ________

  1. AProductions
  2. BTerminals
  3. CNon-terminals
  4. DNone of given

Nonterminals must be rewritten before a word is reached.

15.
★ Final term past paper

The grammatical rules are often called ________

  1. AProductions
  2. BTerminals
  3. CNon-terminals
  4. DNone of given

Grammar rules are called productions.

16.
★ Final term past paper

The terminals are designated by ________ letters, while the non-terminals are designated by ________ letters.

  1. ACapital, bold
  2. BSmall, capital
  3. CCapital, small
  4. DSmall, bold

By convention terminals are lowercase and nonterminals uppercase.

17.
★ Final term past paper

The language generated by ________ is called Context Free Language (CFL).

  1. AFA
  2. BTG
  3. CCFG
  4. DTGT

A CFL is the language generated by a CFG.

18.
★ Final term past paper

Σ = {a,b} Productions S → XaaX, X → aX, X → bX, X → Λ. This grammar defines the language expressed by ________

  1. A(a+b)*aa(a+b)*
  2. B(a+b)*a(a+b)*a
  3. C(a+b)*aa(a+b)*aa
  4. D(a+b)*ab(a+b)*

X generates (a+b)*, so XaaX gives (a+b)*aa(a+b)*.

19.
★ Final term past paper

Consider the Following CFG: (NOTE: Λ means NULL) S->Xa X->aX|bX|Λ above given CFG can be represented by RE

  1. Aa*b*
  2. Ba*b*a
  3. C(a+b)*a
  4. Da(a+b)*a

X gives (a+b)*, followed by a final a.

20.
★ Final term past paper

The langue generated by CFG is called Context free language (CFL)

  1. AFalse
  2. BTrue

A CFG generates a context free language.

21.
★ Final term past paper

The symbols that can't be replaced by anything are called -----------------

  1. AProductions
  2. BTerminals
  3. CNon-terminals
  4. DAll of above

Terminals cannot be replaced.

22.
★ Final term past paper

S → aXb|bXa X → aX|bX|Λ The given CFG generates the language of strings in English

  1. ABeginning and ending in different letters
  2. BBeginning and ending in same letter
  3. CHaving even-even language
  4. DNone of given

Words are a…b or b…a.

23.
★ Final term past paper

One language can have ……… CFG(s)

  1. AAt least one
  2. BAt least two
  3. CAt least three
  4. DNone of them

A CFL has at least one (in fact many) CFGs.

24.
★ Final term past paper

The language generated by the CFG is called the language ……by the CFG

  1. AProduced
  2. BNull string
  3. CPumping lemma
  4. DNon of then

It is the language produced (generated) by the CFG.

25.
★ Final term past paper

In CFG, the symbols that cannot be replaced by anything are called:

  1. ANone terminals
  2. BInfinite
  3. CFinite
  4. DTerminals

Terminals cannot be replaced.

26.
★ Final term past paper

The production S --> SS | a | b | Λ can be expressed by RE:

  1. A(a+b)+
  2. Ba-b
  3. C(a-b)+
  4. DNone of them

It generates (a+b)* (including Λ), which is not listed.

27.
★ Final term past paper

The same non terminals can be written in single line if they have more than one..........

  1. AProductions
  2. BRegular production
  3. CNone regular production

Productions with the same left side can be combined with |.

28.
★ Final term past paper

There is at least one production that has one........on its left side:

  1. ATerminal
  2. BInfinite
  3. CNone Terminal
  4. DAll of above

A CFG has at least one production with the start non-terminal S on its left.

29.
★ Final term past paper

Left hand side of CFG may consist of:

  1. AOne terminal
  2. BMore than one terminal
  3. COne non-terminal
  4. DTerminals and non-terminals

One non-terminal on the left side.

30.
★ Final term past paper

The language generated by CFG is called ________.

  1. AInfinite
  2. BContext Free Language (CFL)
  3. CRegular
  4. DFinite

By definition the language generated by a context free grammar is a context free language.

31.
★ Final term past paper

Left hand side of a production in Context free grammar (CFG) consists of ________.

  1. AOne terminal
  2. BMore than one terminal
  3. COne non-terminal
  4. DTerminals and non-terminals

In a CFG every production has exactly one nonterminal on its left side.