TEST BANK FOR Fortran 9-2003 for Scientists and Engineers 3rd Edition By Stephen Chapman
- GradeMaster1
- Rating : 1
- Grade : C+
- Questions : 0
- Solutions : 1124
- Blog : 0
- Earned : $278.60
1-1 (a) 10102 (b) 1000002 (c) 10011012 (d) 1111112
1-2 (a) 7210 (b) 13710 (b) 25510 (d) 510
1-3 (a) 1273618 and AEF116 (b) 5128 and 14A16 (c) 1578 and 6F16 (d) 37558 and 7ED16
1-4 (a) 111111112 and 25510 (b) 1101010002 and 42410 (c) 10010012 and 7310 (d) 1111111112 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) 1101112 (b) 11111111111110112 (c) 100000000002 (d) 11111100000000002
1-8 The sum of the two’s complement numbers is:
= 936210
11111100111111002 = -77210
00100001100011102 = 859010
The two answers agree with each other.
1-9 011111112 = 12710, and 100000002 = -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.888889 (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.06896552, so the result = 0.9655172. (c) This expression is evaluated entirely with real arithmetic: 58./4 = 14.5,
and 4/58. = 0.06896552, so the result = 1.000000. (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.141592 100.000000 200.000000 300 -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
[Solved] TEST BANK FOR Fortran 9-2003 for Scientists and Engineers 3rd Edition By Stephen Chapman
- This solution is not purchased yet.
- Submitted On 14 Nov, 2021 05:54:11
- GradeMaster1
- Rating : 1
- Grade : C+
- Questions : 0
- Solutions : 1124
- Blog : 0
- Earned : $278.60