YouTube Icon

Interview Questions.

Top 100+ Java J2ee Architect Interview Questions And Answers - May 31, 2020

fluid

Top 100+ Java J2ee Architect Interview Questions And Answers

Question 1. Should We Create System Software ( E.G Operating System ) In Java ?

Answer :

No, Java runs on a virtual gadget known as JVM and hence would not embed nicely with the underlying hardware. Though we can create a platform independent system software but that would be in reality gradual and that is what we would in no way want. 

Question 2. What Are The Different Types Of Memory Used By Jvm ?

Answer :

Class , Heap , Stack , Register , Native Method Stack.

Java Script Interview Questions
Question three. What Are The Benefits Of Using Spring Framework ?

Answer :

Spring permits builders to expand organisation-magnificence packages using POJOs. The benefit of the usage of simplest POJOs is that you do not want an EJB field product.
Spring is organized in a modular style. Even even though the number of programs and classes are enormous, you need to fear most effective approximately ones you want and forget about the relaxation.
Spring does no longer reinvent the wheel rather, it clearly uses some of the existing technology like several ORM frameworks, logging frameworks, JEE, Quartz and JDK timers, different view technology.
Testing an utility written with Spring is straightforward because surroundings-structured code is moved into this framework. Furthermore, by using JavaBean-fashion POJOs, it turns into easier to apply dependency injection for injecting test data.
Spring’s internet framework is a well-designed web MVC framework, which offers a splendid alternative to web frameworks along with Struts or different over engineered or less famous internet frameworks.
Spring affords a handy API to translate generation-precise exceptions (thrown by using JDBC, Hibernate, or JDO, for example) into constant, unchecked exceptions.
Lightweight IoC packing containers tend to be light-weight, specially when as compared to EJB packing containers, as an instance. This is useful for developing and deploying programs on computers with restricted reminiscence and CPU sources.
Spring presents a regular transaction management interface that can scale back to a local transaction
Question four. What Are Various Types Of Class Loaders Used By Jvm ?

Answer :

Bootstrap - Loads JDK inner instructions, java.* packages.

Extensions - Loads jar files from JDK extensions listing - usually lib/ext directory of the JRE

System  - Loads lessons from machine classpath.

Java Script Tutorial
Question 5. What Is Permgen Or Permanent Generation ?

Answer :

The memory pool containing all of the reflective records of the java virtual device itself, together with elegance and approach gadgets. With Java VMs that use magnificence statistics sharing, this generation is split into examine-handiest and study-write regions. The Permanent generation consists of metadata required via the JVM to describe the classes and strategies used in the utility. The permanent generation is populated by using the JVM at runtime primarily based on lessons in use by the application. In addition, Java SE library lessons and methods can be stored right here.

Adv Java Interview Questions
Question 6. What Is Metaspace ?

Answer :

The Permanent Generation (PermGen) area has completely been removed and is form of changed by a new space known as Metaspace. The results of the PermGen elimination is that obviously the PermSize and MaxPermSize JVM arguments are left out and you will in no way get a java.Lang.OutOfMemoryError: PermGen blunders.

Question 7. How Does Volatile Affect Code Optimization By Compiler?

Answer :

Volatile is an practise that the variables may be accessed with the aid of multiple threads and as a result should not be cached. As risky variables are by no means cached and therefore their retrieval cannot be optimized.

Adv Java Tutorial J2SE Interview Questions
Question 8. What Things Should Be Kept In Mind While Creating Your Own Exceptions In Java?

Answer :

All exceptions should be a infant of Throwable.
If you want to write a checked exception this is automatically enforced via the Handle or Declare Rule, you need to increase the Exception class.
You need to write down a runtime exception, you want to increase the RuntimeException elegance.
Question 9. What Is The Best Practice Configuration Usage For Files - Pom.Xml Or Settings.Xml ?

Answer :

The exceptional exercise guiding principle between settings.Xml and pom.Xml is that configurations in settings.Xml need to be specific to the current consumer and that pom.Xml configurations are specific to the challenge.

Core Java Interview Questions
Question 10. Can You Provide Some Implementation Of A Dictionary Having Large Number Of Words ?

Answer :

Simplest implementation we can have is a List in which we can vicinity ordered words and as a result can perform Binary Search.

Other implementation with better seek overall performance is to use HashMap with key as first person of the word and cost as a LinkedList.

Further degree up, we are able to have related Hashmaps like ,

hashmap 

a ( key ) -> hashmap (key-aa , price (hashmap(key-aaa,price)

b ( key ) -> hashmap (key-ba , value (hashmap(key-baa,price)

....................................................................................

Z( key ) -> hashmap (key-za , value (hashmap(key-zaa,price)

upto n levels ( where n is the common size of the phrase in dictionary.

Core Java Tutorial
Question 11. What Is Database Deadlock ? How Can We Avoid Them?

Answer :

When multiple outside assets are seeking to get right of entry to the DB locks and runs into cyclic wait, it is able to makes the DB unresponsive. 

Deadlock can be avoided using kind of measures, Few indexed beneath:

Can make a queue wherein we will affirm and order the request to DB.
Less use of cursors as they lock the tables for long time.
Keeping the transaction smaller.
Java Struts Interview Questions
Question 12. Why Web Services Use Http As The Communication Protocol ?

Answer :

With the advent of Internet, HTTP is the maximum favored way of conversation. Most of the customers ( internet skinny purchaser , net thick clients , mobile apps )  are designed to communicate the usage of http only. Web Services using http makes them available from extensive form of patron programs. 

Java Script Interview Questions
Question thirteen. Why Using Cookie To Store Session Info Is A Better Idea Than Just Using Session Info In The Request ?

Answer :

Session info inside the request can be intercepted and therefore a vulnerability. Cookie may be study and write  by way of respective domain simplest and make sure that proper session records is being exceeded by the client.

Hibernate Tutorial
Question 14. Difference Between First Level And Second Level Cache In Hibernate ?

Answer :

First degree cache is enabled by way of default while Second level cache needs to be enabled explicitly.
First degree Cache got here with Hibernate 1.Zero whereas Second level cache came with Hibernate three.0.
 First degree Cache is Session unique whereas Second stage cache is shared by way of classes that is why First stage cache is taken into consideration local and 2d level cache is considered global.
Question 15. What Are The Ways To Avoid Lazyinitializationexception ?

Answer :

Set lazy=fake inside the hibernate config file.
 Set @Basic(fetch=FetchType.EAGER) at the mapping.
Make certain that we're getting access to the based items before last the consultation.
Using Fetch Join in HQL.
Hibernate Interview Questions
Question sixteen. What Are New Features Introduced With Java eight ?

Answer :

 Lambda Expressions , Interface Default and Static Methods , Method Reference , Parameters Name , Optional , Streams, Concurrency.

JavaServer Faces (JSF) Tutorial
Question 17. What Things You Would Care About To Improve The Performance Of Application If Its Identified That Its Db Communication That Needs To Be Improved ?

Answer :

Query Optimization ( Query Rewriting , Prepared Statements )
 Restructuring Indexes.
DB Caching Tuning ( if the use of ORM )
Identifying the troubles ( if any ) with the ORM Strategy ( If using ORM )
JavaServer Faces (JSF) Interview Questions
Question 18. If You Are Given A Choice To Implement The Code To Either Insert A Record Or Update If Already Exist, Which Approach Will You Follow ? 1. Insert Into The Db Table. If Exception Occurs, Update The Existing Record. 2. Check If The Record Exists And Update It If It Exists, If Not Insert A New Record.

Answer :

In first case, there might be 2 DB calls in worst case and 1 in quality case. In second method there will be constantly 2 DB calls.

Decision on the method need to rely upon the subsequent concerns -

1. How steeply-priced is the decision to DB.  Are we the usage of indices , hibernate and many others

If calls to DB are highly-priced , 1st method must be the selection.

2. Exception Book keeping load upon exception.

The gain of saving 1st call in method 1 need to be bigger than the Book preserving for the exception.

3. Probability of the exception in first apparoach.  

If the DB Table is nearly empty, it makes experience to comply with Approach 1 as majority of the first calls will pass via with out exception.

Adv Java Interview Questions
Question 19. What Would You Do If You Have To Add A Jar To The Project Using Maven ?

Answer :

If its already there in Maven nearby repository, We can add that as a dependency within the task pom record with its Group Id, Artifact Id and version.

We can provide additional attribute SystemPath if its unable to locate the jar within the nearby repository.

If its no longer there inside the local repository, we are able to install it first inside the neighborhood repository after which can upload it as dependency.

Java 8 Tutorial
Question 20. Which Uml Diagrams You Usually Use For Design ?

Answer :

Use Case Diagram, Component Diagram for High stage Design and Class Diagram , Sequence Diagram for low level layout.

Java 8 Interview Questions
Question 21. How Do You Coordinate And Communicate With The Team Developers ?

Answer :

We as a team of builders , testers , analyst , lead and architect sit close to each different. Most of the time I would just jump to their seat and communicate to them ( if required ). We have each day stand up where we talk matters that desires team interest. 

Question 22. What Kind Of Software Architecture Your Organization Follow ?

Answer :

We have multi tier structure with multiple layers , We have series of internet servers and programs in software tier, infrastructure libraries at middle tier and Database servers at the decrease tier. We are the usage of Oracle as Database, ESB ( Enterprise carrier Bus ) for asynchronous verbal exchange and Rest Web Services.

JavaFX Tutorial
Question 23. Difference Between Proxy And Adapter Design Patterns ?

Answer :

 Adapter item has a exclusive enter than the actual challenge while Proxy item has the equal input as the actual situation. Proxy object is such that it need to be located as it is in place of the actual subject.

JavaFX Interview Questions
Question 24. Difference Between Adapter And Facade ?

Answer :

The Difference between these styles in handiest the purpose. Adapter is used because the objects in modern-day shape cannot talk in which as in Facade , though the items can communicate , A Facade item is located between the client and situation to simplify the interface.

J2SE Interview Questions
Question 25. Difference Between Builder And Composite ?

Answer :

Builder is a creational Design Pattern whereas Composite is a structural layout pattern. Composite creates Parent - Child relations among your objects at the same time as Builder is used to create institution of objects of predefined kinds.

NHibernate Tutorial
Question 26. Difference Between Factory And Strategy Design Pattern ?

Answer :

Factory is a creational layout sample while Strategy is behavioral layout sample. Factory revolves across the advent of item at runtime whereas Strategy or Policy revolves around the decision at runtime.

NHibernate Interview Questions
Question 27. Shall We Use Abstract Classes Or Interfaces In Policy / Strategy Design Pattern ?

Answer :

Strategy offers best with decision making at runtime so Interfaces need to be used.

Core Java Interview Questions




CFG