0% found this document useful (0 votes)
46 views

Preguntas

Uploaded by

geovannyp1
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
46 views

Preguntas

Uploaded by

geovannyp1
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

DRIVE INTO DESIGN PATTERNS

INTRODUCTION TO OOP
● All the object’s methods not define the behavior of the data stored inside the
object’s fields?
○ True
○ False

● What is a superclass?
○ A superclass defines only attributes or behaviors that differ.
○ A superclass is a parent class that can contain subclass
○ A superclass is not hierarchie class

● The four pillars of OOP are


○ Inheritance, Abstraction, Hierarchy, Organisms
○ Encapsulation, Polymorphism, Organisms, Hierarchy
○ Abstraction, Organisms, Encapsulation, Hierarchy
○ Polymorphism, Abstraction, Inheritance, Encapsulation

● If you declare a method in the superclass, you can’t hide that method in a
subclass. That's the concept of:
○ Abstraction
○ Inheritance
○ Encapsulation
○ Polymorphism

● When a class is made accessible only from within the methods of its own class,
that's the concept of:
○ Abstraction
○ Inheritance
○ Encapsulation
○ Polymorphism

● The ability of a program to detect the real class of an object and call its
implementation even when it's real type is unknown in the current context is
○ Abstraction
○ Inheritance
○ Encapsulation
○ Polymorphism

● The model which represents all details relevant to this context with high
accuracy and omits all the rest is
○ Abstraction
○ Inheritance
DRIVE INTO DESIGN PATTERNS

○ Encapsulation
○ Polymorphism

● A concept implies that an object accepts another object as a method


parameter, instantiates, or uses another object. That concept is
○ Composition
○ Dependency
○ Aggregation

● Talking about relations between objects, UML represents relations between


classes.
○ True
○ False

INTRODUCTION TO DESIGN PATTERNS


● Select the right concepts:
○ A pattern is a more high-level description of a solution.
○ A pattern defines a clear set of actions that can achieve some goal.
○ An algorithm is a more high-level description of a solution.
○ An algorithm defines a clear set of actions that can achieve some goal.

● All patterns can be categorized by their intent, or purpose?


○ True
○ False

● What is the right concept of Design Patterns?


○ A toolkit of tried and tested solutions to common problems in software
design
○ Provide object creation mechanisms that increase flexibility and reuse
of existing code
○ Take care of effective communication and the assignment of
responsibilities between objects

● Select the sections that are present in a pattern description:


○ Creational
○ Structure
○ Intent
○ Motivation
○ Architectural
○ Code example
DRIVE INTO DESIGN PATTERNS

SOFTWARE DESIGN PRINCIPLES


● A way to reduce development costs is instead of developing something over
and over from scratch, reuse existing code in new projects is the meaning of
○ TestSuite
○ Good Design
○ Code Reuse
○ TestCase

● The three levels of reuse class are:


○ Design Pattern (low level)
○ Frameworks (highest level)
○ Frameworks (middle level)
○ Reuse Classes (low level)
○ Reuse Classes (highest level)
○ Design Pattern (middle level)

● What means if someone asks you to change something in your app?


○ Means the client have to be more committed with the cronogram
○ Means someone cares about it
○ Means you need responsable with the client

● When minimize all the effect caused by changes, we are talking about:
○ Favor Composition
○ Program to an interface
○ Encapsulate what varies

● Extract everything to a new class to make things much more clear and simple
is:
○ Encapsulation on a method level
○ Encapsulation on a class level
○ Encapsulation on a function level

● What happens when you make one class dependent on other class?
○ You are making two classes collaborate
○ You are separating two functionalities on different classes
○ You are applying the encapsulate concept

● When a class is become independent from other classes and you can extend
this class and introduce new types of subclasses while still reusing a portion of
the base class, that means:
DRIVE INTO DESIGN PATTERNS

○ Factory Method pattern


○ Abstract Factory pattern
○ Builder pattern
● A subclass can reduce the interface of the superclass
○ True
○ False

● Inheritance breaks encapsulation of the superclass


○ True
○ False

● The composition is another alternative to inheritance that represents:


○ “Has a” relationship between classes
○ “Have to” relationship between classes
○ “Is a” relationship between classes

● What you have to do when is hard to focus on specific aspects of the program?
○ Change it every time one of these things changes
○ Break other parts of the class which you didn't even intend to change.
○ Check whether it’s time to divide some classes into parts.

● Keep existing code from breaking when you implement new features is the
principle of:
○ Single Responsibility
○ Open/Closed
○ Liskov Substitution
○ Interface Segregation

● Class inheritance limit the number of interfaces that the class can implement
at the same time?
○ True
○ False

● According parameters, what of this concepts is right?


○ Parameter types in a method of a subclass should match or be more
abstract than parameter types in the method of the superclass
○ Parameter types in an attribute of a class should not match or be more
abstract than parameter types in the method of the superclass
○ Parameter types in a method of a superclass should match or be more
abstract than parameter types in the method of the subclass

● What suggest the Dependency Inversion Principle?


DRIVE INTO DESIGN PATTERNS

○ High-level classes should depend on low-level classes


○ Change the direction of this dependency
○ Design high-level classes first and only then start working on low-level
ones.

CATALOG OF DESIGN PATTERNS


● Select the types of design patterns:
○ Structural
○ Creational
○ Relational
○ Behavioral
○ Not relational

● What method separates the product construction code from the code that
actually uses the product?
○ Abstract Method
○ Factory Method
○ Builder Method
○ Prototype Method
○ Singleton Method

● When you have to consider implements the Abstract Factory?


○ When you have to worry about creating the wrong variant of a product
which doesn’t match the products already created by your app.
○ When you have a class with a set of Factory Methods that blur its
primary responsibility.
○ When your code needs to work with various families of related products,
but you don’t want it to depend on the concrete classes of those
products

● What is the downside of having a lot of parameters on constructor?


○ Cause a bad performance and unfulfilling cache
○ Makes the constructor calls pretty ugly
○ Eliminates the needed for subclasses
○ Not all the parameters are needed at all times.

● What happens after implements Builder Pattern and you build objects step by
step, using only those steps that you really need?
○ You don’t have to cram dozens of parameters into your constructors
anymore.
○ Your code not be able to create different representations of some
product.
DRIVE INTO DESIGN PATTERNS

○ Defines all possible construction steps

● What of this patterns are not part of Structural Design?


○ Proxy
○ Prototype
○ Composite
○ Singleton
○ Bridge

● Select the correct features of Adapter:


○ Can convert data into various formats.
○ Can help objects with different interfaces collaborate.
○ Can transform the type of a class.
○ Can inherit the attributes of a superclass

● What is recommended to do when you have to make changes to a monolithic


codebase?
○ You can extend such an app in independent directions
○ Making changes to smaller, well-defined modules is much easier.
○ You must understand the entire thing very well

● Is a pattern that lets you copy existing objects without making your code
dependent on their classes
○ Proxy
○ Prototype
○ Composite
○ Singleton
○ Bridge

● What are the caveats that you have to be aware of about Inheritance?
○ You have to create special subclasses which combined several
notification methods within one class.
○ You can’t alter the behavior of an existing object at runtime.
○ Inheritance doesn’t let a class inherit behaviors of multiple classes at
the same time.
○ You can only replace the whole object with another one that’s created
from a different subclass.

● According the proxy pattern, what does the proxy do when receive a request
from the client?
○ Execute some deferred initialization code.
DRIVE INTO DESIGN PATTERNS

○ The proxy creates a real service object and delegates all the work to it.
○ Create a new proxy class with the same interface as an original service
object

● What patterns are concerned with algorithms and the assignment of


responsibilities between objects?
○ Creational Design
○ Behavioral Design
○ Structural Design

● When you are passing requests along a chain of handlers, what happens when
a request is received?
○ Each handler decides either to process the request or to pass it to the
next handler in the chain
○ The handler restrict access to the system
○ Checks must be performed sequentially
○ Each handler block the request until have been authorized

● What suggest command pattern about GUI objects?


○ The GUI objects may not access the business logic objects directly
○ GUI objects shouldn’t send requests directly
○ GUI objects are responsible for rendering a beautiful picture on the
screen.

● What are the request details that you should extract into a separate command
class?
○ The object being called
○ The name of the method
○ The parameters
○ The list of arguments

● Is a pattern that lets you save and restore the previous state of an object
without revealing the details of its implementation.
○ Iterator
○ Flyweight
○ Memento
○ Visitor

● According the visitor pattern, what if a behavior can be executed over objects
of different classes?
○ The class may define a set of methods, each of which could take
arguments of different types.
DRIVE INTO DESIGN PATTERNS

○ The class need to be refactored


○ The class has to implement a constructor with the correct parameters

You might also like