9608_w17_qp_11
A paper of Computer Science, 9608
Questions:
7
Year:
2017
Paper:
1
Variant:
1

Login to start this paper & get access to powerful tools

1
2
3
4
The diagram shows the components and buses found inside a typical Personal Computer (PC). General purpose registers A B C Arithmetic Logic Unit (ALU) F E D Some components and buses only have labels A to F to identify them. For each label, choose the appropriate title from the following list. The title for label D is already given. • Control bus • System clock • Data bus • Control unit • Main memory • Secondary storage A B C D Address bus E F The following table shows part of the instruction set for a processor. The processor has one general purpose register, the Accumulator (ACC), and an Index Register (. Instruction Explanation Op code Operand Op code LDM #n 1100 0001 Immediate addressing. Load number n to ACC. LDD 1100 0010 Direct addressing. Load the contents of the given address to ACC. LDV #n 1100 0011 Relative addressing. Move to the address n locations from the address of the current instruction. Load the contents of this address to ACC. STO 1100 0100 Store the contents of ACC at the given address. DEC 1100 0101 Decrement the contents of ACC. OUTCH 1100 0111 Output the character corresponding to the ASCII character code in ACC. JNE 1110 0110 Following a compare instruction, jump to if the compare was False. JMP 1110 0011 (Unconditionally) jump to the given address. CMP #n 1110 0100 Compare the contents of ACC with number n. The program given in part is to be translated using a two-pass assembler. The program has been copied here for you. The program now starts with a directive which tells the assembler to load the first instruction of the program to address 100. Label ORG #0100 StartProg: LDV #CountDown CMP Num1 JNE CarryOn JMP Finish CarryOn: OUTCH LDD CountDown DEC STO CountDown JMP StartProg Finish: LDM #88 OUTCH END CountDown: Num1: On the first pass of the two-pass process, the assembler adds entries to a symbol table. The following symbol table shows the first eleven entries, part way through the first pass. The circular labels show the order in which the assembler made the entries to the symbol table. Symbol table Symbolic address Absolute address StartProg CountDown UNKNOWN Num1 UNKNOWN CarryOn UNKNOWN 104 11 Finish UNKNOWN Explain how the assembler made these entries to the symbol table. The assembler software must then complete the second pass building up the executable file. Name the second table needed when the assembler software carries out the second pass. The following shows two of the program instructions in machine code. Machine code Instruction Binary Hexadecimal OUTCH 1100 0111 C7 JNE CarryOn A B Each of the numbers A and B represents the complete instruction in two bytes, one byte for the op code and one byte for the operand. Use the following instruction set to write the numbers for A and B. A B Instruction Explanation Op code Operand Op code LDM #n 1100 0001 Immediate addressing. Load number n to ACC. LDD 1100 0010 Direct addressing. Load the contents of the given address to ACC. LDV #n 1100 0011 Relative addressing. Move to the address n locations from the address of the current instruction. Load the contents of this address to ACC. STO 1100 0100 Store the contents of ACC at the given address. DEC 1100 0101 Decrement the contents of ACC. OUTCH 1100 0111 Output the character corresponding to the ASCII character code in ACC. JNE 1110 0110 Following a compare instruction, jump to if the compare was False. JMP 1110 0011 (Unconditionally) jump to the given address. CMP #n 1110 0100 Compare the contents of ACC with number n.
6
7
A clinic is staffed by several doctors. The clinic serves thousands of patients. Each day and at any one time, there is only one doctor in the clinic available for appointments. The clinic stores patient, doctor and appointment data in a relational database. Underline the primary key for each table in the following suggested table designs. PATIENT(PatientID, PatientName, Address, Gender) DOCTOR(DoctorID, Gender, Qualification) APPOINTMENT(AppointmentDate, AppointmentTime, DoctorID, PatientID) Complete the following entity-relationship (E-R) diagram for this design. The doctors are concerned that many patients make appointments but do not attend them. Describe the changes to the table designs that could be made to store this information. The doctors are about to set up a new clinic in the neighbouring village, SITE-B. The original location is identified as SITE-A. A new table is designed to store the ID of the doctor who is able to work at each site. DOCTOR-AVAILABILITY(DoctorID, Site) Five entries stored in the table are: DoctorID Site SITE-A SITE-A SITE-B SITE-B SITE-B State what this data shows about the availability of the doctor with the ID of 098. Opening a new clinic in the neighbouring village will not require any additional table for storing appointments. It will need a change to the existing appointment table design. Show the revised APPOINTMENT table. APPOINTMENT( ) The doctor with the ID of 117 has recently been allocated a new DoctorID of 017. Write an SQL script to update this doctor’s record in the database. UPDATE SET WHERE Describe why this update could cause problems with the existing data stored. Write an SQL script to display the date and time of all appointments made by the patient with the PatientID of 556.