Chapter 2 Review Questions

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

Which assignment is correct in Java?

char aChar = '*';

The remainder operator ...

none of the above

Which of the following is not a primitive data type in Java?

sector

Assuming you have declared shoeSize to be a variable of type int, which of the following is a valid assignment statements in Java?

shoeSize = 9;

A boolean variable can hold ...

the value true or false

You use a ...

type cast to explicitly override an implicit type

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 Java statement produces 'w' on one line and 'xyz' on the next line?

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

Which of the following elements is not required in a variable declaration?

an assigned value

Which of the following data types can store the value 0 using the least amount of memory?

byte

An escape sequence always begins with a(n)

backslash

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

constant

Which assignment is correct in Java?

double money = 12; double money = 12.0; double money = 12.0d; all of the above

Which assignment is correct in Java?

double value = 2.12;

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

float

The value 137.68 can be held by a variable of type ...

float/double

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

implicitly converts the values to a unifying type

According to the rules of operator precedence, when division occurs in the same arithmetic statement as ...

subtraction, the division operation always takes place first.


Ensembles d'études connexes

sociology test 2 chapters 3,4, and 6

View Set

AP European History Napoleon Quiz

View Set

Chapter 5: Performance Appraisal

View Set

Specific heat, heat of vaporization, and density of water

View Set

Peds- Ch. 33 Caring for Children in Diverse Settings

View Set

Custom: RN Geriatric Practice 2019 A

View Set

LEADERSHIP/ MANAGEMENT practice EAQ

View Set