SECONDARY SCHOOL, L-IMRIEĦEL HALF YEARLY EXAMINATIONS 2016/2017 YEAR: 10 Computing Time: 1½ Hr. Name: Class: Instructions: 1. Answer all the questions in the space provided on this paper. 2. Calculators cannot be used for this exam. 3. Write neatly and clearly using a blue or black pen. Avoid the excessive use of correcting fluid. 4. You have 1½ hours to finish off this examination paper; use your time well allowing time for revision. 5. Do not staple the papers together. Good luck! Page 1 of 12
ANSWER ALL QUESTIONS. 1. Computers represent values in binary. a) Why is the above statement true? b) Convert the following unsigned binary number to decimal: 11001011 c) Add these two binary numbers together: 01101001 + 10111000 d) Using 8-bit 2 s Complement, calculate 90 50. Show all your working. (5 marks) Page 2 of 12
2. This question is about the range of numbers that can be represented in an 8-bit register. a) What is the largest unsigned binary number that can be represented in an 8-bit register? b) What is the range of unsigned decimal numbers that can be represented in an 8-bit register? c) The smallest 2 s complement number that can be represented in n bits is given by the formula: -2 n-1 Use the formula to find the smallest 2 s complement decimal number that can be represented in an 8-bit register. d) Explain why the largest decimal number using 8 bit register in 2 s complement is 127 and not 128. 3. An 8-bit register contains the value 00111100. a) What can be done to the bits in this register to quickly divide (by 2) the value of the number? Page 3 of 12
b) Show the working how this is done and how it is stored in an 8-bit register. c) Can this Hex number AB be stored in a 4-bit register? What happens when this occurs? 4. Match column A with column B to represent the correct Boolean expression with its meaning. Column A Column B a) A + B A AND B b) A A OR B c) A. B NOT A (3marks) 5. Give the Boolean expression and the truth table for the following logic circuit. A D B Z C E Boolean expression: Page 4 of 12 (3 marks)
Truth table: 6. Draw the logic circuit for the following Boolean expression: (3 marks) Z = (A.B). (A+B) (4 marks) Page 5 of 12
7. Give the Boolean expression for the following truth table: A B X 0 0 0 0 1 0 1 0 1 1 1 1 (3 marks) 8. This question is related to the Java programming language. a) Fill in and match the following data types with their respective characteristics: byte short char float boolean String Can hold an address. Characteristics Data type Can represent numbers between -128 and 127 Can hold a single letter. Can represent numbers between -32,768 and 32,767. Can only represent true or false. Can store a number with a decimal point. (6 marks) Page 6 of 12
9. Look carefully at the program used by a class teacher to keep record of the results of her 10 students. Then answer the following questions. class Results { public static void main (String args[]) { int mark; int fails = 0; int passes = 0; for ( int i = 0; i<=10; i++) { System.out.print ("Enter the mark of next student: "); mark = Keyboard.readInt(); if (mark < 50) fails++; else passes++; } System.out.println ( fails + " students failed \n" + passes + " students passed"); } } a) From the program shown, identify: i. A primitive variable: ii. An escape character: iii. An assignment statement: iv. An input statement: v. A JAVA reserved word: vi. A loop: vii. A conditional statement: (7 marks) b) Comments are very useful when coding. Mark with an * in the above program where a line of comment can be inserted. Write the comment below by applying the right formatting. (3 marks) Page 7 of 12
c) Identify THREE types of errors that can occur in a program. (3 marks) d) Which one of the errors mentioned in (c) occurs if: i. This statement is written to add two variables int sum=num1*num2; ii. If a semicolon is missing in one of the statements 10. Study the flowchart below and complete the Java program which reflects this flowchart. Start Read age age > 16 Yes Print You can vote No Print You cannot vote End Page 8 of 12
// class { static void main (String args[]){ System.out.print("How old are you? "); byte age= Keyboard.readByte(); if System.out.println("You can vote!"); System.out.println("You cannot vote!"); } } (5 marks) 11. The diagram below shows the main units of a CPU. a) Label the diagram by using three words from the list below: Main Memory Input Device CU ALU Output Device (3 marks) b) A register is a location in the CPU which holds data or instructions temporarily. i. Name the TWO registers found in the Control Unit. Page 9 of 12
ii. Name the TWO registers found in the Arithmetic Logic Unit. c) Choose any TWO registers that you have mentioned either from questions bi or bii, and explain their use. Name of Register: Its use: Name of Register: Its use: (4 marks) d) State whether the following statements are TRUE or FALSE. TRUE/FALSE i. The width of the address bus determines the address space. ii. The read/write line is found in the data bus. iii. The address of the storage location, travels along the address bus. iv. The processor speed is measured in Gb. v. The wider the data bus the more data can travel to and from the main memory. vi. The speed of the CPU may depend on the wordlength and cache memory amongst others. Page 10 of 12
vii. The Memory Address Register (MAR) holds the result of a current calculation. viii. The Memory Data Register (MDR) temporarily holds data/instruction, which is read from or written to memory. (8marks) 12. The Instruction Set is a set of instructions that the CU can understand. Each instruction is made up of an opcode and an operand. Explain what is an opcode and an operand by giving an example of each. Opcode Operand (4 marks) 13. The following are the incomplete steps of the Fetch Execute Cycle. Complete the steps by choosing the right word from the list below. IR PC circuits CU operand 1. fetches the opcode from memory location indicated by the PC. 2. CU places opcode in. 3. CU fetches the required. 4. CU increments to point to the next instruction. 5. CU activates necessary to execute instruction. 6. Go back to step 1. (10 marks) Page 11 of 12
END OF EXAM PAPER Page 12 of 12