9618/22/M/J/21 question 2: worked solution (May/June 2021, paper 22)
Show as plain textHide plain text
Cambridge AS Level Computer Science 9618 · 12.2 Program Design Worked solution from the Software Development Paper 2 Problem-solving and Programming booklet, Part 2 of 3. Q11 9618/22/M/J/21 original Q2 Structured · 11 marks Worked solution (a)(i) Count the arrows in the diagram. S1 to S2, S2 to S3 and S1 to S3 change state; the loop on S2 does not. The two arrows with | Activate pump and | Deactivate pump have outputs. The arrow into S1 from the dot is the start arrow. The double circle is the end state. Answer The number of transitions that result in a different state 3 The number of transitions with associated outputs 2 The label that should replace 'X' Start The final or halting state S3 Different state: 3 [1] Transitions with outputs: 2 [1] Label for X: Start [1] Final state: S3 [1] (a)(ii) From S1, the first Low level detected goes to S2 and activates the pump (one output). The next three Low level detected inputs loop on S2 and give no output. Number of outputs: 1 [1] Current state: S2 [1] (b)(i) Write three items that belong to one loan, such as User ID (or username), Book ID and date of loan (or return date). At least one correct item [1] All three correct items [1] (b)(ii) Write data the system needs but that is not part of each loan, for example: The user's name (or address or phone number), or the book title (or author, ISBN, publisher, rack number). Any one of these. [1] (b)(iii) Write two other things the system does to the loan data, any two of: Create a loan (borrow a book) [1] Return a book (or send an email or letter to a user about an overdue book, or view the loan history of a book or user) [1] KEY IDEA Read a state-transition diagram arrow by arrow: input before the bar, output after it, and an arrow back to the same state is a loop. TOTAL 11 marks Official mark scheme VIDEO ▶ Whole paper Video solution of the whole paper · by Papersdock. Tap the picture to open it on YouTube.