ExamBank Scot · N5 Computing Science question bank · All N5 Computing Science questions

N5 Computing Science 2017 Question 15

10 marks · Data types and structures

Explain why integer data types are used in Lines 1 to 3. Name the part of the computer system that will carry out each of the following tasks during the execution of Line 23. Carries the location of redAvailable in main memory. Transfers the value of redAvailable from main memory to the processor. Calculates the new value of redAvailable. When a vehicle parks, the digital display board will be updated to show the number of available spaces on each level. SPACES AVAILABLE FULL Red Level Black Level Yellow Level 8 32 Complete the condition below, that will display the message “FULL” when all the spaces on the Red Level are occupied. IF___________________________________________________THEN SEND “FULL” TO DISPLAY END IF Each of the letters of the message FULL will be stored as an ASCII character. Calculate the number of bits required to store this message. Each of the parking space numbers is stored in binary. State the decimal equivalent of the binary number 01101100. While the parking space program is being developed, it is executed using an interpreter. State one advantage of using an interpreter rather than a compiler at the development stage of a program. The finished program is compiled. State two advantages of executing a compiled version compared to an interpreted version. Advantage 1 Advantage 2 A program is being developed to monitor the availability of parking spaces in a multi-level car park. The car park has three levels, each with 50 numbered spaces and a digital display board that shows the number of spaces available on each level. SPACES AVAILABLE Red Level 8 Black Level Yellow Level 25 32 Numbered Spaces Level Red 1–50 Black 51–100 Yellow 101–150 Part of the program is shown below: Line 1 DECLARE redAvailable AS INTEGER INITIALLY 50 Line 2 DECLARE blackAvailable AS INTEGER INITIALLY 50 Line 3 DECLARE yellowAvailable AS INTEGER INITIALLY 50 . . . . . . < vehicle is detected occupying a space> . . . . . . Line 22 IF spaceNumber ≥1 AND spaceNumber ≤50 THEN Line 23 redAvailable = redAvailable – 1 Line 24 END IF . . . . . .

Marking scheme

Only whole numbers can be accepted (can’t have part of a parking space) Address Bus Data Bus Arithmetic Logic Unit (ALU) redAvailable = 0 OR redAvailable < 1 Do not accept “red level” 28 Units not required as in stem Allow calculation with 7 bit or 8 bit ASCII so accept “32”. 108 Any one from the following: • No need to leave the programming environment • Tracing facilities • Debugging facilities • Executes until error found allowing for easy identification of errors (1 mark each) Note that both interpreters and compilers translate code one line at a time and return errors. Candidates answer must go further to distinguish between the two. Executes/runs faster (1 mark) Doesn’t need translator in memory (1 mark) Answer must refer to running the compiled program, so do not accept “Complier runs faster”.

Previous question: N5 Computing Science 2017 Question 14

Next question: N5 Computing Science 2017 Question 16