• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 2 out of 6 pages
Exam (elaborations)

Java Ch8 Examination Questions With Correct Answers

Document preview thumbnail
Preview 2 out of 6 pages

JAVA CH8 EXAMINATION QUESTIONS WITH CORRECT ANSWERS

Content preview

JAVA CH8 EXAMINATION
QUESTIONS WITH CORRECT
ANSWERS

8.9 Q1: enum types are implicitly ________ and enum constants are implicitly
________.
a. a. final, static.
b. b. static, static.
c. c. static, final.
d. d. final, final.
. - Answer- ANS: a. final, static

8.9 Q2: Which statement is false?
a. a. An enum declaration is a comma-separated list of enum constants and may
optionally include other components of traditional classes, such as constructors, fields
and methods.
b. b. Any attempt to create an object of an enum type with operator new results in a
compilation error.
c. c. An enum constructor cannot be overloaded.
d. d. An enum constructor can specify any number of parameters. - Answer- ANS: c. An
enum constructor cannot be overloaded.

8.9 Q3: Which method returns an array of the enum's constants?
a. a. values.
b. b. getValues.
c. c. constants.
d. d. getConstants. - Answer- ANS: a. values.

8.10 Q1: Which of the following is false?
a. a. Method finalize does not take parameters and has return type void.
b. b. Memory leaks using Java are rare because of automatic garbage collection.
c. c. Objects are marked for garbage collection by method finalize.
d. d. The garbage collector reclaims unused memory. - Answer- ANS: c. Objects are
marked for garbage collection by method finalize. (Objects are marked for garbage
collection when there are no more references to the object).

8.11 Q1: Static class variables:
a. a. are final.
b. b. are public.
c. c. are private.

, d. d. are shared by all objects of a class. - Answer- ANS: d. are shared by all objects of
a class.

8.11 Q2: Which of the following is false?
a. a. A static method must be used to access private static instance variables.
b. b. A static method has no this reference.
c. c. A static method can be accessed even when no objects of its class have been
instantiated.
d. d. A static method can call instance methods directly. - Answer- d. d. A static method
can call instance methods directly.

8.12 Q1: Which syntax imports all static members of class Math?
a. a. static import java.lang.Math.*.
b. b. import static java.lang.Math.*.
c. c. static import java.lang.Math.
d. d. import static java.lang.Math. - Answer- ANS: b. import static java.lang.Math.*.

8.13 Q1: Instance variables declared final do not or cannot:
a. a. Cause syntax errors if used as a left-hand value.
b. b. Be initialized.
c. c. Be modified.
d. d. None of the above. - Answer- ANS: c. Be modified.

8.13 Q2: A final field should also be declared ________ if it is initialized in its
declaration.
a. a. private.
b. b. public.
c. c. protected.
d. d. static. - Answer- ANS: d. static.

8.16 Q1: A package is:
a. a. A directory structure used to organize classes and interfaces.
b. b. A mechanism for software reuse.
c. c. A group of related classes and interfaces.
d. d. All of the above. - Answer- ANS: d. All of the above.

8.16 Q2: A class within a package must be declared public if
a. a. It will be used only by other classes in the same package.
b. b. It will be used by classes that are not in the same package.
c. c. It is in the same directory as the other classes in the package.
d. d. It has a unique name. - Answer- ANS: b. It will be used by classes that are not in
the same package. Classes outside the package cannot use a class if the class is not
declared public.

Document information

Uploaded on
September 12, 2025
Number of pages
6
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers
$15.99

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
wisdompoint
3.7
(20)
Sold
120
Followers
66
Items
5730
Last sold
4 months ago




Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions