9618/31/M/J/23 question 6: worked solution (May/June 2023, paper 31)

Show as 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. Q22 9618/31/M/J/23 original Q6 Structured · 8 marks Worked solution (a) A password is letters (A, D, P, R, Y), then digits, then symbols ($, %, &, @, #), each part repeated or skipped as the diagram allows, in that order. DPAD99$: valid , because it is several letters, then several digits, then a symbol [1] DAD#95: invalid , because the symbol comes before the digits; it should be after [1] ADY123?: invalid , because ? is not a valid symbol [1] (b) Write each list with |: <symbol> ::= $ | % | & | @ | # <letter> ::= A | D | P | R | Y Both lines correct (all five symbols and all five letters, no extras) [1] (c) The diagram starts with a letter box that can be repeated, then a digit box that can be repeated or skipped. Draw a diagram named identifier , with an arrow in and an arrow out. It starts with a letter box [1] A loop around the letter box lets the letter repeat , and a digit box follows (digit present) [1] A loop around the digit box lets the digit repeat , and a bypass line lets it be skipped [1] Correct structure: name, boxes and arrows in and out [1] Another accepted layout: letter, then a second letter box with a loop, then a digit box with a loop and a bypass. KEY IDEA In a syntax diagram, a loop means repeat and a bypass line means optional. TOTAL 8 marks Official mark scheme VIDEO ▶ Whole paper Video solution of the whole paper · by qiphyedu. Tap the picture to open it on YouTube.