Java / J2EE Design Patterns
Interview Questions You'll Most Likely BeAsked Job Interview QuestionsSeries http://www.vibrantpublishers.com ***** Java/J2EE DesignPatterns Interview Questions You'll MostLikely Be Asked Published by Vibrant Publishers atSmashwords Copyright 2011 Vibrant Publishers,USA. Smashwords Edition, License Notes This ebook is licensed for your personal useonly. This ebook may not be re-sold or given away to other people.If you would like to share this book with another person, pleasepurchase an additional copy for each recipient. If youre readingthis book and did not purchase it, or it was not purchased for youruse only, then please return to Smashwords.com and purchase yourown copy. Thank you for respecting the hard work of thisauthor. The publisher wishes to thankAlexandru Popoiu (Romania) for his invaluable inputs to thisedition.
This publication is designed toprovide accurate and authoritative information in regard to thesubject matter covered. The author has made every effort in thepreparation of this book to ensure the accuracy of the information.However, information in this book is sold without warranty eitherexpressed or implied. The Author or the Publisher will not beliable for any damages caused or alleged to be caused eitherdirectly or indirectly by this book. Vibrant Publishers books areavailable at special quantity discount for sales promotions, or foruse in corporate training programs. For more information pleasewrite to Please email feedback / corrections(technical, grammatical or spelling) to To access the complete catalogue ofVibrant Publishers, visit http://www.vibrantpublishers.com *****
Java / J2EE Design Patterns
Review thesetypical interview questions and think about how you would answerthem. ***** Table of Contents ***** 1: What are Design Patterns? Answer: Design Patterns are patterns, in an extent a wayto pursue and intent, that use classes and their Methods in objectoriented languages. ***** Table of Contents ***** 1: What are Design Patterns? Answer: Design Patterns are patterns, in an extent a wayto pursue and intent, that use classes and their Methods in objectoriented languages.
In simple words, a Design Pattern is a generalreusable solution to a commonly occurring problem in softwaredesign. A Design Pattern is not a finished design that can betransformed directly into code. It is a description or template forhow to solve a problem that can be used in many differentsituations. 2: What is a Class Interface in DesignPatterns? Answer: A Class Interface represents the collection ofMethods and fields of a class that allow objects of other classesto access. 3: What is a Class Implementation in DesignPatterns? Answer: A Class Implementation is designed to be thecode that lies within its own code, with instructions on how anobject is to fulfill a certain commitment. 5: What is a Stub in Design Patterns? Answer: A Stub is a class used to implement theinterface with Methods that do absolutely nothing; developers usethis as a way to override Methods in the interface that areimportant to their own applications. 6: What is a Constant in DesignPatterns? Answer: A Constant is a field that is static and finaland it is defined by interfaces and classes that are cooperatingwith each other when it comes to the process of defining it. 7: What is the purpose of DesignPatterns? Answer: Design Patterns are used mainly for solvingproblems that occur in a context, with interface oriented patternsaddressing the context in which developers need to define orredefine access to the Methods of a class or group of classes. 8: What is an Adapter in DesignPatterns? Answer: An Adapter is used for implementing expectedinterfaces, by having the developer provide the interface that aclient needs, using the services of a class with a differentinterface. 9: What are measures and dimensions inDesign Patterns? Answer: a. 9: What are measures and dimensions inDesign Patterns? Answer: a.
Measures are a combination of magnitude anddimension, b. Dimensions are an aggregation of ameasures length, mass and time exponents. 10: What does the times() Method do inDesign Patterns? Answer: The times() Method is a standard measure, partof a unit, that instantiates whichever class of Measure reflectsthe dimension of any given unit. 11: When is Abstract Class used in DesignPatterns? Answer: An Abstract Class is used when a Java interfaceis unusable and it can be deployed by having an object adapter thatuses delegation as a Method rather than subclassing. 12: What does JDK stand? Answer: JDK stands for Java Development Kit. 13: What does the JTable class do in DesignPatterns? Answer: The JTable class is used to handle almost everyaspect of displaying a table, but cannot know in advance what datathe developer wishes to present; it is a main setter for the use ofthe Adapter. 14: What is a Faade in Design Patterns? Answer: A Faade is a class with a level offunctionality that lies between a toolkit and a completeapplication, thus offering a vanilla usage of the classes in apackage or even in a subsystem. 14: What is a Faade in Design Patterns? Answer: A Faade is a class with a level offunctionality that lies between a toolkit and a completeapplication, thus offering a vanilla usage of the classes in apackage or even in a subsystem.
It is mainly used to provide aninterface that makes a subsystem easy to use, if it is deployed asa pattern. 15: What is a Demo in Design Patterns? Answer: A Demo is an example that provides the samevalue as a Faade and shows the use of a class or a subsystem. Itis mainly a stand alone, non-reusable application that shows on wayto apply a subsystem. 16: What is a Composite in DesignPatterns? Answer: A Composite is a group of objects in whichobjects may contain other objects, such as one object may representgroups and another object may represent an individual item. 17: What is the purpose of a CompositePattern? Answer: A Composite Pattern is used to let clientstreat individual objects and compositions of objects in a tight,uniform way, by defining a common type for groups and items and bymodeling groups as containing a collection of objects of a certain type. 18: What are Directed Graphs in DesignPatterns? Answer: A Directed Graph is an object reference that hasa direction with the tree term applied to undirected graphs.
For adirected graph to be considered a tree it has to have a root nodethat has no references to it and it also has to have one edge toall other nodes. ***** 19: What does the getStepCount() Method doin Design Patterns? Answer: This Method is used as an operation in theProcessComponent class to count the number of steps needed in aprocess flow; it has to count each step only once and to not enteran infinite loop when a process contains a cycle. 20: What is the danger of ModelingComposites in Design Patterns? Answer: Because Modeling Composites usually leads torecursive definition of Methods on composite nodes, a danger existsof writing code that may produce an infinite loop. 21: What is an Abstraction in DesignPatterns? Answer: Abstraction represents a class that relies on aset of purely abstract operations, where several implementations ofthe set of abstractions are possible. 22: How can we create a Bridge in DesignPatterns? Answer: A Bridge can be created by moving the set ofabstract operations to an interface so that an abstraction willdepend on an implementation of the interface; its intent is mainlyto decouple an abstraction from the implement-tations of itsabstract operations. 24: Why is UML used for Design Patterns? Answer: UML is an application modeling specificationfrom OMG that simplifies the complex software engineeringprocess. 25: How many diagrams does UML offer forclassification in Design Patterns? Answer: UML offers 12 diagrams that represent anapplications requirements analysis and solution design. 26: How many structure diagrams does UMLprovide? Answer: UML provides 4 structure diagrams that areused to represent a static structure of an application. 26: How many structure diagrams does UMLprovide? Answer: UML provides 4 structure diagrams that areused to represent a static structure of an application.