

McqMate
These multiple-choice questions (MCQs) are designed to enhance your knowledge and understanding in the following areas: Master of Computer Applications (MCA) .
Chapters
1. |
Which statement characterizes stateless session beans? |
A. | They allow the PostConstruct, PreDestroy, and PrePassivate life-cycle callbacks. |
B. | They require home interfaces. |
C. | When a client looks up a stateful session bean in the JNDI, the same bean is returned every time. |
D. | They are asynchronous message consumers. |
Answer» A. They allow the PostConstruct, PreDestroy, and PrePassivate life-cycle callbacks. |
2. |
A message-driven bean can have an instance of a MessageDrivenContext injected. Which method can be successfully invoked on this interface from a message-driven bean? |
A. | getEJBHome |
B. | getCallerPrincipal (*) |
C. | isCallerInRole |
D. | getEJBLocalHome |
Answer» B. getCallerPrincipal (*) |
3. |
Which statement about entities is correct? |
A. | Entities must be annotated with the @Entity annotation. |
B. | Entities can be final classes. |
C. | Entities can have a single no-arg constructor with protected visibility. |
D. | Instance variables of an entity can have private, protected, public, or package visibility. |
Answer» C. Entities can have a single no-arg constructor with protected visibility. |
4. |
Which statement is correct about the EntityManager API? |
A. | The merge, persist, remove, and getReference methods must be invoked within a transaction context. |
B. | It is safe (no exception is thrown) to call merge or getTransaction on a JTA EntityManager instance. |
C. | The getReference method can throw an EntityNotFoundException. |
D. | Runtime exceptions thrown by the refresh and createQuery methods of the EntityManager interface do NOT cause the transaction to be rolled back. |
Answer» C. The getReference method can throw an EntityNotFoundException. |
5. |
Which statement about JTA and resource-local entity managers is correct? |
A. | The default transaction type for an entity manager is JTA in both Java EE and Java SE environments. |
B. | You cannot use a resource-local entity manager in a Java EE environment. |
C. | The EntityTransaction interface must be used when using a resource-local entity manager. (*) |
D. | Application-managed entity managers can be only a JTA transaction type. |
Answer» C. The EntityTransaction interface must be used when using a resource-local entity manager. (*) |
6. |
Which of the following is not a container for EJB? I. Internet Information Server. II. Java System Application Server. III. Tomcat. IV. WebLogic. |
A. | Both (I) and (II) above |
B. | Both (II) and (III) above |
C. | Both (III) and (IV) above |
D. | Both (I) and (III) above. |
Answer» D. Both (I) and (III) above. |
7. |
Which of the following is/are true for JSP technology? I. It is persistent. II. Platform independent. III. Browser executes the code. |
A. | Only (I) above |
B. | Only (II) above |
C. | Both (I) and (II) above |
D. | Both (II) and (III) above |
Answer» C. Both (I) and (II) above |
8. |
Which method of the request object is used to extract values of the input fields in a form when it is submitted? |
A. | getParameter |
B. | getParameterNames |
C. | getValues |
D. | putValues |
Answer» A. getParameter |
9. |
Which method of the servlet is/are called several times in its life? |
A. | init() |
B. | doPost() |
C. | destroy() |
D. | Both (a) and (b) above |
Answer» B. doPost() |
10. |
Which object is used to forward the request processing from one servlet to another? |
A. | ServeltContext |
B. | ServletConfig |
C. | RequestDispatcher |
D. | ResponseDispatcher |
Answer» C. RequestDispatcher |
11. |
Which of the following allows substitution of code to occur at the translation time in a JSP page? |
A. | <jsp:include> Tag |
B. | <@ include> directive |
C. | <@ page> directive |
D. | Declaration block |
Answer» B. <@ include> directive |
12. |
Which of the following property of Java Bean represents a single value? |
A. | Simple property |
B. | Boolean property |
C. | Indexed property |
D. | Both (a) and (b) above |
Answer» D. Both (a) and (b) above |
13. |
Which of the following is used to redirect the response from a servlet to a JSP page? |
A. | response.sendRedirect() |
B. | request.sendRedirect() |
C. | request.forward() |
D. | response.forward() |
Answer» A. response.sendRedirect() |
14. |
Which of the following is not true for <jsp:useBean> tag in JSP page? |
A. | Locates a bean instance |
B. | Stores object reference of the bean in a variable |
C. | Creates an instance if fails to locate the bean instance |
D. | Does not execute the body tag if any |
Answer» D. Does not execute the body tag if any |
15. |
Which of the following is not an implicit object in JSP? I. Request. II. Session. III. Vector. IV. In. |
A. | Both (I) and (II) above |
B. | Both (II) and (III) above |
C. | Both (I) and (III) above |
D. | Both (III) and (IV) above. |
Answer» D. Both (III) and (IV) above. |
16. |
Which statement is true for the Class java.util.HashSet? |
A. | The collection is guaranteed to be immutable. |
B. | The elements in the collection are unique. |
C. | The elements in the collection are order |
Answer» B. The elements in the collection are unique. |
17. |
Which cannot directly cause a thread to stop executing? |
A. | Calling a yield method. |
B. | Calling the start method on another Thread object. |
C. | Calling the notify method on an object. |
D. | Calling wait method on an object. |
Answer» C. Calling the notify method on an object. |
18. |
Which of the following statement is true? |
A. | An anonymous inner class can access final variables in any |
B. | Enclosing scope. |
C. | An anonymous inner class may be declared as protect |
Answer» B. Enclosing scope. |
19. |
Which of the following below are abilities of Reflection API in Java? |
A. | Determining state of an object |
B. | Both B and C |
C. | Determining duplicate classes |
D. | Determination of the class of an object |
Answer» D. Determination of the class of an object |
20. |
Which of the methods should be implemented if any class implements the Runnable interface? |
A. | start() |
B. | run() |
C. | wait() |
D. | notify() and notifyAll() |
Answer» B. run() |
21. |
Business delegate pattern |
A. | Hides remote services complexity |
B. | Reduces coupling and increases manageability |
C. | Eases failure recovery |
D. | All of the above |
Answer» D. All of the above |
22. |
Which of the following is not a life-cycle method for a Stateful Session Bean? |
A. | Post Construction |
B. | Pre Destruction |
C. | Post Activation |
D. | Pre Construction |
Answer» D. Pre Construction |
23. |
Which of the following is true? |
A. | Preserving of any state across method calls does not performed by Stateless session beans |
B. | Multiple users can access Stateful session beans at the same time |
C. | Both are correct |
D. | none |
Answer» A. Preserving of any state across method calls does not performed by Stateless session beans |
24. |
Stateful Session beans contain |
A. | Home Interface |
B. | Remote Interface |
C. | Bean class |
D. | All of the above |
Answer» D. All of the above |
25. |
Which of the following regarding business methods in a bean class is incorrect? |
A. | Both session bean and entity bean business methods are always same |
B. | For Java RMI API, the argument and return types must always be legal types |
C. | The throws clause may include any exceptions defined by your application. |
D. | None of the above |
Answer» B. For Java RMI API, the argument and return types must always be legal types |
26. |
Choose the incorrect statement from the following about Home methods in a bean class for CMP (Container Managed Persistence). |
A. | The throws clause of the method may include the java.rmi.RemoteException. |
B. | Relationships must not be accessed by the method |
C. | The persistence state of the bean must not be accessed by the method |
D. | The static declaration can not be done for the method. |
Answer» A. The throws clause of the method may include the java.rmi.RemoteException. |
27. |
Given the following code in a stateful session bean business method; try { Socket skt = new Socket(x,y); } catch (Exception ex) { ex.printStackTrace(); } Assuming that x and y are the port and IP addresses respectively of a running service, which is running on the same server, which of the following is correct? |
A. | Failure in Compilation |
B. | Failure in Deployment |
C. | An exception is thrown at runtime |
D. | Indeterminate. The code is not guaranteed to be ported to all EJB 2.0 containers, though it may deploy. |
Answer» D. Indeterminate. The code is not guaranteed to be ported to all EJB 2.0 containers, though it may deploy. |
28. |
Which of the following is true about EJB transactions? |
A. | Nested transactions are supported by EJB 2.0 |
B. | Isolation levels specification is supported by EJB 2.0 |
C. | Bean-managed transaction demarcation must not be used in Message-driven beans |
D. | Bean-managed transaction demarcation must not be used in Entity beans |
Answer» D. Bean-managed transaction demarcation must not be used in Entity beans |
29. |
Which of the following are guaranteed capabilities of EJB 2.0? |
A. | Run-as security identity functionality. |
B. | The extension of JDBC 2.0 |
C. | Both A and B |
D. | Neither A nor B |
Answer» C. Both A and B |
30. |
From the following APIs, which API does NOT guarantee to be supported by EJB 2.0 containers? |
A. | JAXP |
B. | JNDI |
C. | JXTA |
D. | JDBC |
Answer» C. JXTA |
31. |
Which component does the Entity bean represent the persistent data stored in the database? |
A. | Server-side component |
B. | Client-side component |
C. | server and client side component |
D. | None of the above |
Answer» A. Server-side component |
32. |
EJB is like COM, Abbreviate the term COM? |
A. | Component Object Model |
B. | Component Oriented Model |
C. | Common Object Model |
D. | Common Oriented Model |
Answer» A. Component Object Model |
33. |
JMS is also known as a messaging service. |
A. | True |
B. | False |
C. | none |
D. | all |
Answer» A. True |
34. |
The life cycle of session bean is not maintained by the application server (EJB Container). |
A. | True |
B. | False |
C. | none |
D. | all |
Answer» B. False |
35. |
What represents a persistent global data from the database? |
A. | Entity Bean |
B. | Session Bean |
C. | Both A & B |
D. | None of the above |
Answer» A. Entity Bean |
36. |
Which component does the Entity bean represents the persistent data stored in the database? |
A. | Server-side component |
B. | Client-side component |
C. | server and client side component |
D. | None of the above |
Answer» A. Server-side component |
37. |
In EJB, middleware services are provided by EJB Container automatically. |
A. | True |
B. | False |
C. | none |
D. | all |
Answer» A. True |
38. |
Which middleware services are provided by EJB? |
A. | Security |
B. | Transaction Management |
C. | Both A & B |
D. | None of the above |
Answer» C. Both A & B |
39. |
Which server-side component is required to be deployed on the server? |
A. | EJB |
B. | RMI |
C. | Both A & B |
D. | None of the above |
Answer» A. EJB |
Done Studing? Take A Test.
Great job completing your study session! Now it's time to put your knowledge to the test. Challenge yourself, see how much you've learned, and identify areas for improvement. Don’t worry, this is all part of the journey to mastery. Ready for the next step? Take a quiz to solidify what you've just studied.