Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 4 out of 66 pages
Exam (elaborations)

ABSOLUTE JAVA COMPREHENSIVE EXAM SCRIPT VERIFIED QUESTIONS AND SOLUTIONS GRADED APLUS

Document preview thumbnail
Preview 4 out of 66 pages

ABSOLUTE JAVA COMPREHENSIVE EXAM SCRIPT VERIFIED QUESTIONS AND SOLUTIONS GRADED APLUS

Content preview

ABSOLUTE JAVA COMPREHENSIVE EXAM
SCRIPT VERIFIED QUESTIONS AND
SOLUTIONS GRADED APLUS

●● Why do we need to implement the Clonable interface?
Answer: At runtime it would throw the CloneNotSupportedException if
we don't implement the Cloneable interface. A class implements the
Cloneable interface to indicate to the Object.clone() method that it is
legal for that method to make a field-for-field copy of instances of that
class.


●● What is a marker interface?
Answer: A Marker interface, has no method.
Serializable, Clonable are marker interfaces.


●● How do you clone an object?
Answer: MyClone a = (MyClone) c.clone()
- TypeCast is nessesary.
- handle CloneNotSupportedException


●● Why can Annotations replace marker interfaces?

,Answer: Annotations can convey metadata about the class to its
consumers without creating a separate type for it. Annotations let you
pass information to classes that "consume" it.


●● What is Double-Checked Locking?
Answer: To reduce the overhead of acquiring a lock by first testing the
locking criterion without actually acquiring the lock.


●● How do you make an object serializable?
Answer: The class must implement the java.io.Serializable interface


●● Java object serialization is performed using which classes?
Answer: Java object serialization (writing) is done with the
ObjectOutputStream and deserialization (reading) is done with the
ObjectInputStream.


●● What is serialVersionUID?
Answer: In addition to implementing the Serializable interface, a class
intended for serialization should also contain a private static final long
variable named serialVersionUID.
The serialVersionUID variable is used by Java's object serialization API
to determine if a deserialized object was serialized (written) with the
same version of the class, as it is now attempting to deserialize it into.
If you make changes to the class that affect serialization, you should also
change its serialVersionUID value.

,●● What is escape analysis?
Answer: escape analysis is a method for determining the dynamic scope
of pointers - where in the program a pointer can be accessed.


●● What is the size of byte?
Answer: 8 bits


●● What is the size of char?
Answer: 16 bits


●● What is the size of short?
Answer: 16 bits


●● What is the size of int?
Answer: 32 bits


●● what is the size of long?
Answer: 64 bits


●● what is the size of float?
Answer: 32 bits

, ●● what is the size of double?
Answer: 64 bits


●● What is the range of byte
Answer: -128 to 127


●● What is the range of short?
Answer: -32,768 to 32,767


●● What is the range of int?
Answer: -2,1 billion to 2,1billion


●● How do you check if a number is even?
Answer: check if number AND 1 is 0


●● How do you test if the n-th bit is set?
Answer: Shift n times to the right and then AND


●● How can you set the n-th bit
Answer: Shift n times to the left and OR

Document information

Uploaded on
July 15, 2026
Number of pages
66
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers
$13.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.
GradeGalaxy
4.4
(9)
Sold
132
Followers
4
Items
44864
Last sold
4 hours 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