logo

AQA A-Level Computer Science practice

A syntax diagram has a path from Start to End that passes through "A" and then an optional section containing "B". Which set contains all the strings accepted by this diagram?

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

A syntax diagram has a path from Start to End that passes through "A" and then an optional section containing "B". Which set contains all the strings accepted by this diagram?.

  1. A.A and AB
  2. B.B and BA
  3. C.A only
  4. D.AB only

Answer and explanation

Concise answer

A and AB

Why this is correct

The diagram requires "A" and allows the section containing "B" to be skipped or followed. The accepted strings are therefore "A" and "AB".

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