8 Assuming we have a large collection of very small double v

8. Assuming we have a large collection of very small double values and very large double values, and we need write a program to compute the sum of all of these values, which ONE of the following statements is FALSE?

a. No matter what order we add the numbers in (e.g., smallest to largest, largest to smallest, random order, etc.), we will always end up with the exact same sum.

b. Adding the largest numbers first and then adding in the smallest numbers can give us a different result from adding the smallest numbers first and then adding in the largest.

c. Because we have a fixed number of significant digits, our computations can be affected by round-off error.

9. Which ONE of the following mathematics expressions correctly describes the number of unique binary values we can represent using a sequence of N bits?

a. 2(N-1)

b. 2N
c. 2N-1

d. N2

e.2·N

f. N

10. Which of the following are TRUE statements about the parts of a C compiler? Select ALL correct responses.

a. The preprocessor runs first, pulling in #include files, substituting #define symbols, and stripping out comments.

b.The code generator needs to have deep knowledge of the machine instructions available on the CPU hardware for which the program is being compiled.

c.The parser knows the rules of C, and issues error messages when we break those rules.

d. The lexical analyzer runs as the very last step of the compilation process.

e. The preprocessor #define macros can be dangerous because of operator precedence rules and expression side-effects.

Solution

8. a. No matter what order we add the numbers in (e.g., smallest to largest, largest to smallest, random order, etc.), we will always end up with the exact same sum.

This is false .

9. e. 2·N eg 1 bit represent 0 and 1 ie 2 bits ,2 bits represent 00,01,10and 11 ie 4 values.

10.

a. The preprocessor runs first, pulling in #include files, substituting #define symbols, and stripping out comments.

b.The code generator needs to have deep knowledge of the machine instructions available on the CPU hardware for which the program is being compiled.

e. The preprocessor #define macros can be dangerous because of operator precedence rules and expression side-effects.

8. Assuming we have a large collection of very small double values and very large double values, and we need write a program to compute the sum of all of these

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site