JNTU
JNTU B.Tech IV DESIGN PATTERNS Previous Question Paper (October/November - 2020 - R15)
Answer any Five Questions. All Questions Carry Equal Marks.
Main
How a Design pattern solves the Design problem? Illustrate with an example.
Answer
A design pattern solves a design problem by providing a proven, reusable solution to a recurring challenge in software architecture. Instead of reinventing the wheel, a pattern captures the intent, motivation, and consequences of a design decision, allowing developers to communicate complex structures using a common vocabulary.
A pattern typically addresses a problem by identifying the specific objects and classes involved, their responsibilities, and the way they collaborate. It focuses on decoupling components to ensure flexibility and maintainability.
For example, the Strategy Pattern solves the problem of needing to switch between different algorithms at runtime. Rather than using hard-coded conditional statements (if-else or switch) to select behavior, the pattern defines a family of algorithms, encapsulates each one, and makes them interchangeable. This allows the algorithm to vary independently from the clients that use it, adhering to the Open/Closed Principle.
Explain in detail object composition with example of Delegation.
Answer
Object composition is a technique where complex functionality is achieved by assembling simpler objects rather than inheriting behavior from a superclass. It promotes loose coupling and allows for dynamic behavior modification at runtime, whereas inheritance is static and fixed at compile time.
Delegation is a specific form of composition where an object handles a request by passing it to a second object (the delegate) that performs the actual work. The delegating object maintains a reference to the delegate and calls its methods to fulfill the request.
Consider a Window class that needs to handle printing. Instead of inheriting from a Printer class, the Window object contains a reference to a Printer object:
In this example, the Window delegates the printing task to the Printer. This design is highly flexible because the Window can switch its Printer instance at runtime (e.g., switching from a LaserPrinter to an InkjetPrinter) without changing the Window class itself.
How To Select a Design Pattern? Explain.
Answer
Sign in to view the complete answer paper.
List and explain Design Pattern Elements.
Answer
Sign in to view the complete answer paper.
List and explain seven problems in Lexis's design.
Answer
Sign in to view the complete answer paper.
Draw and explain the interaction diagram for the spelling checking.
Answer
Sign in to view the complete answer paper.
The Singleton uses a special method to instantiate objects. What is special about this method?
Answer
Sign in to view the complete answer paper.
What are the implementation issues of Prototype Design pattern? Discuss.
Answer
Sign in to view the complete answer paper.
Write about Class Adapter Pattern and list the pros and cons of it.
Answer
Sign in to view the complete answer paper.
Draw and explain the structure of bridge pattern.
Answer
Sign in to view the complete answer paper.
Explain the implementation of Pluggable Adapters with abstract operations.
Answer
Sign in to view the complete answer paper.
List and explain benefits and drawbacks of bridge pattern.
Answer
Sign in to view the complete answer paper.
What are the Consequences of the Interpreter? Discuss.
Answer
Sign in to view the complete answer paper.
Write about the implementation issues of Memento pattern.
Answer
Sign in to view the complete answer paper.
Draw and explain strategy pattern Class Diagram for Mobile Computer.
Answer
Sign in to view the complete answer paper.
Describe the Implementation of State pattern.
Answer
Sign in to view the complete answer paper.