Font size
WorksheetssOME HISTORY STUFF
Total questions: 53
Worksheet time: 29mins
Which of the following statement is true. You may select more than one option
Design patterns are considered best practices and are often used by proficient
object-oriented software developers.
Design patterns have evolved over time through a collective iterative process by
many software developers
Design patterns are typical solutions to common challenges in software design.
Design patterns are static rules that do not evolve over time
What is the primary purpose of structural design pattern?
They break down existing classes into smaller and simpler structures.
They primarily handle object creation mechanisms.
They are used to create complex class structures by combining simpler classes.
They focus on communication between disjoint systems.
Which of the following statements accurately describes the iterator design pattern?
It is primarily used for modifying elements of a collection.
It restricts access to the elements of a collection.
It allows you to traverse elements of a collection while exposing its underlying
representation.
It lets you traverse elements of a collection without exposing its underlying
representation.
What is the purpose of the Adapter design pattern?
It is a pattern that deals with communication between objects
It is a pattern that allows objects with incompatible interfaces to collaborate
It is a pattern that deals with object creation mechanism
It is a pattern that provides a way to control access to another object
If you are working with objects that have very different internal representations,
such as enumeration types, event handling, or statefulness, which design pattern
would you apply?
Structural design pattern
Creational design pattern
Behavioral design pattern
Singleton design pattern
What is true about Software Architecture and Detailed Design?
both can be easily translated into code
software architecture highlights the major components of the system
detailed design helps to easily translate design into code
detailed design is the external structure of the components
What are the tasks in detailed design (Otero, 2012)?
Interface design, User interface design, Internal component design, Data design
Interface design, User interface design, external component design, Data design
User interface design, internal component design, Data design
User interface design, external component design, Data design
What is the O in SOLID?
Open-Closed : classes should be closed for modification and extension
Open-Closed : classes should be closed for modification and open for extension
Open-Closed : classes should be open for modification and extension
Open-Closed : classes should be open for modification and closed for extension
Which SOLID principle is violated in this design?
Single Responsibility
Open Closed
Liskov Substitution
Interface Segregation
Dependency Inversion
You launched your application to the client and all is working well. Now the client
start using different database: MySQL instead of Postgres and you know that your client in the
future might want to be able to switch databases.
Modifying OrderRepository directly would violate which principle?
Single Responsibility
Open Closed
Liskov Substitution
Interface Segregation
Dependency Inversion
All circles are inherently ellipses with
their x and y radii being equal.
If Circle inheriting from Ellipse
violates Liskov Substitution, which methods cause this
issue?
setXRadius()
getArea()
setYRadius()
Select all the creational design patterns
Factory, Abstract Factory
Builder
Facade
Prototype, Singleton
Observer
If there are changes in the original code, the copy code will be affected too for shallow cloning
True
False
Which of the following is true about design patterns?
Design patterns are solutions to general problems that
software developers faced during software development
Design patterns represent the best practices used by
experienced object-oriented software developers.
Design patterns are obtained by trial and error by
numerous software developers over quite a substantial
period of time.
Suppose you need to create new objects by copying an
existing object. Which of the following patterns would you
most likely use? Please select the best answer.
Abstract Factory
Builder
Prototype
Singleton
Suppose you need to define an interface for creating instances of several related abstract classes without specifying their concrete subclasses. Which of the following patterns would you most likely use?
Please select the best answer.
Abstract Factory
Builder
Prototype
Factory
The general purpose of the Singleton pattern is to:
Please select the best answer.
Ensure that no more than one instance of a class exists ever
Ensure that only one class exists at the same time.
Separate objects in a single class from objects in another class.
Control creation of objects in a single class or another class.
Which of the following is correct about the Factory design
pattern.
Factory pattern creates object without exposing the
creation logic to the client.
This type of design pattern comes under creational
pattern.
Factory pattern refers to newly created object using a
common interface.
Which one is pattern creating a duplicate object?
Factory Pattern
Prototype Pattern
Builder Pattern
Singleton Pattern
Which pattern is implemented in this code snapshot?
Factory
Abstract Factory
Singleton
Prototype
If you are working with objects that have very different internal representations, such as enumeration types, event handling, or statefulness, which design pattern would you apply?
Structural design pattern
Singleton design pattern
Creational design pattern
Behavioral design pattern
What is the purpose of the Adapter design pattern?
The Adapter design pattern is a pattern that deals
with communication between objects.
The Adapter design pattern is a pattern that
provides a way to control access to another object.
The Adapter design pattern is a pattern that deals
with object creation mechanisms, trying to create
objects in a manner suitable to the situation.
The Adapter design pattern is a structural design
pattern that allows objects with incompatible interfaces to collaborate.
How can the Adapter design pattern be used to solve the problem of incompatible interfaces?
How can the Adapter design pattern be used to solve the problem of incompatible interfaces?
By implementing a class that realizes the target interface by delegating to an instance of the third-party class.
By implementing a class that realizes the target
interface by delegating to an instance of the third-
party class.
By renaming the functions of the third-party class to
match the target interface.
What are behavioral design patterns used for?
Behavioral design patterns are used to create
objects in a system.
Behavioral design patterns are used to structure
objects in a system.
Behavioral design patterns are used to describe
common ways in which objects interact and behave.
Behavioral design patterns are used to define the
architecture of a system.
What does the IIterator interface define in the iterator design pattern?
The operations to delete elements from the
collection.
The operations to sort the elements in the collection.
The operations to add elements to the collection.
The operations to go through the elements in the
collection.
Behavioral design patterns describe common ways in which objects are created.
True
False
The iterator design pattern consists of the ICollection interface, the IIterator interface, and the ConcreteCollection class.
True
False
The iterator design pattern is commonly used in languages like C# and Java, which have explicit syntax for using iterators.
True
False
We are designing a mapping application. Users should be
able to navigate the map by choosing a country, then a state
or province within that country, and so on, for as many levels
of administrative unit exist within the country. Countries
differ in the number of levels they have and the terminology
they use, but the programmers want to be able to interact
with them all through a common interface.
Which design pattern in structural should we use in this case?
Adapter
Decorator
Composite
We are designing a map application. The maps are to be
displayed on a screen and are overlaid with different types of
information, such as population density, topological features,
and land usage. The same map might show any combination
of these (or none of them) depending on choices made by
the user. Which design pattern would you use here?
Composite
Decorator
Adapter
You cannot make changes to any of these classes.
Which design pattern would you use to allow this extension?
Adapter
Composite
Decorator
In which of the following pattern, a class behavior or its
algorithm can be changed at run time?
Observer Pattern
Template Pattern
Strategy Pattern
Iterator Pattern
Which design pattern would you choose if you would like to
traverse a collection of objects without exposing its
implementation.
Iterator
Observer
Strategy
Template
Which design pattern would you choose to allow clients to
treat collections of objects and individual objects uniformly.
Decorator
Iterator
Composite
Observer
Suppose we have a sorter class and would like to be able to
sort in ascending order or descending order.
How would you implement the design pattern?
Strategies
Template
Iterator
Decorator
Which level of detailed design does construction design address?
Checking conditions before taking actions
Generating correct and efficient code
Planning and evaluating complex operations
Modeling and specification of function implementation
What is the purpose of construction design in software development?
It focuses on reducing the physical size of the code to optimize storage space.
It involves designing software interfaces that are user-friendly and visually
appealing.
It is a design approach that emphasizes post-implementation code refactoring.
It provides a form of design that closely resembles code so that complex
operations can be planned and evaluated prior to implementation in code.
What step does construction design follow in the software engineering process?
Software testing
Software architecture and detailed design
Software maintenance
Software requirements
What is the purpose of a join node in an activity diagram?
To represent an if statement in code
To split a single incoming flow into multiple concurrent flows
To synchronize multiple concurrent flows into a single outgoing flow
To bring together multiple incoming alternate flows into a single outgoing flow
What is the purpose of a guard in a UML activity diagram?
A guard is a node that joins multiple concurrent flows
A guard is used to split a single incoming flow into multiple concurrent flows
A guard is a condition which must be true in order for the trigger to cause the
transition
A guard is a control node that brings together multiple incoming alternate flows
What are the two topics that should be learned
before studying construction design?
Software requirements and software design
Flow-based design and state-based design
Software architecture and detailed design
Solid principles and design patterns
If you are given a complex operation to implement
in code, which design approach would you use to
plan and evaluate it prior to implementation?
Construction design
Design patterns
Solid principles
Software architecture
You are given the following activity diagram. Which of the
following action sequences are possible during one execution
of the activity diagram? You may select multiple options.
A ->B
A -> C
A ->B ->C
A ->B ->B
A ->C ->B
You are given the following activity diagram. Which of the
following action sequences are possible during one execution
of the activity diagram?
A->B ->C ->D
A ->B ->C
A ->B ->D ->C
A ->D
You want to model the following situation using a state-diagram. A home delivery
service has the two states wait and deliver. At the beginning, wait is active. As
soon as a customer has ordered a product, a transition to deliver takes place.
During the transition, the order is processed. deliver stays active until the product
has been delivered to the customer, then a transition to wait happens.
How do you specify the transition from wait to deliver?
Event: Order received
Activity: Order received
Event: process order
Activity: order is processed
You are given the following state
machine diagram. Which of the
following statements are true?
After the customer has indicated
enough money into the machine, a
transition to Order takes place.
As soon as change and cigarettes
have been ejected, Idle becomes the
next active state.
If CardCheck is active and the card
is valid, Order immediately becomes
the next active state.
What is one way to measure cohesion in software design?
Looking at the number of subclasses of each class
Looking at the depth of the inheritance hierarchy
Looking at the number of pairs of classes that invoke each other's methods
Looking at the number of methods that do not have any instance variables in
common
Which of the following characteristics should be evaluated for all software projects?
Security, usability, efficiency, simplicity
Completeness, correctness, testability, maintainability
Scalability, performance, reliability, flexibility
Interoperability, maintainability, reusability, portability
If you were to evaluate a software design, which characteristics would you consider
as a minimum requirement?
The design's simplicity, efficiency, and peer review results.
The design's completeness, correctness, testability, and maintainability.
The design's implementation of solid principles and object-oriented metrics.
The design's static complexity metric and architecture trade-off analysis method
results.
What is the goal when designing in terms of cohesion and coupling?
The goal when designing is to achieve low cohesion and low coupling.
The goal when designing is to achieve low cohesion and high coupling.
The goal when designing is to achieve high cohesion and low coupling
The goal when designing is to achieve high cohesion and high coupling.
Select all factors that contribute to the complexity of a class in software design:
Select 3 correct answer(s)
The programming language used to implement the class
The complexity of the individual methods in the class
The number of methods and attributes in the class
The number of methods of other classes invoked by the class
The length of the class name and the number of comments within the class
What are the correct aspects of object oriented metrics? (You can select more than 1 option)
Size
Volume
Quality
Inheritance
Cohesion
What is the first step in the software design process?
Construction design
Detailed design
Architecture design
Evaluation design
