• ¿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 2

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

SD 2 – Object-Oriented Programming 2

Vista previa del contenido

1. Which of the following can cause an infinite recursion?

A. A constructor calling a parent constructor

B. A method calling itself without a base case

C. A class using multiple inheritance

D. A method overloading with the same name

Answer: B) A method calling itself without a base case

Rationale: Infinite recursion occurs when a method keeps calling itself without an

appropriate exit condition or base case.




2. Which of the following is an example of method overriding in OOP?

A. Defining a method with the same name but different parameters in the same

class

B. Redefining a parent class method in a child class

C. Defining a method that returns a different type than the parent class method

D. Defining a method that does not return anything

Answer: B) Redefining a parent class method in a child class

,Rationale: Method overriding occurs when a subclass provides a specific

implementation for a method already defined in its superclass.




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. What is the term for the ability of different classes to provide different

implementations of the same method?

A. Inheritance

B. Polymorphism

C. Encapsulation

, D. Abstraction

Answer: B) Polymorphism

Rationale: Polymorphism allows different classes to provide their own

implementation of methods that share the same signature.




5. Which of the following is an example of method overloading?

A. A method with the same name but different parameters

B. A method that changes its behavior based on the object type

C. A method that calls another method

D. A method that throws an exception

Answer: A) A method with the same name but different parameters

Rationale: Method overloading occurs when multiple methods with the same name

exist but with different parameter lists.




6. In OOP, what is an object?

A. A template for defining variables

B. A collection of data and functions

C. An instance of a class

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