1. Which of the following guarantees the correct answer on any machine? (Notes 2.10 & 2.11) A. long value = 2* 16384 * 1
Posted: Sun Jul 03, 2022 11:23 am
1. Which of the following guarantees the correct answer on any machine? (Notes 2.10 & 2.11) A. long value = 2* 16384 * 100L; B. long value = (long) (2* 16384*100); C. float value = 2* 16384 (float) 100; D. double value = (float) (2 16384 *100L); E. long value = 2* 16384L* 100; 2. The data types of the literals 32767 and 32768, respectively, are: (Notes 2.1 & 2.2) A. both implementation dependent B. int and long C. int and implementation dependent D. int and int E. none of the above 3. The data types of: a) unsuffixed integer literals and b) unsuffixed floating literals, are: (Notes 2.2 and 2.4) A. a) octal, decimal, or hexadecimal b) floating B. a) int b) double C. a) determined by the number of digits b) either float or double D. a) determined by the value and radix b) float E. a) determined by the value and base b) double 4. Predict the values of: +7/2 and 10.0 / -2.0 (Note 2.8) A. two possibilities: 3 and -5 or 4 and -5 B. only 3 and -5 C. only 3.5 and -5 D. only 4 and -5 E. none of the above 5. A mathematical operation in which all operands are type char: (Note 2.10) A. converts the values of all operands to type int or unsigned int. B. produces a type char result. C. is an example of poor programming. D. is evaluated using type short char arithmetic. E. must not contain subtraction. 6. If char is 8 bits and int is 24 bits, predict the values of sizeof(11 %-5) and sizeof(8 % -3). (Notes 2.8 & 2.12) A. only 1 and 3 B. two possibilities: -4 and 4 or 1 and 4 C. two possibilities: -4 and 3 or 1 and 3 D. only 3 and 3 E. The value of the first expression will be either -4 or 1. The value of the second expression depends upon the data type of sizeof.