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.
Ans. Struts controller uses the Command design pattern and the action classes use the Adapter design pattern. The process() method of the RequestProcessor uses the Template method design pattern.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Broad question, but if the company need velocity, think about use a NO SQL instead of regular SQL databases.
Also prefers materialized views instead of joins to fetch data quickly.
Regarding the database design, there are very good design tools for professional database (to develop proper indexes and good database design) one of the best is QuickDBD
Help us improve. Please let us know the company, where you were asked this question :
Ans. Caching is a mechanism that provides faster access but at the cost of additional space. Caching is good if we need faster access and if it takes extensive processing to come to a value which doesn't gets changed frequently.
Caching could be an overhead if we don't need fast access or if the processed value changes too frequently.
Help us improve. Please let us know the company, where you were asked this question :
Ans. We initialize two variables first and second to INT_MIN as,
first = second = INT_MIN
then Start traversing the array,
If the current element in array say arr[i] is greater
than first. Then update first and second as,
second = first
first = arr[i]
If the current element is in between first and second,
then update second to store the value of current variable as
second = arr[i]
then Return the value stored in second.
Help us improve. Please let us know the company, where you were asked this question :
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 :
Ans. Yes an application can have configuration stored at multiple places. Factors that could facilitate such a design could be
1. Type of config information - We may have a case to store confidential information differently than other regular config value
2. Environment - We may like to have a base config ( defined in application package ) and then a different override mechanism in different environments.
3. Centralization - Sometime some configs need to be shared across application and hence centralized.
4. Testing - Testing against config may not be possible in some enviornments in certain cases and hence additional config store might be kept for testing purpose only.
Help us improve. Please let us know the company, where you were asked this question :
Ans. It depends on how complex it is and if in future it would need any sort opf debugging. It's not easy to debug code if it's making heavy use of shortcuts like Lambda , Patterns etc.
Help us improve. Please let us know the company, where you were asked this question :