Deck 7: Java Web Development
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/25
Play
Full screen (f)
Deck 7: Java Web Development
1
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.
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.
The getReference method can throw an EntityNotFoundException.
2
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.
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.
The EntityTransaction interface must be used when using a resource-local entity manager. ()
3
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.
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.
Both (I) and (III) above.
4
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
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
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
5
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
A) getParameter
B) getParameterNames
C) getValues
D) putValues
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
6
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
A) init()
B) doPost()
C) destroy()
D) Both (a) and (b) above
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
7
Which object is used to forward the request processing from one servlet to another?
A) ServeltContext
B) ServletConfig
C) RequestDispatcher
D) ResponseDispatcher
A) ServeltContext
B) ServletConfig
C) RequestDispatcher
D) ResponseDispatcher
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
8
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
A) <jsp:include> Tag
B) <@ include> directive
C) <@ page> directive
D) Declaration block
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
9
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
A) Simple property
B) Boolean property
C) Indexed property
D) Both (a) and (b) above
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
10
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()
A) response. sendRedirect()
B) request. sendRedirect()
C) request. forward()
D) response. forward()
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
11
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
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
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
12
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.
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.
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
13
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
A) The collection is guaranteed to be immutable.
B) The elements in the collection are unique.
C) The elements in the collection are order
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
14
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.
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.
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
15
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
A) An anonymous inner class can access final variables in any
B) Enclosing scope.
C) An anonymous inner class may be declared as protect
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
16
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
A) Determining state of an object
B) Both B and C
C) Determining duplicate classes
D) Determination of the class of an object
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
17
Which of the methods should be implemented if any class implements the Runnable interface?
A) start()
B) run()
C) wait()
D) notify() and notifyAll()
A) start()
B) run()
C) wait()
D) notify() and notifyAll()
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
18
Business delegate pattern
A) Hides remote services complexity
B) Reduces coupling and increases manageability
C) Eases failure recovery
D) All of the above
A) Hides remote services complexity
B) Reduces coupling and increases manageability
C) Eases failure recovery
D) All of the above
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
19
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
A) Post Construction
B) Pre Destruction
C) Post Activation
D) Pre Construction
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
20
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
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
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
21
Stateful Session beans contain
A) Home Interface
B) Remote Interface
C) Bean class
D) All of the above
A) Home Interface
B) Remote Interface
C) Bean class
D) All of the above
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
22
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
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
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
23
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.
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.
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
24
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.
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.
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
25
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
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
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck