• ¿Documento equivocado? Cámbialo gratis
  • Escrito por estudiantes que aprobaron
  • Inmediatamente disponible después del pago
  • Leer en línea o como PDF
Vender
¿Dónde estudias?
Tu idioma
Document preview thumbnail
Vista previa 3 fuera de 30 páginas
Examen

SD 2 – Object-Oriented Programming 5

Document preview thumbnail
Vista previa 3 fuera de 30 páginas

SD 2 – Object-Oriented Programming 5

Vista previa del contenido

1. Which of the following is a characteristic of an abstract class?

A. It can be instantiated directly

B. It contains only abstract methods

C. It may have both abstract and concrete methods

D. It cannot inherit from other classes

Answer: C) It may have both abstract and concrete methods

Rationale: An abstract class can have abstract methods (without implementations)

and concrete methods (with implementations).




2. Which of the following is an example of a constructor in OOP?

A. A method that sets object properties

B. A method that creates a new instance of a class

C. A method that returns the value of an object

D. A method that ends the class execution

Answer: B) A method that creates a new instance of a class

,Rationale: A constructor is a special method used to initialize a new object when it

is created.




3. Which of the following OOP principles is used when a child class reuses

methods from a parent class?

A. Abstraction

B. Encapsulation

C. Inheritance

D. Polymorphism

Answer: C) Inheritance

Rationale: Inheritance allows a subclass to inherit methods and properties from a

superclass.




4. Which of the following is an example of a "has-a" relationship?

A. A student "is-a" person

B. A dog "has-a" collar

C. A vehicle "is-a" object

D. A class "has-a" method

, Answer: B) A dog "has-a" collar

Rationale: A "has-a" relationship is a composition, where one object contains

another object.




5. What is method overloading in OOP?

A. The ability of an object to take on many forms

B. Defining methods with the same name but different parameter types

C. Defining a method in multiple classes with different behavior

D. Reusing a method from a parent class

Answer: B) Defining methods with the same name but different parameter types

Rationale: Method overloading allows defining multiple methods with the same

name but different parameter types or counts.




6. What is the purpose of a destructor in object-oriented programming?

A. To initialize the state of an object

B. To destroy an object and free memory

C. To return a value from an object

D. To define methods for an object

Información del documento

Subido en
17 de marzo de 2025
Número de páginas
30
Escrito en
2024/2025
Tipo
Examen
Contiene
Preguntas y respuestas
$10.99

¿Documento equivocado? Cámbialo gratis Dentro de los 14 días posteriores a la compra y antes de descargarlo, puedes elegir otro documento. Puedes gastar el importe de nuevo.
Escrito por estudiantes que aprobaron
Inmediatamente disponible después del pago
Leer en línea o como PDF

Seller avatar
douglasmugwe82
5.0
(1)
Vendido
2
Seguidores
0
Artículos
4215
Última venta
1 año hace



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