Exam (elaborations) TEST BANK FOR Fortran 9-2003 for Scientists and Engineers 3rd Edition By Stephen Chapman (Instructor's Solution Manual)
1-1 (a) 10102 (b) (c) (d) 1-2 (a) 7210 (b) 13710 (b) 25510 (d) 510 1-3 (a) and AEF116 (b) 5128 and 14A16 (c) 1578 and 6F16 (d) 37558 and 7ED16 1-4 (a) and 25510 (b) 2 and 42410 (c) and 7310 (d) 2 and 51110 1-5 A 23-bit mantissa can represent approximately ±222 numbers, or about six significant decimal digits. A 9-bit exponent can represent multipliers between 2-255 and 2255, so the range is from about 10-76 to 1076. 1-6 46-bit integer: From -245 to -245-1, or -35,184,372,088,832 to 35,184,372,088,831. 64-bit integer: From -263 to -263-1, or -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. 1-7 (a) (b) (c) 002 (d) 1-8 The sum of the two’s complement numbers is: = = -77210 = The two answers agree with each other. 1-9 = 12710, and = -12810. These results agree with Equations (1-1) and (1-2). 1-10 A 53-bit mantissa can represent approximately ±252 numbers, or about fifteen significant decimal digits. An 11-bit exponent can represent multipliers between 2-1023 and 21023, so the range of double precision numbers is from about 10-307 to 10307. 10 Chapter 2. Basic Elements of Fortran 2-1 (a) Valid real constant (b) Valid character constant (c) Invalid constant—numbers may not include commas (d) Invalid constant—real numbers must include a decimal point1 (e) Invalid constant—need two apostrophes to represent an apostrophe within a string (f) Invalid character constant—mismatched apostrophe and quotation mark (g) Valid character constant 2-2 (a) Different values—one is real and the other is integer (b) Different values (c) The same value (d) The same value. 2-3 (a) Valid (b) Invalid—name must begin with a letter (c) Invalid—question mark is not a legal character (d) Valid. 2-4 (a) Legal: result = 0. (b) Legal: result = 30 (c) Illegal—cannot have two adjacent operators (d) Legal: result = 0.002 (e) Illegal—division by zero 2-5 (a) Legal: This expression is evaluated entirely with integer arithmetic: 58/4 = 14, and 4/58 = 0, so the result = 0. (b) Legal: The first part of this expression is evaluated with integer arithmetic and the second part of the expression is evaluated with real arithmetic. The final expression is evaluated with real arithmetic: 58/4 = 14, and 4/58. = 0., so the result = 0.. (c) This expression is evaluated entirely with real arithmetic: 58./4 = 14.5, and 4/58. = 0., so the result = 1.. (d) Illegal: parentheses are unbalanced. 2-6 (a) 12 (b) 12 (c) 0 (d) 15.6 (e) 12.0 (f) 12 (g) 18 (h) 18 (i) 12 2-7 (a) 19683 (b) 729 (c) 19683 2-8 i1 = 2, i2 = -4, i3 = -5, i4 = -5, a1 = 2.4, a2 = 5.76 2-9 The program will run, but it will produce wrong answers, because the sine and cosine functions expect their arguments to have units of radians, not degrees. 2-10 The output of the program is: -3. 100. 200. 2-11 The weekly pay program is shown below: PROGRAM get_pay ! ! Purpose: ! To calculate an hourly employee's weekly pay. ! ! Record of revisions: ! Date Programmer Description of change ! ==== ========== ===================== ! 05/01/2007 S. J. Chapman Original code ! 1 Many compilers will accept this form, even though it does not meet the strict definition of a real constant. 11
Geschreven voor
- Instelling
- Chamberlian School Of Nursing
- Vak
- TEST BANK FOR Fortran 9-2003 for Scientists and Engineers 3rd Edition By Stephen Chapman
Documentinformatie
- Geüpload op
- 14 november 2021
- Aantal pagina's
- 382
- Geschreven in
- 2021/2022
- Type
- Tentamen (uitwerkingen)
- Bevat
- Onbekend
Onderwerpen
-
exam elaborations
-
test bank for fortran 9 2003 for scientists and engineers 3rd edition by stephen chapman instructors solution manual