Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

1st Term, SY 2022-2023 1000005223 — IT1814

Midterm Examination Page 1

Name:_____________________________ Section:___________________________ Date:_______________


Notice: 8. This feature of design patterns describes the
Any form of cheating will result in a score of ZERO. (e.g. responsibilities and collaborations of elements that
leaking of exam items and answers on social media, make up the design.
copying from other students, using prohibited A. Pattern Name
resources/cheat sheets, etc.) B. Problem
Use black or blue pen only. Pencils and erasable pens are C. Solution
not allowed. D. Consequences
I. (75 points) 9. This design principle suggests that flexible software are
Read and analyze each item. Encircle the letter of the those with classes that rely on abstract classes or
correct answer. interfaces.
A. Single Responsibility Principle
A. (15 items x 2 points) B. Open-Closed Principle
C. Interface Segregation Principle
1. This design principle advises software engineers to D. Dependency Inversion Principle
avoid relying on things that they do not use.
A. Single Responsibility Principle 10. The software modules are hard to reuse in another
B. Open-Closed Principle software because these cannot be extracted from the
C. Interface Segregation Principle current software. Which characteristic of poor software
D. Dependency Inversion Principle design is described?
A. Rigidity
2. This category of design pattern describes how objects B. Fragility
are composed into larger groups. C. Immobility
A. Creational Pattern D. Variety
B. Structural Pattern
C. Behavioral Pattern 11. This structural design pattern allows objects with
D. Singleton Pattern incompatible interfaces to collaborate.
A. Adapter Pattern
3. Software is hard to change because every applied B. Bridge Pattern
change will affect many parts of the software. Which C. Composite Pattern
characteristic of poor software design is described? D. Decorator Pattern
A. Rigidity
B. Fragility 12. This feature of a design pattern describes when to use
C. Immobility the pattern.
D. Variety A. Pattern Name
B. Problem
4. This category of design pattern describes how C. Solution
communication happens between objects. D. Consequences
A. Creational Pattern
B. Structural Pattern 13. This design principle suggests that each software
C. Behavioral Pattern module should have only one (1) reason to change.
D. Singleton Pattern A. Single Responsibility Principle
B. Open-Closed Principle
5. This feature of design patterns refers to the results and C. Liskov Substitution Principle
interchanges of applying the pattern. D. Interface Segregation Principle
A. Pattern Name
B. Problem 14. When applying changes to the software, unexpected
C. Solution parts of the software break. Which characteristic of
D. Consequences poor software design is described?
A. Rigidity
6. This behavioral design pattern suggests that when an B. Fragility
object changes state, all of its dependents are notified C. Immobility
automatically. D. Variety
A. Iterator Pattern
B. Observer Pattern 15. This design principle states that when there are new
C. Strategy Pattern software requirements, the new behavior must be
D. Proxy Pattern added by deriving a new class without modifying the
existing class.
7. This design principle suggests that all the derived A. Single Responsibility Principle
classes of a base class should be able to perform the B. Open-Closed Principle
same behavior as their base class without negative C. Liskov Substitution Principle
side effects. D. Interface Segregation Principle
A. Single Responsibility Principle
B. Open-Closed Principle
B. (15 items x 3 points)
C. Liskov Substitution Principle
D. Interface Segregation Principle 16. Which of the following best describes the Strategy
1st Term, SY 2022-2023
Midterm Examination 1000005223 — IT1814
Page 2
Name:_____________________________ Section:___________________________ Date:_______________
pattern? implementation.
A. It allows developers to define a family of algorithms, C. It allows developers to construct complex objects
put each of them into a separate class, and make step by step.
their objects interchangeable. D. It allows developers to traverse elements of a
B. It allows developers to produce families of related collection without exposing its underlying
objects without specifying their concrete classes. representation.
C. It allows developers to construct complex objects 24. Which best describes the Builder pattern?
step by step.
A. It defines an interface or abstract class for creating
D. It allows developers to traverse elements of a
objects in a superclass but allows subclasses to
collection without exposing its underlying
alter the type of objects to be created.
representation.
B. It allows developers to produce families of related
17. A class named BankAccount is modified every time a objects without specifying their concrete classes.
new type of bank account is added. This scenario C. It allows developers to construct complex objects
violates which design principle? step by step.
A. Single Responsibility Principle D. It ensures that a class has only one instance while
B. Open-Closed Principle providing a global access point to the instance.
C. Liskov Substitution Principle 25. Which of the following is NOT a structural design
D. Dependency Inversion Principle pattern?
18. Which of the following is NOT a creational pattern? A. Proxy Pattern
A. Factory Method Pattern B. Facade Pattern
B. Prototype Pattern C. Flyweight Pattern
C. Adapter Pattern D. Observer Pattern
D. Builder Pattern 26. A high-level class named UserManager relies on the
19. Which best describes the Iterator pattern? low-level class named EmailNotifier. This scenario
A. It allows developers to produce families of related violates which design principle?
objects without specifying their concrete classes. A. Open-Closed Principle
B. It allows developers to construct complex objects B. Liskov Substitution Principle
step by step. C. Interface Segregation Principle
C. It allows developers to define a subscription D. Dependency Inversion Principle
mechanism to notify multiple objects. 27. Which best describes the Decorator pattern?
D. It allows developers to traverse elements of a
A. It allows developers to produce families of related
collection without exposing its underlying
objects without specifying their concrete classes.
representation.
B. It allows developers to construct complex objects
20. Which of the following is NOT a structural design step by step.
pattern? C. It allows developers to attach new behaviors to
A. Bridge Pattern objects by placing them inside special wrapper
B. Abstract Factory Pattern objects.
C. Decorator Pattern D. It allows developers to traverse elements of a
D. Facade Pattern collection without exposing its underlying
representation.
21. Which best describes the Prototype pattern?
A. It allows developers to produce families of related 28. A payroll application consists of an Employee class that
objects without specifying their concrete classes. consists of methods belonging to multiple actors. This
B. It allows developers to construct complex objects scenario violates which design principle?
step by step. A. Single Responsibility Principle
C. It allows developers to copy existing objects without B. Open-Closed Principle
making their code dependent on their classes. C. Liskov Substitution Principle
D. It allows developers to traverse elements of a D. Interface Segregation Principle
collection without exposing its underlying 29. Which best describes the Proxy pattern?
representation.
A. It allows developers to produce families of related
22. Which of the following is NOT a structural design objects without specifying their concrete classes.
pattern? B. It allows developers to traverse elements of a
A. Bridge Pattern collection without exposing its underlying
B. Strategy Pattern representation.
C. Composite Pattern C. it allows developers to provide a substitute or
D. Decorator Pattern placeholder for another object.
D. It allows developers to construct complex objects
23. Which best describes the Bridge pattern? step by step.
A. It allows developers to produce families of related
objects without specifying their concrete classes. 30. Which best describes the Factory Method pattern?
B. It allows developers to split a large class into two A. It defines an interface or abstract class for creating
(2) separate hierarchies: abstraction and objects in a superclass but allows subclasses to
1st Term, SY 2022-2023
Midterm Examination 1000005223 — IT1814
Page 3
Name:_____________________________ Section:___________________________ Date:_______________
alter the type of objects to be created. 4. Create a subclass named Midterm that extends the
B. It allows developers to produce families of related superclass named Exam. Declare two (2) private
objects without specifying their concrete classes. variables named subject (String) and score (int).
C. It allows developers to construct complex objects
5. Create a void method named apply with a char
step by step.
parameter type named principle. Add a statement to
D. It ensures that a class has only one instance while
display the message "Applying this
providing a global access point to the instance.
SOLID principle: " then concatenate the value
of principle.
II. (25 points : 5 items x 5 points)
Answer the following items on the space provided or a RUBRIC:
separate sheet of paper (as needed).
FOR SHORT ANSWER
1. Create an interface named Solution with a void
CRITERIA PERFORMANCE INDICATOR POINTS
method named try. The interface method should be
public and with a String parameter named pattern. Provided pieces of evidence,
Content supporting details, and factual 3
2. Create an interface named Solution with a void scenarios.
method named apply. The interface method should be
Expressed the points in clear
public and with a char parameter type named Organization
and logical arrangement of 2
principle. of ideas
ideas.
3. Is it possible to apply more than one (1) design TOTAL 5
principle in a software project? Why or why not?

You might also like