Unit 2 Reviewing the Basics Quiz
When you perform arithmetic with values of diverse types, Java ____________.
c. implicitly converts the values to a unifying type
The equal to relational operator is ____________.
d. "=="
An escape sequence always begins with a(n) ____________.
d. backslash
Which assignment is correct in Java?
d. double value = 2.12;
Which of the following is not a primitive data type in Java?
sector
According to the rules of operator precedence, when division occurs in the same arithmetic statement as ____________, the division operation always takes place first.
subtraction
In Java, what is the value of 3 + 7 * 4 + 2?
33
A boolean variable can hold any character.
False
The assignment operator in Java is ==.
False
The value 137.68 can be held by a variable of type float.
True
You use a type cast to explicitly override an implicit type.
a. True
Which assignment is correct in Java?
a. double money = 12.0; b. double money = 12; c. double money = 12.0d; d. **All of the answer choice assignments are correct.**
The remainder operator ____________.
a. is represented by %
Which Java statement produces w on one line and xyz on the next line?
b. System.out.println("w\nxyz");
Which of the following elements is not required in a variable declaration?
b. a period
When data cannot be changed after a class is compiled, the data is ____________.
b. constant
Which of the following data types can store the value 0 using the least amount of memory?
byte
Which assignment is correct in Java?
c. char aChar = '*';
Assuming you have declared shoeSize to be a variable of type int, which of the following is a valid assignment statement in Java?
c. shoeSize = 9;
If you attempt to add a float, an int, and a byte, the result will be a(n) ____________.
d. float