0% found this document useful (0 votes)
2 views

BCS 503_ Activity

Uploaded by

ff7680142
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

BCS 503_ Activity

Uploaded by

ff7680142
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

BCS 503_ Activity Total points 23/24

Student Name *

Aditya MM

Student USN *

1SB22AI003

1.What does CFG stand for? * 1/1

A) Context-Free Grammar

B) Contextual Formal Grammar

C) Contextual Free Grammar

D.Contextual Format Grammar


2. Which of the following is a feature of a context-free grammar? * 1/1

A) The left side of every production must contain exactly one non-terminal.

B) The left side of every production can contain multiple non-terminals.

C) The right side of every production must contain exactly one terminal.

D) There are no restrictions on the left side of the production.

Other:

3. Which of the following is a valid context-free grammar production? * 1/1

A) S → Aa | Ab

B) A → 0 | 1

C) S → SS | a

D) All of the above

4. What is the Chomsky Normal Form (CNF) for a context-free *1/1


grammar?

A) Every production has a single non-terminal on the right-hand side.

B) Every production has either two non-terminals or a terminal on the right-hand


side.

C) Every production has a terminal on the left-hand side.

D) Every production is of the form S → a or S → AB.

Other:
5. Which of the following grammars is not context-free? * 1/1

A) A → aA | b

B) S → aSb | ε

C) S → SS

D) A → aA | aB

Other:

6. What does a context-free grammar generate? * 1/1

A) Strings of terminals

B) Strings of terminals and non-terminals

C) Only terminals

D) A set of terminal symbols

7. Which of the following is the correct set of CFG components? * 1/1

A) Set of variables, set of terminals, set of production rules, and a start symbol

B) Set of variables, set of terminals, set of production rules, and a set of strings

C) Set of variables, set of terminals, set of production rules, and a set of terminals

D) Set of variables, set of terminals, start symbol, and a set of variables


8. Which of the following is a property of a context-free grammar? * 0/1

A) It generates a regular language.

B) It is closed under intersection.

C) It can describe all programming languages.

D) It cannot generate a language that is not regular.

Correct answer

C) It can describe all programming languages.

9. Which of the following CFG productions is in Chomsky Normal Form *1/1


(CNF)?

A) S → Aa | Bb

B) S → AB | a

C) S → A | a | b

D) S → a | AB
10. In context-free grammars, which of the following symbols can be on *1/1
the right-hand side of a production?

A) Only terminals

B) Only non-terminals

C) A mixture of terminals and non-terminals

D) Only the start symbol

Other:

11. What type of languages does context-free grammar (CFG) describe? * 1/1

A) Regular languages

B) Context-sensitive languages

C) Context-free languages

D) Recursively enumerable languages

12. Which of the following is an example of a non-context-free *1/1


language?

A) {a^n b^n | n ≥ 0}

B) {a^n b^n c^n | n ≥ 0}

C) {a^n | n ≥ 0}

D) {w | w contains an even number of a’s and b’s}


13. What is a parse tree in the context of context-free grammars? *

A) A tree that represents the syntactic structure of a string

B) A tree that generates the string

C) A diagram showing the non-terminal symbols

D) A diagram representing the left-most derivation

14. Which of the following is true about the pumping lemma for context- 1/1
free languages?

A) It can be used to prove that a language is regular.

B) It can be used to prove that a language is context-free.

C) It cannot be used to prove that a language is context-free.

D) It is applicable to finite automata.

15. Which of the following is a valid derivation for the string “aa” from the *1/1
grammar S → aS | bS | ε?

A) S → aS → aa

B) S → aS → bS → aa

C) S → aS → a

D) S → aS → ε
16.What type of language is generated by a context-free grammar with *1/1
productions that only contain one terminal symbol on the right-hand
side?

A) Regular language

B) Context-free language

C) Context-sensitive language

D) Finite language

17. A context-free grammar is closed under which of the following *1/1


operations?

A) Intersection

B) Complementation

C) Union

D) Reverse

18. Which of the following grammars is a proper example of a context- *1/1


free grammar?

A) S → SS | a

B) A → aA | bB | a

C) S → aS | A

D) S → S | aS
19. What is the primary difference between context-free and regular *1/1
grammars?

A) Regular grammars cannot contain non-terminal symbols.

B) Context-free grammars can have non-terminals on both sides of a production.

C) Regular grammars can have only one non-terminal on the left-hand side.

D) Context-free grammars allow recursion, while regular grammars do not.

20. Which of the following is not a valid context-free grammar *1/1


production?

A) S → aSb

B) S → aA | bA

C) S → a | b | c

D) A → aA | A | ε

21. What does the "start symbol" in a context-free grammar represent? * 1/1

A) It is the first production in the grammar.

B) It is the non-terminal from which the derivation of strings begins

C) It is the last non-terminal in the grammar.

D) It is a terminal symbol used to conclude a derivation.


22. Which of the following statements about context-free grammars is *1/1
true?

A) Context-free grammars can describe any recursively enumerable language.

B) Context-free grammars can only describe regular languages.

C) Context-free grammars cannot describe palindromes.

D) Context-free grammars can describe many programming languages.

23. Which of the following is not a characteristic of a context-free *1/1


language?

A) It can be recognized by a pushdown automaton.

B) It can be described by a context-free grammar.

C) It can be recognized by a finite automaton.

D) It can be parsed using a parse tree.

24. What is the pumping lemma used for in the context of context-free *1/1
languages?

A) To prove that a language is regular

B) To prove that a language is context-free

C) To prove that a language is non-context-free

D) To define the structure of a CFG


25. What does a derivation in a context-free grammar refer to? * 1/1

A) The process of creating a string by applying production rules.

B) The process of evaluating the expression.

C) The process of transforming terminals to non-terminals.

D) The process of simplifying the grammar.

This form was created inside of Sri Sairam College of Engineering.


Does this form look suspicious? Report

Forms

You might also like