Interview Questions and Answers for 'Design' | Search Interview Question - javasearch.buggybread.com
Javasearch.buggybread.com

Search Interview Questions


 More than 3000 questions in repository.
 There are more than 900 unanswered questions.
Click here and help us by providing the answer.
 Have a video suggestion.
Click Correct / Improve and please let us know.
Label / Company      Label / Company / Text

   



Interview Questions and Answers - Order By Newest

   next 30
 Q31. Why it's a good practice to expose member elements through getter methods ?Design
Ans. Encapsulation and Polymorphism.

We need methods to access variables in a polymorphic way as overriding only happens with methods and not with variables. Moreover getter provides a way to minimally open the access window for the object and hence provides better encapsulation. To add to those, we can have validation in the getter method before returning elements.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     encapsulation


 Q32. What are some uses of interceptors ?Java EE
Ans. Authentication / Authorization
URL forwarding
Auditing / Logging
Localization

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     interceptors  interceptor design pattern


 Q33. What is abstraction ?Design
Ans. Abstraction is a process of hiding the implementation details and describing only the functionality to the user.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     bstraction  oops concepts  oops principle     Asked in 22 Companies


 Q34. What is the difference between Observer and Observable ?RxJava
Ans. Observable is emiting data and Observer is subscribing to catch the data

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     RxJava  Design  Deaign Pattern


 Q35. Write code to redo and undo without using system functions ?Design
 This question was recently asked at 'Aloha Technologies'.This question is still unanswered. Can you please provide an answer.


 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve          Asked in 1 Companies


 Q36. How to avoid cloning, serialization in the singleton class ?Design
Ans. For Cloning-exception,For deserialization-read.resolve()

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     singleton  cloneable  serializable  serialization  cloning     Asked in 1 Companies


 Q37. When singleton can break and how to resolve itDesign
Ans. Deserialization. In serialization, we can save the object of a byte stream into a file or send over a network. Suppose if you serialize the Singleton class, and then again de-serialize that object, it will create a new instance, hence deserialization will break the Singleton pattern.

To overcome this issue, we need to override readResolve() method in the Singleton class and return the same Singleton instance.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     singleton  design patterns     Asked in 1 Companies


 Q38. If you are given choice to either load object eagerly or lazily , which one would you use in case of singleton pattern ?Design
Ans. I would choose Eager as the cost for 1 additional object is too minute for any such consideration.

Eager Loading results in Faster access ( Object available at load time) at the cost of additional space.

Lazy loading results in space saving ( Object available at first use ) at the cost of access speed.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     design Pattern  Singleton  Lazy vs Eager Loading


 Q39. Shall we use abstract classes or Interfaces in Policy / Strategy Design Pattern ?
Ans. Strategy deals only with decision making at runtime so Interfaces should be used.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   design pattern   strategy design patterm      expert


 Q40. What is a Listener ?Design
Ans. In GUI programming, an object that can be registered to be notified when events of some given type occur. The object is said to listener? for the events.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   gui   ui programming   swing   awt   swt   listener   architecture


 Q41. What are use cases?Process
Ans. It is part of the analysis of a program and describes a situation that a program might encounter and what behavior the program should exhibit in that circumstance.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     use cases   design   high level design   testing   test driven development   software system analyst   project lead      basic        frequent


 Q42. What is a Cursor ?Database
Ans. It's a facility that allows traversal over the records pulled from a table or combination of tables. Its like iterator in Java.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     databases   sql   cursors   packages     Asked in 5 Companies      basic        frequent


Very frequently asked. Usually followed by questions related to private constructor and synchronized access. Frequently asked in JPMorgan and TCS (Based on 2 feedback)
  Q43. Explain Singleton Design Pattern ?Design
Ans. http://www.buggybread.com/2014/03/java-design-pattern-singleton-interview.html

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   design pattern   singleton   at&t   ebay  fidelity india  united healthcare india     Asked in 46 Companies      intermediate        frequent


 Q44. Shouldn't we make a class with all static members is its just expected to be executed as a standalone program with just one thread. Moreover Lets assume that there is no runtime Polymorphism required and there is no need for serialization ?Design
Ans. Still No in case we are making use of inheritance. we may have problem wherein we have program flow moving across common inherited method and specific methods of the derived class. call made to another static method in the parent class will only access the static class of the Parent class irrespective of the call from any of the derived class.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     static class   static vs singleton   inheritance


 Q45. Give an Example for Builder Pattern ?Core Java
Ans. String str = new StringBuilder().append("Buggy").append("Bread").toString();

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   builder pattern   design pattern   stringbuilder   string     Asked in 3 Companies

Try 1 Question(s) Test


 Q46. Which UML diagrams you usually use for design ?Design
Ans. Use Case Diagram, Component Diagram for High level Design and Class Diagram , Sequence Diagram for low level design.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     software system analyst   development lead   project lead   technical lead   technical architect      expert        frequent


 Q47. What kind of software architecture your organization follow ?Design
Ans. We have multi tier architecture with multiple layers , We have series of web servers and applications in application tier, infrastructure libraries at middle tier and Database servers at the lower tier. We are using Oracle as Database, ESB ( Enterprise service Bus ) for asynchronous communication and Rest Web Services.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     software system analyst   development lead   project lead   technical lead   technical architect


 Q48. Which of the following is not the difference between Singleton and Static class ( Class with static members only ) ?

a. Only one object can be created for Singleton class whereas No objects are created for static class.
b. Singleton class instance is initiated using new keyword whereas static class instance is created using static method.
c. Singleton class can be serialized whereas Static class cannot be.
d. Singleton Class can participate in runtime Polymorphism whereas Static class cannot.
Ans. Singleton class instance is initiated using new keyword whereas static class instance is created using static method.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   oops   singleton   design pattern   static class


 Q49. What are the fail safe systems ?Operating System
Ans. Fail Safe systems are tolerant systems that continue processing even if they sense any problem. the objective here is to continue with the processing even if there are some problems instead of completely shutting it down. Example could be to catch an exception and still letting it complete with partial results.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     fail safe systems   system design   exception handling     Asked in 3 Companies


 Q50. Explain TDD or Test Driven Design ?Design
Ans. TDD is a development process that involves short iterations: first an automated test case is written. Then, the code is written to pass that test, and finally one refactors the new code to acceptable standards.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     elsevier   test driven design ( TDD )   software development methodologies     Asked in 3 Companies        frequent


Frequently asked in face to face interviews.
  Q51. Write a program to print fibonacci series.Core Java
Ans. int count = 15;
int[] fibonacci = new int[count];
fibonacci[0] = 0;
fibonacci[1] = 1;
for(int x=2; x < count; x++){
fibonacci[x] = fibonacci[x-1] + fibonacci[x-2];
}

for(int x=0; x< count; x++){
System.out.print(fibonacci[x] + " ");
}

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     ebay   fibonacci series     Asked in 66 Companies      basic        frequent


 Q52. Write code for singleton classDesign
Ans. http://javasearch.buggybread.com/CodeSnippets/searchCodeSamples.php?keyword=singleton+class&category=code

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     singleton  code  coding  design pattern     Asked in 1 Companies      Intermediate        frequent


 Q53. Write code for the usage of Builder Design Pattern
Ans. http://javasearch.buggybread.com/CodeSnippets/searchCodeSamples.php?&category=code&searchOption&keyword=964

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     builder design pattern  builder pattern  code  coding      intermediate


 Q54. What are the fail fast systems ?
Ans. Fail fast systems are intolerant systems that fails at the first instance of smelling any problem. The objective here is to break the system instead of continuing with the possibly flawed processing. Example could be breaking the processing upon an exception.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     fail fast systems   system design     Asked in 1 Companies


 Q55. If you are given a choice to have a functionality shared either through dependency or through a Web service, which one will you choose ?Solution
Ans. Web Service promotes looser coupling but with comes with coding and performance overheads. Jars provide better performance and may be lesser coding but are problematic with update distribution. If the situation doesn't require frequent dependency updates and if it's only read operation of persistence, Having dependencies should be a better choice , otherwise web service.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     Design  Web Service vs Jar


Frequently asked for Lead and Architect positions. Recently asked in many US companies.
  Q56. What are Anti Patterns ?Design
Ans. Anti-pattern is simply the creation of a pattern in your coding that negatively affects your code i.e the Negatives surpasses the positives.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     anti patterns  design patterns     Asked in 9 Companies        frequent


 Q57. Does it make sense to clone an object which is supposed to be immutable ?Design
Ans. It make sense only if we intend to modify either of the object and would like to preserve original state in other. Otherwise we can reuse the original object by making it singleton.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     clone  clone objects  prototype design pattern   immutable  immutability  immutability  cloning


 Q58. Can Enum be a replacement for a constant file in majority of the situation ?Design
Ans. Yes , it can be but it may not be an optimal alternative if we need to change the values frequently. As Enum is compiled like any Java File , any change requires the application to be rebuild , deployed and restart.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     enum  design


 Q59. Write a class explaining builder pattern ?Design
Ans.
public class BuggyBread { 

private String element1;

private String element2;

private BuggyBread(String element1, String element2){
this.element1 = element1;
this.element2 = element2;
}

public static class Builder {

private String element1;

private String element2;

Builder(BuggyBread buggybread){
element1 = buggybread.element1;
element2 = buggybread.element2;
}

Builder withElement1(String element1){
this.element1 = element1;
return this;
}

Builder withElement2(String element2){
this.element2 = element2;
return this;
}

BuggyBread build(){
BuggyBread buggybread = new BuggyBread(element1,element2);
return buggybread;
}
}
}


 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     builder pattern  builder class

Try 1 Question(s) Test


 Q60. Design a Library system ?Design
Ans. Following Tables can be created

ASSET - Entity Table With foreign key reference to Table AssetType

ASSET_TYPE - Entity Table specifying information related to Asset Type like Books, CDs etc.

MEMBER - Registration information for the member

MEMBERSHIP_TYPE - Membership Types provided by Library

MEMBERSHIP - Relation table with foreign key for MEMBER ,

MEMBERSHIP_TYPE

ASSET_ISSUE_LEDGER - Relationship between MEMBER and ASSET. This specify the issue of particular asset to a particular member.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     design     Asked in 1 Companies


previous 30   next 30

Help us and Others Improve. Please let us know the questions asked in any of your previous interview.

Any input from you will be highly appreciated and It will unlock the application for 10 more requests.

Company Name:
Questions Asked: