Section 1
Review Questions
When data cannot be changed after a class is compiled, the data is _____________.a. variableb. constantc. volatiled. mutable
Which of the following is not a primitive data type in Java?a. booleanb. bytec. sectord. int
Which of the following elements is not required in a variable declaration?a. a typeb. an identifierc. an assigned valued. a semicolon
The assignment operator in Java is _____________.a. =b. ==c. :=d. ::
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;b. shoeSize = 9.5;c. shoeSize = "nine";d. shoeSize = 9.5F;
Which of the following data types can store the value 0 using the least amount of memory?a. shortb. longc. intd. byte
A boolean variable can hold _____________.a. a characterb. a whole numberc. a decimal numberd. the value true or false
The value 137.68 can be held by a variable of type _____________.a. intb. shortc. doubled. byte
An escape sequence always begins with a(n) _____________.a. eb. forward slashc. backslashd. equal sign
Which Java statement produces w on one line and xyz on the next line?a. System.out.println("wxyz");b. System.out.println("w" + "xyz");c. System.out.println("w\nxyz");d. System.out.println("w\nx\ny\nz");
The remainder operator _____________.a. is represented by a forward slashb. must follow a division operationc. provides the quotient of integer divisiond. is represented by a percent sign
Which of the following operators has the lowest precedence?a. multiplicationb. remainderc. subtractiond. division
The equal to relational operator is _____________.a. =b. ==c. !=d. !!
When you perform arithmetic with values of diverse types, Java _____________.a. issues an error messageb. implicitly converts the values to a unifying typec. requires you to explicitly convert the values to a unifying typed. implicitly converts the values to the type of the first operand
If you attempt to add a float, an int, and a byte, the result will be a(n) _____________.a. floatb. intc. byted. error message
You use a _____________ to explicitly override an implicit type.a. mistakeb. type castc. formatd. type set
In Java, what is the value of $3+7 * 4+2 ?$a. 21b. 33c. 42d. 48
Which assignment is correct in Java?a. int value = (float) 4.5;b. float value = 4 (double);c. double value = 2.12;d. char value = 5c;
Which assignment is correct in Java?a. double money = 12;b. double money = 12.0;c. double money = 12.0d;d. All of these are correct.
Which assignment is correct in Java?a. char aChar = 5.5;b. char aChar = "W";c. char aChar = '*';d. char aChar = $$ \$ $$;