9618/11/O/N/23 question 6: worked solution (October/November 2023, paper 11)
Show as plain textHide plain text
Cambridge AS Level Computer Science 9618 · 5.2 Language Translators Worked solution from the System Software Paper 1 Theory Fundamentals booklet, Part 2 of 2. Q18 9618/11/O/N/23 original Q6 Structured · 9 marks Worked solution (a) Compare the interpreter with the compiler. Write four of these: The interpreter makes the program easier to debug [1] ... because it translates line by line and stops when an error is found , while a compiler translates everything at once [1] ... it reports only one error at a time , so the error can be corrected in real time [1] The program can restart at the same point after a fix, but a compiled program must be recompiled and re-run [1] Other accepted points: effects of changes are seen immediately; a partly finished program can be translated and tested on its own. (b) Write one of these: Partially compiled programs can be used on different platforms because they are interpreted when run [1] Other accepted: code is optimised for the CPU as machine code is made at run time; the source does not need recompiling, so it is more efficient. (c)(i) Write any two features for presenting code: Prettyprint [1] Expand/collapse code blocks [1] Auto indentation / formatting also scores. (c)(ii) Write any two features for debugging: Single stepping [1] Breakpoints [1] Report window and variable expressions also score. KEY IDEA An interpreter translates line by line, so errors are found and fixed in real time, even in unfinished programs. TOTAL 9 marks Official mark scheme VIDEO ▶ Starts at Q6 (1:04:09) Starts at Q6 (1:04:09) · by Pseudocode Pro. Tap the picture to open it on YouTube.