• Home
  • Textbooks
  • Java Programming
  • Using Data.

Java Programming

Joyce Farrell

Chapter 2

Using Data. - all with Video Answers

Educators


Section 1

Review Questions

Problem 1

When data cannot be changed after a class is compiled, the data is _____________.
a. variable
b. constant
c. volatile
d. mutable

Check back soon!

Problem 2

Which of the following is not a primitive data type in Java?
a. boolean
b. byte
c. sector
d. int

Check back soon!

Problem 3

Which of the following elements is not required in a variable declaration?
a. a type
b. an identifier
c. an assigned value
d. a semicolon

Check back soon!
01:04

Problem 4

The assignment operator in Java is _____________.
a. =
b. ==
c. :=
d. ::

Ernest Castorena
Ernest Castorena
Numerade Educator

Problem 5

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;

Check back soon!

Problem 6

Which of the following data types can store the value 0 using the least amount of memory?
a. short
b. long
c. int
d. byte

Check back soon!

Problem 7

A boolean variable can hold _____________.
a. a character
b. a whole number
c. a decimal number
d. the value true or false

Check back soon!

Problem 8

The value 137.68 can be held by a variable of type _____________.
a. int
b. short
c. double
d. byte

Check back soon!
00:25

Problem 9

An escape sequence always begins with a(n) _____________.
a. e
b. forward slash
c. backslash
d. equal sign

Ernest Castorena
Ernest Castorena
Numerade Educator

Problem 10

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");

Check back soon!

Problem 11

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 represented by a percent sign

Check back soon!
01:56

Problem 12

Which of the following operators has the lowest precedence?
a. multiplication
b. remainder
c. subtraction
d. division

Samriddhi Singh
Samriddhi Singh
Numerade Educator
01:04

Problem 13

The equal to relational operator is _____________.
a. =
b. ==
c. !=
d. !!

Ernest Castorena
Ernest Castorena
Numerade Educator

Problem 14

When you perform arithmetic with values of diverse types, Java _____________.
a. issues an error message
b. implicitly converts the values to a unifying type
c. requires you to explicitly convert the values to a unifying type
d. implicitly converts the values to the type of the first operand

Check back soon!

Problem 15

If you attempt to add a float, an int, and a byte, the result will be a(n) _____________.
a. float
b. int
c. byte
d. error message

Check back soon!

Problem 16

You use a _____________ to explicitly override an implicit type.
a. mistake
b. type cast
c. format
d. type set

Check back soon!
01:17

Problem 17

In Java, what is the value of $3+7 * 4+2 ?$
a. 21
b. 33
c. 42
d. 48

Cory Kuzinski
Cory Kuzinski
Numerade Educator
01:19

Problem 18

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;

Aditya Modi
Aditya Modi
Monroe Township High School

Problem 19

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.

Check back soon!

Problem 20

Which assignment is correct in Java?
a. char aChar = 5.5;
b. char aChar = "W";
c. char aChar = '*';
d. char aChar = $$ \$ $$;

Check back soon!