Java Data Types

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

Which primitive type represents a signed integer within the range of -128 to 127?

byte

Which primitive type represents a character encoded in UTF-16?

char

Which specialized operation is invoked like a method to initialize an object?

constructor

Which primitive type uses 8 bytes to represent a signed fractional value with 53 bits for the precision and 11 bits for the scale?

double

Which StringBuilder method overwrites characters within a string literal?

replace

Which primitive type represents a signed integer within the range of -32,768 to 32,767?

short

What are the only two possible values valid for a boolean variable?

true and false

Which prefix in a numerical literal indicates a binary number?

0b

Which prefix in a numerical literal indicates a hexadecimal number?

0x

What is the formula for determining the capacity of a StringBuilder if a String is specified in its constructor?

16 + numOfCharsInString

What is the decimal value for the numerical literal 0xA7?

167

What is the decimal value for the numerical literal 0b1111_1111?

255

In what phase is an object when it goes out of scope and has no remaining live pointers?

Dereferenced

Which three locations are invalid when placing underscores in a numeric literal?

Beginning or end of a number, contiguous to decimal points, or contiguous to F and L suffixes.

Whereas StringBuilder manipulation methods affect the underlying string literal, what do String manipulation methods do?

Create and return a new String object

In what phase is an object when the garbage collector is about to remove it from memory?

Finalized

What does the method length method of StringBuilder represent?

Number of characters in the underlying string

Which suffix specifies a literal value should be stored as a long?

L

Which action must be performed first to access an instance member in a class?

The class must be instantiated

Is 180_5.256_D a valid numerical literal in Java 7?

This is not valid.

Is 0b1100_0110 a valid numerical literal in Java 7?

This is valid.

Is 0xCCDD_1122 a valid numerical literal in Java 7?

This is valid.

Is 180_256L a valid numerical literal in Java 7?

This is valid.

What is the purpose for using underscore characters in a numeric literal?

To separate digits for higher readability.

When comparing two String variables, what does the method equals determine?

Whether both String variables have the same characters in the same sequence

When comparing two String variables, what does the operator == determine?

Whether both String variables point to the same object

Which StringBuilder method adds to the end of a string literal?

append

Which suffix specifies a literal value should be stored as a float?

f

Which primitive type uses 4 bytes to represent a signed fractional value with 23 bits for the precision and 8 bits for the scale?

float

Which characteristic describes an object, like String, that cannot be modified once it is created?

immutable

Which StringBuilder method injects new characters within a string literal?

insert

Which primitive type is default for a signed integer?

int

Which keyword is required to instantiate a class?

new

Given the class ClassA and the instance field field1, what expression will retrieve the value of field1?

new ClassA().field1

Given the class ClassA and the instance method method1, what statement will invoke method1?

new ClassA().method1();

Which type of variable, primitive or reference, copies its underlying value in an assignment operation?

primitive type

Which type of variable, primitive or reference, stores only its underlying value?

primitive type

Which type of variable, primitive or reference, shares a copy of an object pointer in an assignment operation?

reference type

Which type of variable, primitive or reference, stores a pointer to an object?

reference type


Set pelajaran terkait

Chapter 1 - Introduction to Computers and Programming

View Set

Leadership & Management Quizzes 4, 5, 6

View Set

PSY207 Chapter1, Mindtap practice questions

View Set

Unit 5: Interest and Dividend Income

View Set