9608_s18_qp_32
A paper of Computer Science, 9608
Questions:
6
Year:
2018
Paper:
3
Variant:
2

Login to start this paper & get access to powerful tools

1
Data types can be defined in a programming language. The data type, StudentRecord, is defined by the code: TYPE StudentRecord DECLARE StudentID : INTEGER DECLARE StudentFirstName : STRING DECLARE StudentSurname : STRING DECLARE StudentDOB : DATE DECLARE StudentCourse : ARRAY[1:10] OF STRING ENDTYPE A variable, CollegeStudent, is declared with the code: DECLARE CollegeStudent : StudentRecord Write a pseudocode statement to assign 6539 to the StudentID of CollegeStudent. The type definition for StudentRecord is changed. Students can take six courses from: Computer Science, Engineering, Science, Maths, Physics, Chemistry, Music, Drama and English Language. Rewrite one line from the type definition of StudentRecord to implement the change. DECLARE The values for the field StudentID must be between 1 and 8000 inclusive. Rewrite one line from the type definition of StudentRecord to implement the change. DECLARE A programmer is asked to write a program to process the assessment data for each student. Students sit one exam in every course they take. A composite data type, StudentAssessment, needs to be defined with the following three fields. • a student assessment code (a unique code of three letters and two digits) • the marks for the six exams • the average mark of the six exams Write pseudocode to define the data type StudentAssessment. Data about all students and their assessments are stored in a file that uses random organisation. The StudentID is used as the key field. The program allows a user to enter data for a new student. Explain how the program adds the new data to the file.
2
3
4
5
6
There are five scenarios on the left and two types of system on the right. Draw a line to link each scenario to its correct type of system. System Control Monitoring Scenario Car speed display Aeroplane autopilot Rollercoaster Recording the rainfall at a weather station Robot loading a part onto a conveyor belt Mary has six fish tanks. The temperature of the water in each tank needs to be within a specific range. Identify three items of hardware that Mary can add to her tanks to help maintain the temperature. Describe the purpose of each item. Item 1 Purpose Item 2 Purpose Item 3 Purpose A temperature reading is taken from each tank once per minute. The temperature reading is stored as two successive bytes. The format is shown: Fish tank Temperature reading Byte 1 Byte 2 The fish tank number is indicated by setting one of the bits in Byte 1 to 1. For example, fish tank number 5 is indicated by setting bit 5 to 1. Bit 7 of Byte 1 is a flag: • the flag’s initial value is zero • when the reading has been processed, the flag’s value is set to 1 Bit 0 of Byte 1 is unused. Byte 2 contains the temperature reading as a two’s complement integer. After a temperature reading has been taken, the bytes contain the following data. Byte 1 Byte 2 Analyse the data contained in the two bytes. The system receives a temperature reading of − 2 from fish tank number 4. Complete the bytes to show the values for this reading after it has been processed. Byte 1 Byte 2 A hardware device to affect the temperature of each tank is on or off depending on the value of a bit in memory location 6753. If bit 4 is 1, then the hardware device in fish tank 4 is on. Write assembly language instructions to set bit 4 of memory location 6753 to 1 without changing any other bits. Use the instruction set provided. Instruction set Instruction Explanation Op code Operand LDD Direct addressing. Load the contents of the location at the given address to ACC. STO Store the contents of ACC at the given address. AND #n Bitwise AND operation of the contents of ACC with the operand. AND Bitwise AND operation of the contents of ACC with the contents of . XOR #n Bitwise XOR operation of the contents of ACC with the operand. OR #n Bitwise OR operation of the contents of ACC with the operand. OR Bitwise OR operation of the contents of ACC with the contents of . can be an absolute address or a symbolic address.