Birkbeck College Department of Computer Science and Information Systems Introduction to Computer Systems In-Class Test (Open Book) S.J. Maybank 5 November 2013 th Write your name (family name included) below this line: This question sheet includes space for the answers and for the calculations which lead to the answers. Ask for more paper if you require it. Be sure to write your name on any paper which you hand in to be marked. Calculators, laptops and other electronic devices are not permitted. There are 10 questions. Each question has 5 marks. Answer all questions. Question 1 (5 marks) a) Explain what is meant by the term algorithm. Answer: b) A programming language contains the instruction q = 6+7. Describe what happens when this instruction is carried out. Answer: 1 Question 2 (5 marks) a) Evaluate the following Boolean expression when A = 1 (True) and B = 0 (False). A OR (NOT(B)) Answer: b) Write out a truth table for a Boolean expression C which contains exactly two variables A and B. The expression is True if A and B each have the same truth value, otherwise the expression is False. Answer: Question 3 (5 marks) Let k be a non-negative integer, let A be the condition 2^(k) <= 10 (equivalently 2k 10) and let B be the condition 2^(k+1) > 10 (equivalently 2k+1 > 10. The conditions A, B are used in the following pseudo code. k = 0; While NOT(A) OR NOT(B) k = k+1; EndWhile; Print(k); a) Find a value of k such that A is True and B is False. Show your working to prove that your value of k is correct. Answer: [Question 3 continues on the next page] 2 b) Find a value of k such that A and B are both True. Show your working to prove that your value of k is correct. Answer: Question 4 (5 marks) Integers can be expressed in decimal notation or in binary notation. For example, the decimal integer 5 has the binary notation 101. Express the following decimal integers in binary notation. (a) 4 Answer: (b) 11 Answer: Express the following binary integers in decimal notation. (c) 1 Answer: (d) 111 Answer: (e) 1101 Answer: 3 Question 5 (5 marks) a) Give the 4 bit excess notation for the decimal integers 5 and -2. Add together the two bit strings as if they were standard binary numbers. Answer: b) Give the 4 bit two’s complement notation for the decimal integers 5 and -2. Add together the two bit strings as if they were standard binary numbers. Answer: c) Discuss the results of the additions in parts (a) and (b) of this question. Answer: Question 6 (5 marks) a) The numbers 11101 and 110 are in binary notation. Add them together. Show your working. Answer: [Question 6 continues on the next page] 4 b) Convert the two binary numbers in part (a) of this question to their decimal equivalents, and add them together using decimal notation. Show your working. Answer: c) Convert the two binary numbers in part (a) of this question to their hexadecimal equivalents, and add them together using hexadecimal notation. Show your working. Answer: Question 7 (5 marks) A floating point notation contains eight bits, namely s, e1, e2, e3, m1, m2, m3, m4 in order from left to right. The sign bit s is 1 if the number is strictly less than 0 and 0 otherwise. The bits e1, e2, e3 represent the exponent in 3 bit excess notation. The bits m1, m2, m3, m4 are the leftmost (most significant) four bits of the mantissa. Find the floating point representation of the number -3/4. Show your working. Answer: 5 Question 8 (5 marks) The floating point representation described in Q. 7 is used in this question. a) Find the decimal fraction with the floating point representation 01101001. Show your working. Answer: b) Suppose that the floating point representation of a non-zero number x is given. Explain how the floating point representation of –x can be obtained quickly. Answer: Question 9 (5 marks) Define the terms seek time, latency time, access time and transfer rate, as they apply to a hard drive in a computer. Answer: 6 Question 10 (5 marks) A hard disk rotates at 10,000 revolutions in one minute. A write head transfers data to the disk at a rate of 125 MB every second. a) How long in seconds will it take to write a file of size 0.5 MB to the disk? Answer: b) What fraction of a revolution will be made by the disk as the file in part (a) of this question is written to the disk? Answer: End of the Test 7