Questions and Exercises for preparation exam

User Generated

Haqrepebsg

Computer Science

Description

(Only Part of Question 1 here on this box, please see attachment for full questions)

Question 1

This question is about Block 1 Part 1. You must show all of your working for full marks.

On 4 June 1996, the maiden flight of the Ariane 5 space launcher ended in a failure. Around 40 seconds after lift off, at an altitude of about 3700 metres, Ariane 5 veered off its flight path, broke up and exploded.

The problem was traced to a software exception that was caused during execution of a data conversion from a 64-bit floating point value to 16-bit signed integer value. The floating point number that was converted had a value greater than what could be represented by a 16-bit two’s complement integer

  • a. Name the kind of software error that was responsible for the Ariane 5 disaster.

Answer:

The software designers made an assumption that the number being converted from a float to an integer would not exceed a certain number.

  • b.
    • i.Write this number in 16-bit two’s complement binary notation.
    • Answer:
    • ii.Convert the number in part (i) into a decimal notation.
    • Answer:
    • iii.Write your result from part (ii) in decimal scientific notation
    • Answer:

Unformatted Attachment Preview

Question 1 This question is about Block 1 Part 1. You must show all of your working for full marks. On 4 June 1996, the maiden flight of the Ariane 5 space launcher ended in a failure. Around 40 seconds after lift off, at an altitude of about 3700 metres, Ariane 5 veered off its flight path, broke up and exploded. The problem was traced to a software exception that was caused during execution of a data conversion from a 64-bit floating point value to 16-bit signed integer value. The floating point number that was converted had a value greater than what could be represented by a 16-bit two’s complement integer • a. Name the kind of software error that was responsible for the Ariane 5 disaster. Answer: The software designers made an assumption that the number being converted from a float to an integer would not exceed a certain number. • b. o i.Write this number in 16-bit two’s complement binary notation. o Answer: o ii.Convert the number in part (i) into a decimal notation. o Answer: o iii.Write your result from part (ii) in decimal scientific notation o Answer: • • c. 0.9 cannot be represented exactly in binary notation. Here are two different binary approximations of the decimal value 0.9: 0.1112 0.1110012 • o i.Convert each to their decimal representation, showing your working. o Answer: o ii.Identify which of the two values you found in part (i) is the most precise approximation of 0.9. Write this value as a percentage of the exact value, 0.9. o Answer: • d. A security firm wants to design an embedded circuit to control who can open the safe in a bank. There are three types of employees, an Area Manager (A), a Branch Manager (B) and a Clerk (C). The safe can only be opened if exactly two people are present in the safe room and one of them is either the Area Manager or the Branch manager. o i.In the truth table in Table 1, a number 1 indicates that the person is present and a number 0 indicates that a person is not present. Complete this truth table by using a number 1 to indicate that the safe can be opened and a number 0 to indicate that it can’t. Table 1 1 = Present 0 = Not present Area Manager Branch Manager Clerk Safe can be opened = 1 (A) (B) (C) Safe cannot be opened = 0 0 0 0 0 0 1 0 1 0 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1 • o ii.Write a Boolean expression that could be used to build a logic circuit for the truth table you have constructed. Use A for Area Manager, B for Branch Manager and C for Clerk in your expression. o Answer: Question 2 This question covers topics from Block 1 Part 2. Design and implement a program to produce a simple graphical representation of a tree, as shown in Figure 1. Think of the output as comprising 3 levels. The lines used to make each level in the figure below are of length 10, 20 and 30 respectively. You should produce a program that, in principle, can produce larger trees simply by changing one number that specifies the number of levels. • a. Produce a top level decomposition, making explicit use of one loop. At this stage express your answer in terms of two sub-problems. Answer: • b. Refine your decomposition to give an algorithm, as you include extra detail make explicit use of a second loop. Answer: • c. This part of the question involves writing Python code. Translate your algorithm into Python and run your program to ensure the output matches Figure 1. You do not need to submit output. Answer: Figure 1 Simple tree graphic Question 3 This question is about Block 1 Part 3. You must show all of your working for full marks. • a. o i.Where is cache memory located and what is its relative speed based on its position? o Answer: o ii.Should cache memory be measured in kB or in KiB? o Answer: o iii.How many words of size 64 bits can be stored in 1.5 kB? o Answer: o iv.How many words of size 64 bits can be stored in 1.5 KiB? o Answer: • • b. A processor has the following specification: o Base clock Speed: 3.6 GHz o Overclocked clock speed: 4 GHz Write one or two sentences to explain what each line means. Answer: • c.In no more than 100 words, compare and contrast the processes of compilation and interpretation, making sure that you explain the terms 'source code' and 'object code' in your answer. Answer: Question 4 This question is about Block 1 Part 4. The hours of a day can be represented in 24 hour format or the am/pm format. Your employer wants a program that takes an hour in 24 hour format, and prints it in am/pm format. You are given the following test data and an incomplete and erroneous program. Input Expected output 0 0 am 3 3 am 12 12 pm 13 1 pm 24 12 am # Convert hours # Input: an hour hour = 4 if hour < 11 string == 'am' else if hour > 12 hour = hour + 12 string == 'pm print(hour, string) • a.What are the inputs and outputs of this problem and their types? What are the admissible values for the inputs? Answer: • • • • b. o i.What are the syntax errors in this program? o Answer: o ii.Even if they were corrected, which of the above tests would the program fail and why? o Answer: o iii.Some borderline input values are missing from the test table. Indicate those input values and the expected outputs. o Answer: c.Which pattern or patterns from Block 1 Part 4 will you use to solve this problem? Instantiate it or them and show your algorithm. Answer: • d.This part of the question involves writing Python code. • Present the code corresponding to your algorithm. Make your code as simple as possible. Include comments . Use the test table to check your code works. You do not need to submit test outputs. Answer:
Purchase answer to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Explanation & Answer

Here you go. I'm not 100% certain on #1. If you have clarification on the number I can answer ...


Anonymous
Goes above and beyond expectations!

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4

Related Tags