Filters
Question type

Study Flashcards

The JVM periodically performs this process to remove unreferenced objects from memory.


A) memory shuffling
B) system restore
C) garbage collection
D) memory sweeping

E) A) and B)
F) A) and C)

Correct Answer

verifed

verified

A declaration for an enumerated type begins with this key word.


A) enumerated
B) enum type
C) ENUM
D) enum

E) All of the above
F) A) and B)

Correct Answer

verifed

verified

If a class has a method named finalize, it is called automatically just before an instance of the class is destroyed by the garbage collector.

A) True
B) False

Correct Answer

verifed

verified

When you write an enumerated type declaration, you


A) are actually creating a special kind of class.
B) do not enclose the enum constants in quotation marks.
C) should use the standard convention of writing the enum constants in uppercase.
D) All of the above

E) A) and B)
F) A) and D)

Correct Answer

verifed

verified

A class's static methods do not operate on the fields that belong to any instance of the class.

A) True
B) False

Correct Answer

verifed

verified

A static field is created by placing the key word static


A) after the access specifier and field's data type.
B) after the access specifier and before the field's data type.
C) after the field name.
D) in brackets, before the field's data type.

E) None of the above
F) B) and C)

Correct Answer

verifed

verified

When the this variable is used to call a constructor


A) it must be the first statement in the constructor making the call.
B) it can be anywhere in the constructor making the call.
C) it must be the last statement in the constructor making the call.
D) You cannot use the this variable in a constructor call.

E) All of the above
F) A) and B)

Correct Answer

verifed

verified

By default, a reference variable that is an instance field is initialized to the value


A) null.
B) 0.
C) void.
D) static.

E) All of the above
F) B) and D)

Correct Answer

verifed

verified

Assuming the following declaration exists: Enum Tree { OAK, MAPLE, PINE } What will the following code display? System.out.println(Tree.OAK) ;


A) OAK
B) Tree.OAK
C) 0
D) 1

E) None of the above
F) All of the above

Correct Answer

verifed

verified

CRC stands for


A) Class, Recyclability, Collaborations.
B) Class, Redundancy, Collections.
C) Class, Responsibilities, Collaborations.
D) Code, Reuse, Constancy.

E) C) and D)
F) A) and B)

Correct Answer

verifed

verified

If you write a toString method for a class, Java will automatically call the method any time you concatenate an object of the class with a string.

A) True
B) False

Correct Answer

verifed

verified

You may use this to compare two enum data values.


A) the ordinal method
B) the ==, >, and < operators
C) the equals and compareTo methods
D) the moreThan, lessThan, and equalsTo methods

E) A) and C)
F) None of the above

Correct Answer

verifed

verified

The key word this is the name of a reference variable that an object can use to refer to itself.

A) True
B) False

Correct Answer

verifed

verified

Overloading is


A) writing a method that does too much processing.
B) writing a program that is too large to fit in memory.
C) having two or more methods with the same name, but different signatures.
D) having two or more methods with the same signature.

E) A) and D)
F) A) and C)

Correct Answer

verifed

verified

If the following is from the method section of a UML diagram, which of the following statements is true? + equals(object2:Stock) : boolean


A) This is a public method that accepts a Stock object as its argument and returns a boolean value.
B) This is a public method that returns a reference to a String object.
C) This is a private method that receives two objects from the Stock class and returns a boolean value.
D) This is a private method that returns a boolean value.

E) B) and C)
F) None of the above

Correct Answer

verifed

verified

When a field is declared static, there will be


A) a copy of the field for each method in the class.
B) a copy of the field in each class object.
C) only one copy of the field in memory.
D) two reference copies of the field for each method in the class.

E) None of the above
F) All of the above

Correct Answer

verifed

verified

The names of the enum constants in an enumerated data type must be enclosed in quotation marks.

A) True
B) False

Correct Answer

verifed

verified

An enumerated data type is actually a special type of class.

A) True
B) False

Correct Answer

verifed

verified

To get the name of a calling enum constant,


A) simply use the enum constant in the statement.
B) use the ordinal method.
C) use the displayName method.
D) use the toString method.

E) C) and D)
F) None of the above

Correct Answer

verifed

verified

You cannot use the fully-qualified name of an enum constant for


A) a case expression.
B) an argument to a method.
C) a boolean expression.
D) All of the above.

E) All of the above
F) A) and D)

Correct Answer

verifed

verified

Showing 21 - 40 of 40

Related Exams

Show Answer