Java: Chapter 2 Review

Ace your homework & exams now with Quizwiz!

The remainder operator____________

must follow a division operation

The value 137.68 can be held by a variable of type

a. int b. float c. double d. Two of the preceding answers are correct. (answer float and double)

An escape sequence always begins with a(n):

backslash

Which type of variable can hold the value 'true' or 'false':

boolean

Data type that can store a value in the least amount of memory:

byte

In Java, what is the value of 3 + 7 * 4 + 2?

33

The assignment operator in Java is:

=

The "equal to" relational operator is:

==

Which of the following is not a primitive data type in Java: boolean, byte, int, or sector

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

What do you use to explicitly override an implicit type:

type cast

Which is a correct statement to prompt the program to output a line:

System.out.println();

Which assignment is correct in Java?

a) Double money= 12; b) Double money= 12.0; c) Double money= 12.0d; All of the above are correct(answer):

Which assignment is correct in Java?

a. int value = (float) 4.5; b. float value = 4 (double); c. double value = 2.12; <----- Answer d. char value = 5c;

Which of the following elements is not required in a variable declaration: a type, an identifier, an assigned value, or a semicolon

an assigned value

Which Java statement produces the following output? w xyz

c. System.out.println("w\nxyz");

Example of a correct assignment statement for a character data type:

char aChar = '*';

When data cannot be changed after a class is compiled, the data is:

constant

If you attempt to add a float, an int, and a byte, the result will be a(n)__________________

d. error

What are two data type variables that can hold values with decimals:

float or double

When you perform arithmetic with values of diverse types, Java:

implicitly converts the values to a unifying type

example of a valid assignment statement in Java

shoeSize = 9;

You use a ___________ to explicitly override an implicit type.

type cast


Related study sets

Chapter 7: Auditing, Testing, and Monitoring

View Set

Microbiology Lab (Exercises 1-20)

View Set

Western Civ Final Exam: Chapters 5-8 and 13-15

View Set