Hello hello hello I’m back again lol how’s it going? Can you have a look through and see if you can answer these questions ok? I would rather give you the business than open it up to the floor
This question part asks you to apply what you have learned to a new situation.One way of dealing with the imprecision of floating-point numbers is to ‘sandwich’ the exact value between the two closest values on either side. So, for example, in a decimal system that can represent exactly 4 digits beyond the decimal point, the value 0.333333… would be ‘sandwiched’ between 0.3333 and 0.3334. When a calculation is performed, it is repeated with each of the sandwich values to give a range within which the exact result of the calculation lies. For example, the exact value of 3 × 0.333333… is somewhere between 0.3333 × 3 and 0.3334 × 3, so between the values 0.9999 and 1.0002. Although this does not give us the exact value of the calculation, this method tells us a minimum and maximum value for it, within the limits of the precision of the system.
i.Show that 0.0100112 is the binary representation of 0.29687510
ii.A computer system allows only 4 binary digits after the decimal point. Write the two binary values with exactly 4 digits after the decimal point that ‘sandwich’ 0.0100112.
iii.Using the two binary ‘sandwich’ values that you found in (ii), write down the minimum and maximum binary values that sandwich the result of 0.0100112 + 0.0100112
iv.Convert each of the binary values you found in (iii) to decimal notation. Give the minimum and maximum values in decimal notation.
v.Calculate, in decimal, the value of 0.29687510 + 0.29687510 (Your answer is the actual value so it should not be rounded). By what percentage, rounded to the nearest whole percent, does the maximum value exceed the actual value? Your answer should show the actual value, the percentage and your workings for full marks.
c.This question part is based on truth tables and assesses your ability to form logic expressions.During the Coronavirus pandemic in 2020, a supermarket puts restrictions on fruit and veg combinations that people can leave the supermarket with on a Thursday. In particular, for apples (A), bananas (B) and carrots (C), the following two rules are issued:
Rule 1: No apples allowed. (translated into the logic expression NOT A)
Rule 2: Bananas or carrots are allowed. (translated into the logic expression B OR C)
To avoid any misinterpretation, the rules have been translated into logic expressions (as shown above).
i.Complete the following truth table. In the final column, show purchases that are acceptable on a Thursday according to both Rule 1 and Rule 2.
ABCNOT AB OR CACCEPTABLE000001010011100101110111
ii.Find a logic expression which is logically equivalent to the logic expression A?B in the following table. (Here, A?B is a logic expression featuring a new operation that we have named ‘?’.) Follow the method that is described in Block 1 Part 1. To obtain the logic expression for A?B, first obtain the logic expressions for the relevant rows of the table below. Then construct the logic expression for A?B from that. For full marks, show your working.
(Total 22 marks)
This part of the question involves calculations. For full marks, you must include your workings and explanations.
Consider the following two processors:
Processor 1 has a clock speed of 4.0 GHz with 32 KiB of L1 cache.
Processor 2 has a clock speed of 2.0 GHz with 64 KiB of L1 cache.
In order to decide which to buy, you estimate the time each processor will take to load a program with 10,000 RISC instructions into the processor’s registers and the time to execute the instructions.
Each RISC instruction has a size of 4 bytes.
Each RISC instruction takes one clock pulse to execute once it is in the registers.
i.Show that a program consisting of 10,000 RISC instructions will fit into 64 KiB of L1 cache, but will not fit into 32 KiB of L1 cache.
ii.It takes 1 nanosecond (1 x 10-9 s) to move an instruction from L1 cache to the registers and 9 nanoseconds to move an instruction from L2 cache to the L1 cache. Assume that for Processor 2, all of the instructions can be found in L1 cache and for Processor 1, all of the instructions that won’t fit in L1 cache can be found in L2 cache. How much time is needed to load all 10,000 instructions into the registers for each processor? Write your answers in seconds, using scientific notation.
iii.For each processor, calculate the time it takes to execute 10,000 RISC instructions. You should not include the time to load the instructions into the registers here. Write your answers in seconds, using scientific notation.
Based on your answers to parts i and ii of this question, you should now be able to make an estimate of which processor is faster overall, although you don’t need to provide your estimate in answer to this question.
A program is required to compare three numbers to see if any of them is equal to the product of the other two.
The program will take three integers, between 1 and 100 inclusive.
The program should output one of the following strings:
a = b * c
b = a * c
c = a * b
No number is the product of the others
You are given the following test data and an incomplete and error-filled program.
Expected Outputabc1623a = b * c2362b = a * c3326c = a * b4789No number is product of the others
# Problem: Check if any of three numbers is product of others # Input: a as an integer from 1 to 100 # Input: b as an integer from 1 to 100 # Input: c as an integer from 1 to 100 a = 6 b = 2 c = 3 # Output: answer, a string if a == b + c answer = ‘a = b * c’ if b == a * c answer = ‘b = a * c’ if c == a + b : answer = ‘c = a * b’ if (a != b * c) and (b != a * c) and (c != a * b): answer = ‘No number is product of others’ print (answer)
i.What are the inputs and outputs of this problem and their types?
ii.What are the admissible values for the inputs?
i.What are the syntax errors in this program? Consider no other errors at this point.
ii.Once they are corrected, which of the above tests would the program still fail and why? Refer to test cases using their Test Number from the first column.
iii.Give an explanation for the choice of input values in the test table.
User generated content is uploaded by users for the purposes of learning and should be used following Studypool’s honor code & terms of service.
Reviews, comments, and love from our customers and community: