Answers of Review Questions - 2 Chapter: Java Programming Book by Joyce Farrell

Relational operator, Primitive data type, Assignment (computer science)

Chapter 2
1. When data cannot be changed after a class is compiled, the data is A. constant
2. Which of the following is not a primitive data type in Java? D. sector
3. Which of the following element is not required in variable declaration? C. an assigned vale
4. The assignment operator in Java is
A. =
5. Assuming you have declared shoeSize to be a variable of type int, which of the following is a valid assignment statement in Java? A. shoeSize = 9;
6. Which of the following data types can store a value in the least amount of memory? D. byte
7. A boolean variable can hold
D. the value true and false
8. The value can 137.68 can be held by a variable of type
D. Two of the preceding answers are correct
9. An escape sequence always begins with a(n)
C. backslash
10. Which Java statement produces the following output?
C. system.out.print In ("w\nxyz");
11. The remainder operator
D. is none of the above
12. According to the rules of operator precedence, when division occurs in the same arithmetic statement as..........., the division operator always takes place first. C. subtraction
13. The “equal to” relational operator is
B. ==
14. When you perform arithmetic with values of diverse types, the Java B. implicitly converts the values to a unifying type.
15. If you attempt to add a float, an int, and a byte, the result will be a(n) A. float
16. You use a ..... to explicitly over override an implicit type B. type caset
17. In Java, what is the value of 3 + 7 * 4 + 2?
18. What assignment is correct in Java?
C. double value = 2.12;
19. Which assignment is correct in Java?
D. All of the above are correct
20.  Which assignment is correct in Java?
C. char aChar = '*';
tracking img