100% de satisfacción garantizada Inmediatamente disponible después del pago Tanto en línea como en PDF No estas atado a nada 4.2 TrustPilot
logo-home
Examen

CMSC132 - Final Exam Review Questions and Answers

Puntuación
-
Vendido
-
Páginas
8
Grado
A+
Subido en
23-06-2025
Escrito en
2024/2025

CMSC132 - Final Exam Review

Institución
CMSC 132
Grado
CMSC 132









Ups! No podemos cargar tu documento ahora. Inténtalo de nuevo o contacta con soporte.

Escuela, estudio y materia

Institución
CMSC 132
Grado
CMSC 132

Información del documento

Subido en
23 de junio de 2025
Número de páginas
8
Escrito en
2024/2025
Tipo
Examen
Contiene
Preguntas y respuestas

Temas

Vista previa del contenido

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
$16.49
Accede al documento completo:

100% de satisfacción garantizada
Inmediatamente disponible después del pago
Tanto en línea como en PDF
No estas atado a nada


Documento también disponible en un lote

Conoce al vendedor

Seller avatar
Los indicadores de reputación están sujetos a la cantidad de artículos vendidos por una tarifa y las reseñas que ha recibido por esos documentos. Hay tres niveles: Bronce, Plata y Oro. Cuanto mayor reputación, más podrás confiar en la calidad del trabajo del vendedor.
Dreamer252 NBursing
Seguir Necesitas iniciar sesión para seguir a otros usuarios o asignaturas
Vendido
478
Miembro desde
2 año
Número de seguidores
293
Documentos
21304
Última venta
1 semana hace

4.0

115 reseñas

5
60
4
22
3
18
2
2
1
13

Recientemente visto por ti

Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes