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

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

SD 2 – Object-Oriented Programming 8

Vista previa del contenido

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




2. What is the main difference between an abstract class and an interface?

A. Abstract classes can have methods with implementations, while interfaces

cannot

B. Abstract classes are used for single inheritance, while interfaces allow multiple

inheritance

C. Interfaces can have only static methods, while abstract classes can have instance

methods

,D. There is no difference

Answer: A) Abstract classes can have methods with implementations, while

interfaces cannot

Rationale: Abstract classes can have both abstract (unimplemented) and concrete

(implemented) methods, while interfaces can only declare abstract methods (prior

to Java 8).




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

D. A method that manipulates data

Answer: C) An instance of a class

Rationale: An object is an instance of a class, containing data and methods defined

by the class.




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




5. Which of the following is a valid reason to use object-oriented programming

over procedural programming?

A. It is more efficient in terms of execution time

B. It provides better tools for abstraction and code reuse

C. It requires less memory to store data

D. It simplifies basic programming concepts

Answer: B) It provides better tools for abstraction and code reuse

Rationale: OOP allows for better abstraction, modularity, and code reuse through

inheritance, polymorphism, and encapsulation.

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