Match the following based on the lengths of strings in the language accepted (using the brute-force method of parsing).
Choose the correct answer from the options given below:
| List I | List II |
|---|---|
| a. S → aSa | aa | I. ((2n × 3) − 4); n ≥ 1 |
| b. S → aaSaa | aa | II. 2n; n ≥ 1 |
| c. S → aaaSaaa | aa | III. ((4 × 2n) − 6); n ≥ 1 |
| d. S → aaaaSaaaa | aa | IV. 2n − 2; n ≥ 2 |
Pick an option to check yourself, or open the answer below.
Show answer & explanation
Correct answer: B. a-II, b-IV, c-I, d-III
Explanation
Lengths: a gives 2, 4, 6, … = 2n (II); c gives 2, 8, 14, … = 6n − 4 (I); d gives 2, 10, 18, … = 8n − 6 (III); b (2, 6, 10, …) takes the remaining IV. Read the List II expressions with 2n as a product.More Theory of Computation and Compilers questions
- What is the safest order for simplifying a context-free grammar?
- What is the move in the cell numbered M1 of the table?
- What is the move in the cell numbered M2 of the table?
- What is the move in the cell numbered M3 of the table?
- What is the move in the cell numbered M4 of the table?
- What is the move in the cell numbered M5 of the table?