100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Exam (elaborations)

CMSC132 Exam -1. Questions and Answers Fully Solved

Rating
-
Sold
-
Pages
6
Grade
A+
Uploaded on
23-06-2025
Written in
2024/2025

Exam of 6 pages for the course CMSC 132 at CMSC 132 (CMSC132 Exam -1.)

Institution
CMSC 132
Course
CMSC 132









Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
CMSC 132
Course
CMSC 132

Document information

Uploaded on
June 23, 2025
Number of pages
6
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers

Content preview

CMSC132 Exam #1

Serializing Objects - answer An object can be represented as a sequence of bytes that
includes the objects data as well as information about the objects type and the types of
data stored.

Super() - answer A method call in a sub class constructor invokes the superclass
constructor

Overloading - answer Having multiple methods with same name but different signatures
in a class

Overriding - answer Overrides the functionality of an existing method but not if it is
marked final

Inheritance - answer The process where one object acquires the properties of another

Is-A Relationship - answer Animal is the superclass of Mammals class therefore
Mammals _______ Animal

Has-A Relationship - answerDetermines whether a certain class _______ certain thing
(hint: some sort of relationship between super class and sub class)

Downcasting - answerSuperclass to subclass

Upcasting - answerSubclass to superclass
- not allowed because it throws an exception

Scanner - answerBreaks input into logical constructs, delimited by whitespace
(hint: Some methods include: hasNext(), nextInt(), next(), etc. of the java I/O)

Syntax for Scanner - answerScanner sc = new Scanner(System.in)
int i = sc.nextInt() //for int
String s = sc.next() //for String

equals(object obj) using getClass() - answerCompares memory reference

if(obj == this)
return true;
else if(obj != null && obj.getClass() == this.getClass())
Platypus p = (Platypus) obj;
return name.equals(p.name) && weight == p.weight etc.

, equals(object obj) using instanceof - answerCompares memory reference

if(obj == this)
return true;
else if(obj instanceof Platypus)
Platypus p = (Platypus) obj;
return name.equals(p.name) && weight == p.weight etc.
else return false;

instanceof vs. getClass() - answerinstanceof does the same thing but getClass() has to
make sure that object being compared is not null
hence: obj != null && obj.getClass() == this.getClass()

Inner Class - answerIs a class defined inside the scope of another class

Static Nested Classes - answerA nested class that's declared as a static class

Attributes of a Static Nested Class - answer- Can ONLY access static fields and
methods of the outer class
- No link to an instance of the outer class
- Is not associated with an outer class
- Does not survive longer than an outer class
(Answer: Attributes of a ____ ____ Class)

Different type of Inner Classes - answer1) Static Nested class
2) Anonymous class
3) Member Inner class // did not learn yet
3) Method-Local Inner class // did not learn yet
(Answer: Different type _____ Class)

What are Inner Class good for? - answer1) Can access all fields & methods of the
enclosing class
2) Increases the level of Encapsulation
3) Private helper class
- logical grouping of functionality
- Data hiding
4) Linkage to outer class
- An inner class object is tied to an outer class object

Enum Types - answerA type that has a fixed set of values, specifies all possible values
by listing them.
(hint: values(),valueOf(), name(), compareTo()...)

Encapsulation - answerTechnique of making the fields/methods/class in a class private
and providing access

Get to know the seller

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.
Dreamer252 NBursing
View profile
Follow You need to be logged in order to follow users or courses
Sold
478
Member since
2 year
Number of followers
293
Documents
21304
Last sold
1 week ago

4.0

115 reviews

5
60
4
22
3
18
2
2
1
13

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

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

Didn't get what you expected? Choose another document

No worries! You can immediately select a different document that better matches what you need.

Pay how you prefer, start learning right away

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

Student with book image

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

Alisha Student

Frequently asked questions