InterviewSolution
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
How Are The Elements Of A Gridlayout Organized? |
|
Answer» The ELEMENTS of a GridBad layout are of equal SIZE and are LAID out using the squares of a grid. The elements of a GridBad layout are of equal size and are laid out using the squares of a grid. |
|
| 2. |
How Are This () And Super () Used With Constructors? |
|
Answer» This() is used to INVOKE a CONSTRUCTOR of the same class. SUPER() is used to invoke a SUPERCLASS constructor. This() is used to invoke a constructor of the same class. super() is used to invoke a superclass constructor. |
|
| 3. |
What Is Java? |
|
Answer» JAVA is an object-oriented programming language developed initially by James Gosling and colleagues at Sun Microsystems. The language, initially called Oak (named after the oak trees outside Gosling's office), was intended to REPLACE C++, although the feature set better resembles that of Objective C. Java should not be CONFUSED with JavaScript, which shares only the NAME and a similar C-like SYNTAX. Sun Microsystems currently maintains and updates Java regularly. Java is an object-oriented programming language developed initially by James Gosling and colleagues at Sun Microsystems. The language, initially called Oak (named after the oak trees outside Gosling's office), was intended to replace C++, although the feature set better resembles that of Objective C. Java should not be confused with JavaScript, which shares only the name and a similar C-like syntax. Sun Microsystems currently maintains and updates Java regularly. |
|
| 4. |
What Does A Well-written Oo Program Look Like? |
|
Answer» A well-written OO program EXHIBITS RECURRING STRUCTURES that promote abstraction, flexibility, modularity and ELEGANCE. A well-written OO program exhibits recurring structures that promote abstraction, flexibility, modularity and elegance. |
|
| 5. |
What Is More Advisable To Create A Thread, By Implementing A Runnable Interface Or By Extending Thread Class? |
|
Answer» Strategically speaking, threads CREATED by implementing Runnable interface are more advisable. If you create a THREAD by extending a thread CLASS, you cannot EXTEND any other class. If you create a thread by implementing Runnable interface, you save a space for your class to extend another class now or in future. Strategically speaking, threads created by implementing Runnable interface are more advisable. If you create a thread by extending a thread class, you cannot extend any other class. If you create a thread by implementing Runnable interface, you save a space for your class to extend another class now or in future. |
|
| 6. |
Can You Have Virtual Functions In Java? |
|
Answer» Yes, all functions in Java are virtual by default. This is ACTUALLY a pseudo trick question because the word "virtual" is not part of the naming CONVENTION in Java (as it is in C++, C-sharp and VB.NET), so this would be a foreign concept for someone who has only CODED in Java. Virtual functions or virtual methods are functions or methods that will be redefined in DERIVED classes. Yes, all functions in Java are virtual by default. This is actually a pseudo trick question because the word "virtual" is not part of the naming convention in Java (as it is in C++, C-sharp and VB.NET), so this would be a foreign concept for someone who has only coded in Java. Virtual functions or virtual methods are functions or methods that will be redefined in derived classes. |
|
| 7. |
How Could Java Classes Direct Program Messages To The System Console, But Error Messages, Say To A File? |
|
Answer» The class SYSTEM has a VARIABLE out that represents the standard OUTPUT, and the variable err that represents the standard error device. By default, they both POINT at the system console. This how the standard output could be re-directed:
The class System has a variable out that represents the standard output, and the variable err that represents the standard error device. By default, they both point at the system console. This how the standard output could be re-directed:
|
|
| 8. |
What's The Difference Between An Interface And An Abstract Class? |
|
Answer» An abstract class may contain code in method bodies, which is not ALLOWED in an interface. With abstract classes, you have to INHERIT your class from it and Java does not allow multiple INHERITANCE. On the other HAND, you can implement multiple interfaces in your class.
An abstract class may contain code in method bodies, which is not allowed in an interface. With abstract classes, you have to inherit your class from it and Java does not allow multiple inheritance. On the other hand, you can implement multiple interfaces in your class.
|
|
| 9. |
Name The Containers Which Uses Border Layout As Their Default Layout? |
|
Answer» Containers which USES BORDER Layout as their default are: window, FRAME and DIALOG classes. Containers which uses Border Layout as their default are: window, Frame and Dialog classes. |
|
| 10. |
What Is The Difference Between Sessioncontext And Entitycontext? |
|
Answer» Since EnterpriseBeans LIVE in a managed container, the container is FREE to call your EJB COMPONENTS methods at its LEISURE. The container houses the information like current status of bean,security credentials of the user currently accessing the bean in one object is called EJBContext Object. A context represents a way for beans to perform callbacks and modify their current status Sessioncontext is EJB context for session bean Entitycontext is EJB context for entity bean Message driven context is EJB context for message driven bean Since EnterpriseBeans live in a managed container, the container is free to call your EJB components methods at its leisure. The container houses the information like current status of bean,security credentials of the user currently accessing the bean in one object is called EJBContext Object. A context represents a way for beans to perform callbacks and modify their current status Sessioncontext is EJB context for session bean Entitycontext is EJB context for entity bean Message driven context is EJB context for message driven bean |
|
| 11. |
Why Does Ejb Needs Two Interfaces(home And Remote Interface) |
|
Answer» There is a pure division of roles between the TWO. Home INTERFACE is the way to communicate with the container which is responsible for creating , LOCATING and removing BEANS and Remote Interface is the link to the BEAN that allows acces to all methods and members. There is a pure division of roles between the two. Home Interface is the way to communicate with the container which is responsible for creating , locating and removing beans and Remote Interface is the link to the bean that allows acces to all methods and members. |
|
| 12. |
Can I Invoke Runtime.gc() In An Ejb? |
|
Answer» You shouldn’t. What will happen depends on the IMPLEMENTATION, but the CALL will most LIKELY be IGNORED. You shouldn’t. What will happen depends on the implementation, but the call will most likely be ignored. |
|
| 13. |
What Are The Optional Clauses In Ejb Ql? |
|
Answer» WHERE and ORDERBY CLAUSES are OPTIONAL in EJB QL where as SELECT and FROM are REQUIRED clauses. WHERE and ORDERBY clauses are optional in EJB QL where as SELECT and FROM are required clauses. |
|
| 14. |
What Is Ejb Architecture(components)? |
|
Answer» Enterprise beans-An enterprise bean is a non-visual component of a distributed, transaction-oriented enterprise application. Enterprise beans are typically deployed in EJB containers and run on EJB servers. There are three types of enterprise beans: session beans, entity beans, and message-driven beans.
Enterprise beans-An enterprise bean is a non-visual component of a distributed, transaction-oriented enterprise application. Enterprise beans are typically deployed in EJB containers and run on EJB servers. There are three types of enterprise beans: session beans, entity beans, and message-driven beans. |
|
| 15. |
Enlist The Contents Of Container, Container Contains? |
Answer»
|
|
| 16. |
Differentiate ‘stateful Session’ From ‘entity Bean’? |
|
Answer» While both undergo activation and passivation; EB have ejbStore () callback to save STATE through passivation and ejbLoad () callback to load state through activation. But in case of SS, this is not needed because S.S.B FIELDS are serialized through objects by CONTAINERS. While both undergo activation and passivation; EB have ejbStore () callback to save state through passivation and ejbLoad () callback to load state through activation. But in case of SS, this is not needed because S.S.B fields are serialized through objects by containers. |
|
| 17. |
Enlist The Declarative Transaction Types? |
|
Answer» They are: They are: |
|
| 18. |
Which Is More Beneficial: Cmp Or Bmp? |
|
Answer» When “ONE to one” mapping is INVOLVED, and the data is STORED persistently is regional database, CMP is PREFERRED. But when no “one to one” mapping is there and data is retrieved from numerous tables having a complex query, Bean Managed Persistence is used. When “one to one” mapping is involved, and the data is stored persistently is regional database, CMP is preferred. But when no “one to one” mapping is there and data is retrieved from numerous tables having a complex query, Bean Managed Persistence is used. |
|
| 19. |
What Is Session Bean? |
|
Answer» Session BEANS are used to shield the client from the complexity of the BUSINESS logic. They provide access to special transient business services. They are created by the client submitting the query to the database and exist as long as the client SERVER session exists. Session bean components implement the javax.ejb.SessionBean interface. Client INVOKES the methods on the session beans to access the APPLICATION in the server. Session beans are used to shield the client from the complexity of the business logic. They provide access to special transient business services. They are created by the client submitting the query to the database and exist as long as the client server session exists. Session bean components implement the javax.ejb.SessionBean interface. Client invokes the methods on the session beans to access the application in the server. |
|
| 20. |
Enlist The Enterprise Beans Types? |
|
Answer» They are:
They are: |
|
| 21. |
Describe The Life Cycle For Stateful Beans. |
|
Answer» Between the client and the session bean, the state of the CONVERSATION can be maintained using a stateful session bean. The instance variables contain a state only during the invocation by a client method. It implements ‘javax.ejb.SessionBean’ interface and is deployed with the declarative attribute ‘stateful’. They have instance fields that can be initialized and modified by the client with each method invocation. The bean can use the conversational states as its BUSINESS PROCESS METHODS. Between the client and the session bean, the state of the conversation can be maintained using a stateful session bean. The instance variables contain a state only during the invocation by a client method. It implements ‘javax.ejb.SessionBean’ interface and is deployed with the declarative attribute ‘stateful’. They have instance fields that can be initialized and modified by the client with each method invocation. The bean can use the conversational states as its business process methods. |
|
| 22. |
Is Ejbcreate () Method Mandatory While Defining A Session Bean? |
|
Answer» EjbCreate () as being PART of the BEAN’s lifecycle, therefore, it is not MANDATORY for ejbCreate () method to be PRESENT and there will be no errors returned by the COMPILER. EjbCreate () as being part of the bean’s lifecycle, therefore, it is not mandatory for ejbCreate () method to be present and there will be no errors returned by the compiler. |
|
| 23. |
What Are Create Methods Of Entity Bean? |
|
Answer» The create() METHOD is used to insert data into the database by creating a new instance of CMP entity bean. The CREATION methods look like this:
The creation methods are linked at run time. The CONTAINER delegates the invocation to these methods when the create() is invoked on home interface. These methods create Entity beans PER programmer specified parameters and CONDITIONS. The create() method is used to insert data into the database by creating a new instance of CMP entity bean. The creation methods look like this: The creation methods are linked at run time. The container delegates the invocation to these methods when the create() is invoked on home interface. These methods create Entity beans per programmer specified parameters and conditions. |
|
| 24. |
Who Took Over Ejb? |
|
Answer» EJB was TAKEN over by SUN Microsystems in 1999. EJB was taken over by Sun Microsystems in 1999. |
|
| 25. |
Define Context? |
|
Answer» This is a method of binding a NAME to a SPECIFIC OBJECT by giving an interface LIKE javax.naming.Context This is a method of binding a name to a specific object by giving an interface like javax.naming.Context |
|
| 26. |
When Was Ejb Developed? |
|
Answer» EJB was DEVELOPED by IBM in 1997. EJB was developed by IBM in 1997. |
|
| 27. |
Explain Ejb In Brief. |
|
Answer» EJB is a standard for developing server side in JAVA. It specifies agreement between COMPONENTS and application servers that allows components to run on server. They are mainly for complex serer side operations like executing complex ALGORITHM or high VOLUME business. EJB provides the application layer logic, also called as MIDDLE tier. It provides a standard specifications-based way to DEVELOP and deploy enterprise-class system. EJB is a standard for developing server side in JAVA. It specifies agreement between components and application servers that allows components to run on server. They are mainly for complex serer side operations like executing complex algorithm or high volume business. EJB provides the application layer logic, also called as middle tier. It provides a standard specifications-based way to develop and deploy enterprise-class system. |
|