100% tevredenheidsgarantie Direct beschikbaar na je betaling Lees online óf als PDF Geen vaste maandelijkse kosten 4.2 TrustPilot
logo-home
Tentamen (uitwerkingen)

CMSC132 - Final Exam Review Questions and Answers

Beoordeling
-
Verkocht
-
Pagina's
8
Cijfer
A+
Geüpload op
23-06-2025
Geschreven in
2024/2025

CMSC132 - Final Exam Review

Instelling
CMSC 132
Vak
CMSC 132









Oeps! We kunnen je document nu niet laden. Probeer het nog eens of neem contact op met support.

Geschreven voor

Instelling
CMSC 132
Vak
CMSC 132

Documentinformatie

Geüpload op
23 juni 2025
Aantal pagina's
8
Geschreven in
2024/2025
Type
Tentamen (uitwerkingen)
Bevat
Vragen en antwoorden

Onderwerpen

Voorbeeld van de inhoud

CMSC132 - Final Exam Review

Subclasses - answer- inherits all properties, behaviors, and fields of its superclass
- inherits private fields and methods in its super classes, but it cannot directly access
them
- can have more methods than its superclass
- classes can only extend one superclass
- subclass is a type of a superclass object
- constructor automatically calls its superclass's default constructor (error if it doesn't
have one)
- can explicitly invoke its superclass constructor using super
- execution order: most parent to most sub
- can redefine (override) methods in a superclass, but must have the same name and
signature
- can call an overridden method in a superclass using super( )
- can define a field with the same name as a superclass field

Super classes - answer- can refer to an object of any of its subclasses

object-name instanceof classname - answer- returns true if object is of the type
classname or if is an object of any of its subclasses

object-name.getClass() - answer- returns a reference to something called a class object
(unique object for each class in program), which can be compared using == or equals()
to see if object is the same class as another object

Dynamic binding - answer- the type of a object that a superclass reference refers to
determines which method gets called (when methods are overridden)
- DOES NOT APPLY TO STATIC METHODS

Final - answer- methods cannot be overridden by subclasses
- classes cannot be extended (no subclasses)

The Object class - answer- the (direct/indirect) superclass of all other classes in Java
- doesn't have fields, but it does have methods (equals( ) and toString( ))

Interfaces - answer- A collection of:
~ Constants
~ Method signatures (or prototypes), but no implementations
- a class can only implement one interface at a time
- Restriction of interfaces: CAN'T INSTANTIATE AN INTERFACE
- Reference of an interface type object - an object of any class that implements the
interface

, Composition - answer- using instance variables that refer to other objects in a class

Initialization block - answer- used to initialize fields of a class
- code that is executed once per object

Static initialization block - answer- code that is executed once for each class used while
program is running

When can fields be initialized? - answer- at point of declaration
- in a constructor
- in an initialization block

What is the order of field initialization? - answer1. Declarations and initialization blocks
(in the order they appear)
2. Constructor

Comparable Interface - answer- In a class implementing it, A.compareTo(B) should
return a negative value if A < B, 0 if A == B, and a positive value if A > B
- an array/ArrayList containing elements of a class that implements Comparable can be
sorted using Arrays.sort( ) or Collections.sort( ) (respectively)

Abstract classes - answer- classes with abstract methods must be abstract ("abstract" in
class heading)
- cannot be instantiated, but subclasses can extend an abstract class
- subclasses provide implementation for all abstract methods
- final methods cannot be overridden by subclass methods
- concrete object (of a non-abstract subclass) can be created, and referred to by a
reference of an abstract superclass type

What happens when an abstract class implements an interface? - answer- It's possible
for the abstract class to not implement all of the interface's methods

Types of Errors - answer- Compile-time (syntax) errors
- Runtime errors
- Logic Errors

Compile-time (syntax) Errors - answer- Errors in code construction, such as
typographical, grammatical, or type mismatch problems

Runtime Errors - answer- Operations that are illegal or impossible to execute
- Treated as exceptions in Java

Logic Errors - answer- These are operations leading to an incorrect program state
- They represent a problem in the design or implementation of the algorithm used

Maak kennis met de verkoper

Seller avatar
De reputatie van een verkoper is gebaseerd op het aantal documenten dat iemand tegen betaling verkocht heeft en de beoordelingen die voor die items ontvangen zijn. Er zijn drie niveau’s te onderscheiden: brons, zilver en goud. Hoe beter de reputatie, hoe meer de kwaliteit van zijn of haar werk te vertrouwen is.
Dreamer252 NBursing
Bekijk profiel
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
478
Lid sinds
2 jaar
Aantal volgers
293
Documenten
21304
Laatst verkocht
1 week geleden

4.0

115 beoordelingen

5
60
4
22
3
18
2
2
1
13

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via Bancontact, iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo eenvoudig kan het zijn.”

Alisha Student

Veelgestelde vragen