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

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

SD 2 – Object-Oriented Programming 1

Vista previa del contenido

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




2. What does the static keyword indicate about a method or variable in OOP?

A. It belongs to an instance of the class

B. It is shared among all instances of the class

C. It cannot be accessed from outside the class

D. It must be overridden in subclasses

Answer: B) It is shared among all instances of the class

,Rationale: A static method or variable is shared across all instances of the class and

can be accessed without creating an instance of the class.




3. Which of the following is an example of a real-world object that can be

represented in an object-oriented system?

A. An integer

B. A car, with properties like color and speed

C. A function that performs calculations

D. A constant value

Answer: B) A car, with properties like color and speed

Rationale: A real-world object like a car can be represented in OOP with attributes

(properties) and methods (behaviors).




4. Which of the following is a valid reason to use interfaces in OOP?

A. To provide a concrete implementation of methods

B. To define a contract that classes must follow

C. To allow inheritance of properties

D. To provide access to the instance variables of other classes

, Answer: B) To define a contract that classes must follow

Rationale: An interface defines a set of methods that any implementing class must

provide, promoting a contract-based approach.




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




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

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