Question 1
Select the true statement about composition.
- Composition extends a class’s capabilities by adding new components and modifying the existing ones
- Composition allows a class to be projected as a container of different classes
- Composition is a concept that promotes code reusability, while Inheritance promotes encapsulation
- Composition is based on the has a relation, so it cannot be used together with inheritance
Question 2
Analyze the following snippet and select the statement that best describes it.
- The code is an example of implicitly chained exceptions.
- The code is erroneous as the OwnMath class does not inherit from any Exception type class
- The code is fine and the script execution is not interrupted by any exception.
- The code is an example of explicitly chained exceptions
Question 3
Analyze the following snippet and select the statement that best describes it.
- self.name is the name of a class variable
- var1 is the name of a global variable
- Excalibur is the value passed to an instance variable
- weapon is the value passed to an instance variable
Question 4
The following snippet represents one of the OOP pillars. Which one is that?
- Serialization
- Inheritance
- Encapsulation
- Polymorphism
Question 5
Analyze the following function and choose the statement that best describes it.
- It is an example of a decorator that accepts its own arguments.
- It is an example of decorator stacking.
- It is an example of a decorator that can trigger an infinite recursion
- The function is erroneous.