Top 50 ejb Interview Questions You Must Prepare 27.Jul.2024

Q1. What Restrictions Are Placed On The Values Of Each Case Of A Switch Statement?

During compilation, the values of each case of a switch statement must evaluate to a value that can be promoted to an int value.

Q2. What Are The Optional Clauses In Ejb Ql?

WHERE and ORDERBY clauses are optional in EJB QL where as SELECT and FROM are required clauses.

Q3. When Is The Finally Clause Of A Try-catch-finally Statement Executed?

The finally clause of the try-catch-finally statement is always executed unless the thread of execution terminates or an exception occurs within the execution of the finally clause.

Q4. If A Method Is Declared As Protected, Where May The Method Be Accessed?

A protected method may only be accessed by classes or interfaces of the same package or by subclasses of the class in which it is declared.

Q5. What Is Session Bean?

Session be are used to shield the client from the complexity of the business logic. They provide access to special trient 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 be to access the application in the server.

Q6. Enlist The Contents Of Container, Container Contains?

  • Security support: Used to configure Deployment Descriptor (DD).
  • Persistence support: Used to be persistence in tractions.
  • Traction management support: Used to configure Deployment Descriptor (DD).
  • Management of Session: Callback methods such as ejbStore (), ejbLoad () are used in the Developer.
  • Management of Life Cycle: Automatic

Q7. How Can A Gui Component Handle Its Own Events?

A component can handle its own events by implementing the required event-listener interface and adding itself as its own event listener.

Q8. What Is Java?

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.

Q9. What Is The Difference Between The Jdk 1.02 Event Model And The Event-delegation Model Introduced With Jdk 1.1?

The JDK 1.02 event model uses an event inheritance or bubbling approach. In this model, components are required to handle their own events. If they do not handle a particular event, the event is inherited by (or bubbled up to) the component's container. The container then either handles the event or it is bubbled up to its container and so on, until the highest-level container has been tried. In the event-delegation model, specific objects are designated as event handlers for GUI components. These objects implement event-listener interfaces. The event-delegation model is more efficient than the event-inheritance model because it eliminates the processing required to support the bubbling of unhandled events.

Q10. What Is The Collection Interface?

The Collection interface provides support for the implementation of a mathematical bag - an unordered collection of objects that may contain duplicates.

Q11. What Is The Difference Between A Choice And A List?

A Choice is displayed in a compact form that requires you to pull it down to see the list of available choices. Only one item may be selected from a Choice. A List may be displayed in such a way that several List items are visible. A List supports the selection of one or more List items.

Q12. Why Are The Methods Of The Math Class Static?

So they can be invoked as if they are a mathematical code library.

Q13. What An I/o Filter?

An I/O filter is an object that reads from one stream and writes to another, usually altering the data in some way as it is passed from one stream to another.

 

Q14. What Is Local Client View?

The local client view specification is only available in EJB 2.@Unlike the remote client view, the local client view of a bean is location dependent. Local client view access to an enterprise bean requires both the local client and the enterprise bean that provides the local client view to be in the same JVM. The local client view therefore does not provide the location trparency provided by the remote client view. Local interfaces and local home interfaces provide support for lightweight access from enterprise bean that are local clients. Session and entity be can be tightly couple with their clients, allowing access without the overhead typically associated with remote method calls.

Q15. What Is The Purpose Of The File Class?

The File class is used to create objects that provide access to the files and directories of a local file system.

Q16. What Are The Legal Operands Of The Instanceof Operator?

The left operand is an object reference or null value and the right operand is a class, interface, or array type.

Q17. Can I Invoke Runtime.gc() In An Ejb?

You shouldn’t. What will happen depends on the implementation, but the call will most likely be ignored.

Q18. What Advantage Do Java's Layout Managers Provide Over Traditional Windowing Systems?

Java uses layout managers to lay out components in a consistent manner across all windowing platforms. Since Java's layout managers aren't tied to absolute sizing and positioning, they are able to accommodate platform-specific differences among windowing systems.

 

Q19. What Modifiers Can Be Used With A Local Inner Class?

A local inner class may be final or abstract.

 

Q20. What Is The Highest-level Event Class Of The Event-delegation Model?

The java.util.EventObject class is the highest-level class in the event-delegation class hierarchy.

 

Q21. What Is The Difference Between Static And Non-static Variables?

A static variable is associated with the class as a whole rather than with specific instances of a class. Non-static variables take on unique values with each object instance.

Q22. What Is The Difference Between A While Statement And A Do Statement?

A while statement checks at the beginning of a loop to see whether the next loop iteration should occur. A do statement checks at the end of a loop to see whether the next iteration of a loop should occur. The do statement will always execute the body of a loop at least once.

Q23. What Is Ejb Server?

An EJB server is a high-level process or application that provides a run-time environment to support the execution of server applications that use enterprise be. An EJB server provides a JNDI-accessible naming service, manages and coordinates the allocation of resources to client applications, provides access to system resources, and provides a traction service. An EJB server could be provided by, for example, a database or application server.

Q24. Which Math Method Is Used To Calculate The Absolute Value Of A Number?

The abs() method is used to calculate absolute values.

 

Q25. What Is Ejb Client Jar File?

An EJB client JAR file is an optional JAR file that can contain all the class files that a client program needs to use the client view of the enterprise be that are contained in the EJB JAR file. If you decide not to create a client JAR file for an EJB module, all of the client interface classes will be in the EJB JAR file.

Q26. What Class Allows You To Read Objects Directly From A Stream?

The ObjectInputStream class supports the reading of objects from input streams.

Q27. What Is The Difference Between Sessioncontext And Entitycontext?

Since EnterpriseBe 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 be 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

Q28. How Are The Elements Of A Gridlayout Organized?

The elements of a GridBad layout are of equal size and are laid out using the squares of a grid.

Q29. What Is The Difference Between Ear, Jar And War File?

Modules are packaged based on their functionality as EAR, JAR and WAR files.

  • JAR files (.jar) : Modules which contain EJB class files and EJB deployment descriptor are packed as JAR files.
  • WAR Files (.war) : Web modules which contain Servlet class files, JSP Files, supporting files, GIF and HTML files are packaged as JAR file.
  • EAR Files (.ear) : ‘.jar’ & ‘.war’ files are packaged as JAR files. ‘Ear’ stands for enterprise archive. These files are deployed in the application server.

Q30. Describe The Life Cycle For Stateful Be.

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.

Q31. Enlist The Declarative Traction Types?

They are:

  • MANDATORY
  • REQUIRED
  • REQUIRES_NEW
  • SUPPORTS
  • NOT_SUPPORTED
  • NEVER

Q32. When Was Ejb Developed?

EJB was developed by IBM in 1997.

Q33. Which Non-unicode Letter Characters May Be Used As The First Character Of An Identifier?

The non-Unicode letter characters $ and _ may appear as the first character of an identifier

Q34. Is Decorator An Ejb Design Pattern?

No. Decorator design pattern, is the one which exhibits very low level runtime polymorphism, for the specific and single object (Instance of the class), but not for atleast for a class. It is the stuff to add specific functionality to a single & pointed object and leaves others like it unmodified. It is having close similarities like aspectJ stuff, but not with EJB stuff.

Q35. How Can The Checkbox Class Be Used To Create A Radio Button?

By associating Checkbox objects with a CheckboxGroup.

Q36. Enlist The Enterprise Be Types?

They are:

  • Session Be: Expanded as “Stateful”,”Stateless” and “Singleton”, A Remote or Local interface is used to access the EJB files.
  • Message Driven Be (MDB): Asynchronous execution by me of messaging paradigm is supported.

Q37. Name The Containers Which Uses Border Layout As Their Default Layout?

Containers which uses Border Layout as their default are: window, Frame and Dialog classes.

Q38. When Does The Compiler Supply A Default Constructor For A Class?

The compiler supplies a default constructor for a class if no other constructors are provided.

Q39. What Does A Well-written Oo Program Look Like?

A well-written OO program exhibits recurring structures that promote abstraction, flexibility, modularity and elegance.

Q40. How Are This () And Super () Used With Constructors?

This() is used to invoke a constructor of the same class. super() is used to invoke a superclass constructor.

Q41. What Is Ejb Container?

An EJB container is a run-time environment that manages one or more enterprise be. The EJB container manages the life cycles of enterprise bean objects, coordinates distributed tractions, and implements object security. Generally, each EJB container is provided by an EJB server and contains a set of enterprise be that run on the server.

Q42. What Happens When You Invoke A Thread's Interrupt Method While It Is Sleeping Or Waiting?

When a task's interrupt() method is executed, the task enters the ready state. The next time the task enters the running state, an InterruptedException is thrown.

 

Q43. Define Context?

This is a method of binding a name to a specific object by giving an interface like javax.naming.Context

Q44. How Could Java Classes Direct Program Messages To The System Console, But Error Messages, Say To A File?

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: 
Stream st = new Stream(new FileOutputStream("output.txt")); System.setErr(st); System.setOut(st);

 

Q45. What Is The Difference Between A Field Variable And A Local Variable?

A field variable is a variable that is declared as a member of a class. A local variable is a variable that is declared local to a method.

Q46. What Is An Ejb Context?

EJBContext is an interface implemented by the container. It is a part of the bean-container contract.

  • EntityContext: This is a sub-class of EJBContext that Entity be use.
  • SessionContext: Session be use this subclass.

These EJBContext objects provide the bean class with information about its:

  • Container.
  • Client using the bean.
  • Bean itself.

Q47. Can You Have Virtual Functions In Java?

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.

Q48. Who Took Over Ejb?

EJB was taken over by Sun Microsystems in 1999.

Q49. How Does Multithreading Take Place On A Computer With A Single Cpu?

The operating system's task scheduler allocates execution time to multiple tasks. By quickly switching between executing tasks, it creates the impression that tasks execute sequentially.

Q50. What Is Lazy Loading?

Heavy weight application consume a lot of time while loading the plug-ins. In lazy loading approach, the plug-ins that are needed at that particular time are loaded and instantiated. This boosts up the performance as only the plug-ins that are used are loaded. This also ensures the efficiency and speeds up the initial load time of the applications. Applications like Eclipse use this approach. In other words, the goal of lazy loading is to dedicate memory only when it is absolutely necessary.