Saturday, 5 November 2016

Progress Assessment one Corrections

Q4) D) There can be a loss of precision when a denary number is stored using this floating point system. The closest possible representation of 6.9 is

0.1101110    0011

By converting this bit pattern back into denary we can see that the actual number is 6.875, not 6.9.
Calculate the absolute error that has occurred.
6.9-6.875=0.025

ii) Calculate the relative error that has occurred.
0.025/6.9=0.0036

Q5) For each of the following, name a suitable data type and give a reason for your choice.
a) The number of books a student has out on loan from the college libary.
Integer - Need to store whole numbers and add or subtract them as he takes is or brings back books.

b)A students average mark to two decimal places.
Single - can handle calculations and numbers with decimals in.

c) Telephone number such as 01223123456.
String - needs to be string and not single or integer so beginning 0 does not disappear.

Q8) This question is based around the pre-released code.

a)Give a line of code where a relational operator is used.
If num < num2 then

d) Give a line of code in which an assignment statement is used.
num1=console.readine

No comments:

Post a Comment