9608_s21_qp_12
A paper of Computer Science, 9608
Questions:
9
Year:
2021
Paper:
1
Variant:
2

Login to start this paper & get access to powerful tools

2
3
The 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 LDD Direct addressing. Load the contents of the location at the given address to ACC. LDI Indirect addressing. The address to be used is at the given address. Load the contents of this second address to ACC. STO Store the contents of ACC at the given address. ADD Add the contents of the given address to ACC. INC Add 1 to the contents of the register (ACC or . JMP Jump to the given address. CMP Compare the contents of ACC with the contents of . JPE Following a compare instruction, jump to if the compare was True. END Return control to the operating system. The current contents of the main memory are: Address Instruction LDI 103 CMP 101 JPE 59 ADD 102 STO 102 LDD 100 INC ACC STO 100 JMP 51 ADD 102 STO 102 END … Trace the program currently in memory using the following trace table. Instruction address ACC Memory address The instruction in memory address 50 needs to be changed to use direct addressing to load the contents of the memory location at address 100. Give the new instruction to replace LDI 103. Each instruction in the assembly language program is encoded in 16 bits (8-bit op code followed by an 8-bit operand). The instruction JPE 59 has the operand 59. Convert the operand 59 into 8-bit binary. Convert the denary value 59 into hexadecimal. The assembly language program uses direct and indirect addressing. Identify two other modes of addressing used in an assembly language program.
4
5
A web page includes HTML and JavaScript code. 04 Calculate area of a triangle: 06 Base 07 Height 08 Calculate 12 function area() { 13 var base = document.forms["Triangle"]["B"].value; 14 var height = document.forms["Triangle"]["H"].value; 15 if (base == "" || height == "") { 16 alert("Both values must be entered"); 17 return false; 18 } 19 else { 20 area = 0.5 * height * base; 21 alert("The area is: " + area); 22 } 23 } Give the three identifiers used in the JavaScript code. State the purpose of the code on line 08. The page is loaded and the values 2 and 8 are entered. State the output when the calculate button is clicked. State the meaning of the || operator in line 15 of the code. Data validation has been used in line 15 of the JavaScript code. Identify the type of data validation used in line 15. Identify two other data validation checks that could be used. Question 5 continues on the next page. Cambridge International Holidays allows customers to make holiday bookings on its website. Bochen visits the Cambridge International Holidays website to book a holiday. The sequence (1 to 8) below describes the steps that take place when he submits a booking. Four of the statements A, B, C, D, E and F are used to complete the sequence. A Any errors found at the server side are flagged, and step 1 is repeated. B HTML code is used on the client’s web browser to validate the form data. C PHP code is executed to generate a confirmation (HTML) web page that is returned to the client’s web browser. D The form data is transmitted to Cambridge International Holidays’ web server. E JavaScript code is executed to generate a confirmation (HTML) web page that is returned to the client’s web browser. F JavaScript code is executed on the client’s web browser to validate the form data. Write one of the letters (A, B, C, D, E or F) in the appropriate row to complete the sequence. Bochen completes the online booking and clicks ‘Submit’. Any errors found are flagged, and step 1 is repeated. PHP code is executed to perform extra data validation checks on the form data. The booking details are added to the database.
6
7