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

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

SD 2 – Object-Oriented Programming 4

Vista previa del contenido

1. 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.




2. Which of the following is true about the "abstract" keyword?

A. It is used to create instances of a class

B. It defines the behavior of a method in a class

C. It indicates that a class cannot have any methods

D. It defines methods that must be implemented by derived classes

Answer: D) It defines methods that must be implemented by derived classes

,Rationale: The abstract keyword is used to define methods in an abstract class that

must be implemented by any non-abstract subclass.




3. What is the main purpose of the protected access modifier?

A. To allow access to class members from the same class and its subclasses

B. To restrict access to class members to only within the class

C. To allow access to class members from anywhere in the program

D. To allow access to class members from only within its package

Answer: A) To allow access to class members from the same class and its

subclasses

Rationale: The protected access modifier allows access to class members from the

class itself and its subclasses.




4. What does the private access modifier mean in OOP?

A. The member is accessible only within its class

B. The member is accessible from any class

C. The member is accessible from its package only

D. The member is accessible from subclasses

, Answer: A) The member is accessible only within its class

Rationale: The private access modifier restricts access to members of a class from

any other class except the class where it is declared.




5. Which of the following is a feature of object-oriented programming?

A. Data is hidden

B. Data is manipulated directly

C. Functions are not used

D. Programs are written in a procedural way

Answer: A) Data is hidden

Rationale: One of the key features of OOP is data encapsulation, which means data

is hidden from outside access and can only be accessed through public methods.




6. Which keyword is used to prevent a class from being inherited in OOP?

A. static

B. private

C. final

D. abstract

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