Question 5

AQA Computer Science November 2021 Paper 1 (8520/1)GCSE13 marks

On the specification

5.1
3.4 Computer systems
5.2
3.4 Computer systems
5.3
3.1 Fundamentals of algorithms3.2 Programming
Question text

5 1 box . The following are three types of program translator: A Assembler B Compiler C Interpreter Write the label (A–C) for the type of translator next to the description. [2 marks] Description Label (A–C) Converts a low-level language designed to be human-readable into machine code. Reads a high-level program line-by-line and calls corresponding subroutines. Takes the entire high-level program as input and produces machine code. 5.2 State two advantages of programming using a high-level language compared with programming using a low-level language. [2 marks] Advantage 1 Advantage 2 5.3 Develop an algorithm, using either pseudo-code or a flowchart, that checks if the user box has entered a string that represents a valid machine code instruction. The machine code instruction is valid if it contains exactly eight characters and all of those characters are either '0' or '1'. The algorithm should: • prompt the user to enter an 8-bit machine code instruction and store it in a variable • check that the instruction only contains the characters '0' or '1' • check that the instruction is exactly eight characters long • output 'ok' when the instruction is valid, otherwise it should output 'wrong'. For example: • if the user enters the string '00101110' it should output 'ok' • if the user enters the string '11110' it should output 'wrong' • if the user enters the string '1x011001' it should output 'wrong'. [9 marks]