9618/31/M/J/25 question 7: worked solution (May/June 2025, paper 31)
Show as plain textHide plain text
Cambridge A2 Level Computer Science 9618 · 16.2 Translation Software Worked solution from the System Software Paper 3 Advanced Theory booklet, Part 2 of 2. Q33 9618/31/M/J/25 original Q7 Structured · 6 marks Worked solution (a) Check each passcode against the passcode diagram: it starts with an uppercase letter, then any number of lowercase letters, symbols or digits. #Jd7: it begins with a symbol , but it must begin with an uppercase letter [1] C%6A: the fourth character A is uppercase , but after the first character only lowercase, symbol or digit are allowed [1] (b) The loop in the diagram becomes a recursive rule in BNF. <uppercase> ::= A | C | E | G | J <passcode> ::= <uppercase><code> <code> ::= <lowercase> | <symbol> | <digit> | <lowercase><code> | <symbol><code> | <digit><code> <uppercase> ::= A | C | E | G | J [1] <passcode> ::= <uppercase><code> (an uppercase letter followed by the repeating part) [1] <code> includes the three single options <lowercase> | <symbol> | <digit> [1] <code> includes the three recursive options, each followed by <code> [1] KEY IDEA A repeating loop in a syntax diagram is written in BNF as a rule that calls itself. TOTAL 6 marks Official mark scheme VIDEO ▶ Topic lesson A lesson on this topic · by Craig'n'Dave. Tap the picture to open it on YouTube.