logo

AQA A-Level Computer Science practice

Given the production rules <letter> ::= "a" | "b" and <word> ::= <letter> | <letter> <word>, which string can be generated?

Try the question first, then check the answer and practise the same topic again.

At a glance

MCQ

Type

practice

Style

Topic

Context-free languages

Exam-style question

Try this first

Given the production rules <letter> ::= "a" | "b" and <word> ::= <letter> | <letter> <word>, which string can be generated?.

  1. A.aba
  2. B.abc
  3. C.baa1
  4. D.empty string

Answer and explanation

Concise answer

aba

Why this is correct

Each word consists of one or more letters, and each letter must be either "a" or "b". Therefore, "aba" can be generated.

Use the concise answer above for a quick check, then reveal the full model answer and detailed explanation.

Common mistake

No common mistake is linked to this question yet.

Related flashcards

No flashcards are published for this page yet.

Related practice questions