ITPEC FE Morning April 2023 Question 5

Source exam: ITPEC FE Morning April 2023Topic: Basic Theory & Math

ITPEC FE Morning April 2023 — Question 5 of 80

BNF Variable Name Matching — identify which string matches a BNF grammar rule.

BNF rules given:
- <variable-name> starts with <letter>, followed by zero or more <letter-and-number>

- <letter> = A | B | C | D | E | F

- <letter-and-number> = <letter> | <number> | _

- <number> = 0–9

Key constraint: the first character must be a <letter> (A–F).

Check each option:
- _B39 — starts with _, not a letter ✗

- 246 — starts with a digit ✗

- 3E5 — starts with a digit ✗

- F5_1F (letter) + 5 (number) + _ + 1 (number) ✓

Answer: d) F5_1

Key rule: In BNF grammars, always check what the first production requires — here <variable-name> must begin with <letter>, which eliminates three options immediately.

AI-generated — may contain errors

The original exam layout is preserved in the image so diagrams, formulas, tables, and code remain accurate.

This question comes from an official ITPEC past paper. ITPEC Practice is an independent study tool and is not affiliated with ITPEC. See the official FE past-paper collection or Report an issue.