CHAPTER 2 QUESTIONS STUDY GUIDE
In Java, what is the value of 3 + 7 * 4 + 2?
33
Which assignment is correct in Java? double money = 12; double money = 12.0; double money = 12.0d; All of the above are correct
All of the above are correct
Which of the following data types can store a value in the least amount of memory?
Byte
Which of the following elements is not required in a variable declaration?
an assigned value
An escape sequence always begins with a(n):
backslash
The assignment operator in Java is:
=
The "equal to" relational operator is:
==
Which of the following is not a primitive data type in Java?
Sector
Which Java statement produces the following output? W Xyz
System.out.println("w\nxyz");Xyz
Which assignment is correct in Java? a. char aChar = 5.5; b. char aChar = "W"; c. char aChar = '*'; d. Two of the preceding answers are correct
char aChar = '*';
When data cannot be changed after a class is compiled, the data is:
constant
The remainder operator: a. is represented by a forward slash b. must follow a division operation c. provides the quotient of integer division d. is none of the above
d. is none of the above
What assignment is correct in Java?
double value = 2.12;
The value 137.68 can be held by a variable of type:
float or double
If you attempt to add a float, an int, and a byte, the result will be a(n):
float.
When you perform arithmetic with values of diverse types, Java:
implicitly converts the values to a unifying type.
Assuming you have declared shoeSize to be a variable of type int, which of the following is a valid assignment statement in Java?
shoeSize = 9;
According to the rules of operator precedence, when division occurs in the same arithmetic statement as ___________, the division operator always takes place first.
subtraction
A Boolean variable can hold:
the value true or false
You use a _________ to explicitly override an implicit type.
type cast