BCS 503_ Activity
BCS 503_ Activity
Student Name *
Aditya MM
Student USN *
1SB22AI003
A) Context-Free Grammar
A) The left side of every production must contain exactly one non-terminal.
C) The right side of every production must contain exactly one terminal.
Other:
A) S → Aa | Ab
B) A → 0 | 1
C) S → SS | a
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:
A) Strings of terminals
C) Only terminals
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
Correct answer
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
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
A) {a^n b^n | n ≥ 0}
C) {a^n | n ≥ 0}
14. Which of the following is true about the pumping lemma for context- 1/1
free languages?
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
A) Intersection
B) Complementation
C) Union
D) Reverse
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?
C) Regular grammars can have only one non-terminal on the left-hand side.
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
24. What is the pumping lemma used for in the context of context-free *1/1
languages?
Forms