Page 135 - Introduction to Programming with Java: A Problem Solving Approach
P. 135

                c) 0.1234 is a double. (T / F) d) 1234.0 is a double. (T / F)
22. What modifier specifies that a variable’s value is fixed/constant?
§3.15 Arithmetic Operators
23. What is the remainder operator?
24. Write the following mathematical expressions as legal Java expressions:
a. 3x􏰁1 x2
b. 1 􏰂 1 2 xy
§3.16 Expression Evaluation and Operator Precedence 25. Assume this:
int m = 3, n = 2;
double x = 7.5;
Evaluate the following expressions:
a) (7 - n) % 2 * 7.5 􏰂 9 b) (4 + n / m ) / 6.0 * x
§3.17 More Operators: Increment, Decrement, .and Compound Assignment 26. Write the shortest Java statement that increments count by one.
number.
§3.18 Tracing
29. What does it mean if a variable contains garbage? 30. In a trace listing, what are line numbers for?
§3.19 Type Casting
31. Write a Java statement that assigns the double variable, myDouble, to the int variable, myInteger.
§3.20 char Type and Escape Sequences
32. What’s wrong with the following initialization?
char letter = "y";
33. If we try to put a quotation mark (") somewhere inside a string literal to be printed, the computer interprets the quotation mark as the end of the string literal. How can we overcome this problem and force the computer to recognize the quotation mark as something we want to print?
34. When describing the location of a file or directory, computers use directory paths. In Windows environments, use the backslash character (\) to separate directories and files within a directory path. If you need to print a directory path within a Java program, how should you write the backslash character?
§3.21 Primitive Variables Versus Reference Variables
35. The type name for a primitive type is not capitalized, but the type name for a reference type is usually
capitalized. (T / F)
36. List the primitive types this chapter describes, in the following categories:
a) Integer numbers.
b) Floating point numbers.
Review Questions 101
   27. Write the shortest Java statement that decrements count by 3.
28. Write the shortest Java statement that multiplies number by (number - 1) and leaves the product in
Apago PDF Enhancer
c) Individual text characters and special symbols.

































































   133   134   135   136   137