Corporate Training
Request Demo
Click me
Menu
Let's Talk
Request Demo

Interview Questions and Answers For Design Patterns

by Bhavya Sri, on May 27, 2017 12:13:35 PM

Interview Questions and Answers For Design Patterns

Q1. What is Design Pattern?

Ans: Design Pattern In software is a best practice a general, reusable solution to a common problem faced by software developers within a given context in software design.
Design patterns are best practices that programmer can use to solve common problems when designing a system or application.

Q2. What are the types of Design Patterns?

Ans: Creational Patterns
Structural Patterns
Behavioral Patterns

Q3. What is meant by Gang of Four GOF?

Ans: The four authors Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides These authors are collectively known as Gang of Four GOF.
These initiated the concept of Design Pattern in Software development In 1994 & published a book titled Design Patterns - Elements of Reusable Object-Oriented Software

Q4. What are J2EE Patterns?

Ans: J2EE Patterns concerned with the presentation tier.

Q5. What is Factory pattern?

Ans: Factory pattern is one of the most used design patterns in Java. ... In Factory pattern, we create object without exposing the creation logic to the client and refer to newly created object using a common interface.

Q6. Can we create a clone of a singleton object?

Ans: Yes

Q7. How to create Singleton class in java?

Ans: There are two steps in this process.
  1. First, make the constructor private so that new operator cannot be used to instantiate the class.
  2. Return an object of the object if not null otherwise create the object and return the same via a method.

Q8.What is the benefit of Factory pattern?

Ans: Factory pattern encapsulates the implementation details and underlying implementation can be changed without any impact on caller api.

Q9. What is Singleton pattern?

Ans: In software engineering, the singleton pattern is a software design pattern that restricts the instantiation of a class to one object. This is useful when exactly one object is needed to coordinate actions across the system.

Q10. What is Abstract Factory pattern?

Ans: Abstract factory pattern is also called factory of factories.The abstract factory pattern provides a way to encapsulate a group of individual factories that have a common theme without specifying their concrete classes.

Q11. How to prevent cloning of a singleton object?

Ans: By Throwing exception within the body of clone method.

Topics:Design Patterns Interview Questions and AnswersInformation Technologies (IT)

Comments

Subscribe

Top Courses in Python

Top Courses in Python

We help you to choose the right Python career Path at myTectra. Here are the top courses in Python one can select. Learn More →

aathirai cut mango pickle

More...