Top 50 ejb Interview Questions
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 announcement should examine to a price that can be promoted to an int fee.
Q2. What Are The Optional Clauses In Ejb Ql?
WHERE and ORDERBY clauses are non-obligatory in EJB QL in which as SELECT and FROM are required clauses.
Q3. When Is The Finally Clause Of A Try-seize-in the end Statement Executed?
The ultimately clause of the attempt-catch-ultimately declaration is continually executed until the thread of execution terminates or an exception takes place in the execution of the eventually clause.
Q4. If A Method Is Declared As Protected, Where May The Method Be Accessed?
A protected method can also only be accessed by way of lessons or interfaces of the equal package deal or through subclasses of the magnificence wherein it is declared.
Q5. What Is Session Bean?
Session be are used to protect the purchaser from the complexity of the commercial enterprise good judgment. They provide access to big trient business offerings. They are created by using the purchaser filing the question to the database and exist as long as the purchaser server consultation exists.
Session bean additives implement the javax.Ejb.SessionBean interface. Client invokes the techniques at the session be to get right of entry to the software within the server.
Q6. Enlist The Contents Of Container, Container Contains?
Security help: Used to configure Deployment Descriptor (DD).
Persistence guide: Used to be persistence in tractions.
Traction control aid: Used to configure Deployment Descriptor (DD).
Management of Session: Callback techniques inclusive of ejbStore (), ejbLoad () are used inside the Developer.
Management of Life Cycle: Automatic
Q7. How Can A Gui Component Handle Its Own Events?
A aspect can handle its own events by using imposing the required event-listener interface and adding itself as its personal occasion listener.
Q8. What Is Java?
Java is an object-orientated programming language evolved first of all by using James Gosling and associates at Sun Microsystems. The language, to begin with known as Oak (named after the alrighttrees out of doors Gosling's office), become meant to update C++, although the function set better resembles that of Objective C. Java ought to now not be harassed with JavaScript, which shares handiest the call and a comparable C-like syntax. Sun Microsystems currently keeps and updates Java often.
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 version uses an occasion inheritance or effervescent approach. In this version, components are required to deal with their own occasions. If they do no longer handle a specific occasion, the event is inherited via (or bubbled as much as) the factor's box. The field then both handles the event or it's far bubbled as much as its container and so on, till the very best-level field has been tried. In the occasion-delegation model, precise gadgets are exact as occasion handlers for GUI components. These gadgets put into effect occasion-listener interfaces. The event-delegation model is more green than the occasion-inheritance model as it gets rid of the processing required to aid the bubbling of unhandled events.
Q10. What Is The Collection Interface?
The Collection interface offers aid for the implementation of a mathematical bag - an unordered series of gadgets that may contain duplicates.
Q11. What Is The Difference Between A Choice And A List?
A Choice is displayed in a compact form that calls for you to tug it right down to see the listing of to be had picks. Only one object may be decided on from a Choice. A List can be displayed in the sort of way that numerous List gadgets are seen. A List helps the selection of 1 or greater List objects.
Q12. Why Are The Methods Of The Math Class Static?
So they may be invoked as if they may be a mathematical code library.
Q13. What An I/o Filter?
An I/O filter out is an item that reads from one circulation and writes to any other, usually altering the records in a few way as it's miles handed from one flow to another.
Q14. What Is Local Client View?
The neighborhood patron view specification is only available in EJB 2.@Unlike the far flung consumer view, the neighborhood customer view of a bean is place established. Local consumer view get entry to to an employer bean calls for each the nearby consumer and the organization bean that offers the nearby consumer view to be within the same JVM. The nearby patron view therefore does not offer the location trparency furnished with the aid of the far off purchaser view. Local interfaces and neighborhood home interfaces provide support for light-weight get right of entry to from employer bean which can be local customers. Session and entity be may be tightly couple with their clients, allowing access without the overhead typically related to far flung method calls.
Q15. What Is The Purpose Of The File Class?
The File elegance is used to create objects that offer get admission to to the documents and directories of a neighborhood record gadget.
Q16. What Are The Legal Operands Of The Instanceof Operator?
The left operand is an object reference or null fee and the right operand is a category, interface, or array kind.
Q17. Can I Invoke Runtime.Gc() In An Ejb?
You shouldn’t. What will take place depends on the implementation, but the name will most probably be unnoticed.
Q18. What Advantage Do Java's Layout Managers Provide Over Traditional Windowing Systems?
Java uses format managers to put out components in a constant way across all windowing platforms. Since Java's format managers are not tied to absolute sizing and positioning, they're able to accommodate platform-specific differences among windowing systems.
Q19. What Modifiers Can Be Used With A Local Inner Class?
A neighborhood inner elegance may be final or summary.
Q20. What Is The Highest-level Event Class Of The Event-delegation Model?
The java.Util.EventObject elegance is the highest-stage magnificence in the occasion-delegation magnificence hierarchy.
Q21. What Is The Difference Between Static And Non-static Variables?
A static variable is related to the elegance as a whole as opposed to with specific times of a category. Non-static variables take on specific values with each object example.
Q22. What Is The Difference Between A While Statement And A Do Statement?
A at the same time as statement assessments at the beginning of a loop to peer whether or not the next loop new release need to arise. A do announcement tests on the give up of a loop to look whether the next iteration of a loop ought to occur. The do assertion will always execute the body of a loop as a minimum once.
Q23. What Is Ejb Server?
An EJB server is a excessive-degree system or application that offers a run-time environment to assist the execution of server programs that use agency be. An EJB server provides a JNDI-handy naming service, manages and coordinates the allocation of sources to customer applications, affords get admission to to device resources, and offers a traction service. An EJB server will be furnished by means of, for instance, a database or utility 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 report is an elective JAR file which could comprise all of the class documents that a purchaser application wishes to use the purchaser view of the employer be that are contained inside the EJB JAR file. If making a decision no longer to create a customer JAR report for an EJB module, all of the consumer interface instructions can be in the EJB JAR document.
Q26. What Class Allows You To Read Objects Directly From A Stream?
The ObjectInputStream elegance helps the reading of objects from enter streams.
Q27. What Is The Difference Between Sessioncontext And Entitycontext?
Since EnterpriseBe live in a controlled field, the box is free to call your EJB additives methods at its amusement. The field houses the information like cutting-edge status of bean,protection credentials of the consumer currently having access to the bean in a single object is referred to as EJBContext Object. A context represents a way for be to carry out callbacks and modify their cutting-edge repute Sessioncontext is EJB context for consultation 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 factors of a GridBad format are of identical size and are laid out the use of the squares of a grid.
Q29. What Is The Difference Between Ear, Jar And War File?
Modules are packaged based totally on their functionality as EAR, JAR and WAR files.
JAR files (.Jar) : Modules which incorporate EJB class files and EJB deployment descriptor are packed as JAR files.
WAR Files (.War) : Web modules which contain Servlet class documents, JSP Files, assisting files, GIF and HTML files are packaged as JAR document.
EAR Files (.Ear) : ‘.Jar’ & ‘.War’ documents are packaged as JAR files. ‘Ear’ stands for organization archive. These files are deployed within the software server.
Q30. Describe The Life Cycle For Stateful Be.
Between the purchaser and the session bean, the kingdom of the communication can be maintained the use of a stateful consultation bean. The example variables contain a kingdom most effective at some point of the invocation through a purchaser technique.
It implements ‘javax.Ejb.SessionBean’ interface and is deployed with the declarative attribute ‘stateful’.
They have instance fields that may be initialized and modified via the client with every approach 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 turned into evolved via 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 man or woman of an identifier
Q34. Is Decorator An Ejb Design Pattern?
No. Decorator layout pattern, is the only which exhibits very low level runtime polymorphism, for the particular and single object (Instance of the magnificence), however not for atleast for a class. It is the stuff to feature particular functionality to a unmarried & pointed item and leaves others love it unmodified. It is having near similarities like aspectJ stuff, but no longer 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 get admission to the EJB documents.
Message Driven Be (MDB): Asynchronous execution by way of me of messaging paradigm is supported.
Q37. Name The Containers Which Uses Border Layout As Their Default Layout?
Containers which makes use of 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 materials a default constructor for a category if no different constructors are provided.
Q39. What Does A Well-written Oo Program Look Like?
A properly-written OO software well-knownshows recurring structures that sell abstraction, flexibility, modularity and elegance.
Q40. How Are This () And Super () Used With Constructors?
This() is used to invoke a constructor of the identical class. Extremely good() is used to invoke a superclass constructor.
Q41. What Is Ejb Container?
An EJB box is a run-time surroundings that manages one or greater business enterprise be. The EJB box manages the life cycles of organisation bean gadgets, coordinates dispensed tractions, and implements item safety. Generally, every EJB field is supplied through an EJB server and incorporates a set of agency 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 assignment's interrupt() approach is completed, the mission enters the prepared kingdom. The subsequent time the project enters the strolling nation, an InterruptedException is thrown.
Q43. Define Context?
This is a technique of binding a name to a selected item by means of 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 elegance System has a variable out that represents the same old output, and the variable err that represents the usual error tool. By default, they both factor on the gadget console. This how the standard output may 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 this is declared as a member of a category. A neighborhood variable is a variable that is declared nearby to a way.
Q46. What Is An Ejb Context?
EJBContext is an interface implemented by using the field. It is part of the bean-container settlement.
EntityContext: This is a sub-magnificence of EJBContext that Entity be use.
SessionContext: Session be use this subclass.
These EJBContext gadgets offer the bean magnificence with facts about its:
Container.
Client the usage of the bean.
Bean itself.
Q47. Can You Have Virtual Functions In Java?
Yes, all functions in Java are virtual by default. This is honestly a pseudo trick question due to the fact the phrase "digital" isn't always part of the naming conference in Java (as it's miles in C++, C-sharp and VB.NET), so this would be a overseas concept for a person who has handiest coded in Java. Virtual features or digital strategies are features or methods so as to be redefined in derived training.
Q48. Who Took Over Ejb?
EJB became taken over by way of Sun Microsystems in 1999.
Q49. How Does Multithreading Take Place On A Computer With A Single Cpu?
The operating gadget's challenge scheduler allocates execution time to more than one responsibilities. By fast switching among executing obligations, it creates the influence that duties execute sequentially.
Q50. What Is Lazy Loading?
Heavy weight utility consume a whole lot of time whilst loading the plug-ins. In lazy loading method, the plug-ins which can be wished at that unique time are loaded and instantiated. This boosts up the performance as only the plug-ins which might be used are loaded. This additionally ensures the performance and speeds up the initial load time of the programs. Applications like Eclipse use this technique. In other words, the goal of lazy loading is to devote memory simplest when it's far surely necessary.

