Hey, guys! These are the questions asked in Whizlabs trial simulator.
Let's discuss them!
WhizTrial Simulator
IBM 483 Exam � Enterprise Connectivity with
J2EE 1.2
1. Which of the following J2EE design
patterns can be used to efficiently transfer remote, fine-grained data by sending a coarse-grained view of the data?
a) Fast-Lane Reader
b) Value Object
c) Session Fa�ade
d) Data Access Object
2. The loading time (for included resource) is same for bothJSP include directive (<%@ include file="filename" %>

and
JSP include action (<jsp:include page="pageURL" flush="true" />

. True/False?
a) True
b) False
3. What will be the output on execution of the following code in a
Java Server Page (JSP)?
<html>
<body>
<% byte age=0; %>
<% for (int age=0; age<100; age++) { out.println("The age is :"+age); } %>
</body>
</html>
a) It will print "The age is :0" 100 times.
b) The above code will give compilation error.
c) It will print "The age is :0" 99 times.
d) None of the above.
4. Which of the given options are equivalent?
a) <%= System.currentTimeMillis(); new java.sql.Date(System.currentTimeMillis()); %>
<% jsp:scriptlet> for (int count=0; count<10; i++) { out.println("The counter is:" + i); }
</jsp:scriptlet>
b) <% !public
String f(int i){if (i<3)return("...");...}%>
<%@ jsp:expression> System.currentTimeMillis(); new
java.sql.Date(System.currentTimeMillis()) </jsp:expression>
c) <% jsp

eclaration> public String f(int i){if (i<3)return("...");...} </jsp

eclaration>
<%for (int count=0; count<10; i++) { out.println("The counter is:" + i); } %>
5. Your J2EE application contains a small set of objects which are never updated, but whose state is frequently read. When designing these as enterprise beans, which of the following types would be the best choice if application performance is the main criteria?
a) CMP Entity bean
b) BMP Entity bean
c) Stateless Session Bean
d) Stateful Session Bean
6. A calculator with memory feature can be represented by which of the following ?
a)Stateful Session Bean
b)CMP Entity Bean
c)BMP Entity Bean
d)Stateless Session Bean
7. Which of the following are prevented when the transaction isolation level is set to 'Repeatable Read' ?
a)Dirty Reads and nonrepeatable reads
b)Dirty Reads only
c)Dirty Reads and phantom Reads
d)Phantom Reads only
e)Nonrepeatable reads only
8. A datasource has been mapped to the JNDI name jdbc/dept using the resource-ref element in the deployment descriptor of a bean. Which url would be used by the bean to get a reference to the datasource?
a)java:comp/env/jdbc/dept
b)java:comp/env/dept
c)java:env/comp/jdbc/dept
d)java:env/comp/dept
e)java:comp/jdbc/dept
9. Which of the following methods can be used to reliably compare two EJB object remote references?
a)equals()
b)hashCode()
c)isIdentical()
d)isEqual()
e)It is not possible to compare
10. Which of the following values of transaction attributes ensure that the enterprise bean method will always execute within the scope of a transaction whether the calling client is in a transactional context or not ?
a)Not Supported
b)Required
c)Supports
d)RequiresNew
e)Mandatory
f)Never
11. Which of the following statements about getRequestDispatcher() method of ServletContext and ServletRequest objects are true?
a)ServletRequest.getRequestDispatcher(String) can accept only absolute URL.
b)ServletContext.getRequestDispatcher(String) can accept only absolute URL.
c)ServletRequest.getRequestDispatcher(String) can accept either of relative and absolute URLs.
d)ServletContext.getRequestDispatcher(String) can accept either of relative and absolute URLs.
e)Both the method calls are transparent to the browser.
f)Both the method calls sends redirect message to the browser.
12. Every time a request comes to the JSP, which of the following container generated methods is invoked and then the request is processed, and the JSP generates the appropriate response.
a)_jspInit()
b)_service()
c)_jspService()
d)init()
e)_jspStart()
f)start()
13. Which of the following callback methods is NOT a part of the entity bean life cycle ?
a)ejbLoad()
b)ejbSave()
c)ejbPostCreate()
d)ejbRemove()
e)ejbPassivate()
14. FinderException is a superclass of which of the following ?
a)ObjectNotFoundException
b)NoSuchEntityException
c)EntityNotFoundException
d)None of the above
15. Which of the following are true for entity beans when in the pooled state ?
a)The bean instance is assigned a primary key by the container
b)The persistent fields of the bean instance are set at their default values
c)The bean instance is assigned an EntityContext by the container
d)The bean instance represents a row from a database table
16. A container managed transaction is rolled back automatically in which of the following cases ?
a)A system exception is thrown
b)The setRollbackOnly method of the EJBContext interface is called
c)An application exception is thrown
d)The rollback method of the UserTransaction interface is called
17. Which of the following is NOT true for the ejbPostCreate() method of an entity bean ?
a)The number and types of arguments must match a corresponding ejbCreate method
b)The access control modifier must be public
c)The method modifier cannot be final or static
d)The return type must be the primary key of the bean
18. The getCallerPrincipal method of the EJBContext interface can be used to find which of the following?
a)The identity of the calling client
b)Whether the client accessing the bean is a member of any defined role
c)The access level of the caller
d)Whether the caller identity is secure or not
19. Which of the following happens when a client invokes the remove() method on the home object of a Stateless Session Bean ?
a)The EJB Object associated with the bean is released
b)ejbRemove() method is invoked on the bean
c)The bean is garbage collected
d)The client side stub of the bean is invalidated
20. When a client invokes the create() method to get the reference to a stateless session bean which of the following sequence of operations are carried out ?
a)EJBObject.create(), Class.newInstance(), SessionBean.setSessionContext(), SessionBean.ejbCreate()
b)EJBHome.create(), Class.newInstance(), SessionBean.setSessionContext(), SessionBean.ejbCreate()
c)EJBHome.create(), SessionBean.newInstance(), SessionBean.ejbCreate(), SessionBean.setSessionContext()
d)None of the above
21. In JMS Point-to-Point messaging, which of the following is NOT true ?
a)Each message has only one consumer
b)The receiver can fetch the message only if it was running when the client sent the message.
c)The receiver acknowledges the successful processing of a message.
d)All of the above
22. The web.xml file for a webapp contains the follwing XML Tags to configure session timeout.
<session-config>
<session-timeout>60</session-timeout>
</session-config>
What would be the default session timeout interval for the session created in this Webapp?
a)1 hour
b)1 minute
c)1 sec
d)None of the above
23. Which of the following are true about the EntityContext interface?
a)EntityContext provides the bean with an interface to the container
b)EntityContext is set many times during the life of an entity bean instance
c)The unsetEntityContext method is called whenever the entity bean is passivated
d)EntityContext provides methods to obtain an EntityBean's EJBObject reference and primary key.
24. In JMS, message producers and message consumers are created by which of the following ?
a)Connections
b)Sessions
c)Destinations
d)Connection Factories
e)Message Listeners
25. If there are no records matching the query executed by the executeQuery() method of the Statement class which of the following takes place ?
a)SQLException is thrown
b)Returns null
c)Returns false
d)None of the above
26. Which of the following Statement class methods is used for executing a query which returns multiple resultsets ?
a)executeQuery
b)execute
c)executeUpdate
d)executeQueryMultiple
27. You want to create a ResultSet in which the cursor can move backwards, forwards, and at random. Also any changes made by other users to the rows selected in the current ResultSet should be visible to the user. Which of the following needs to be done for this to happen ?
a)set first argument of createStatement method to ResultSet.TYPE_SCROLL_INSENSITIVE and second argument to ResultSet.CONCUR_UPDATABLE
b)set first argument of createStatement method to ResultSet.TYPE_SCROLLABLE and second argument to ResultSet.CONCUR_UPDATABLE
c)set first argument of createStatement method to ResultSet.TYPE_SCROLL_SENSITIVE, second argument can be any of 2 valid values
d)set the first argument of the createStatement method to ResultSet.TYPE_SCROLL_SENSITIVE and second argument to ResultSet.SHOW_CHANGES
28. Considering the JSP (MyJSP) and JavaBean (MyBean), what will be output on accessing the JSP with URL request below :
http://webserver:host/MyJSP.jsp?score=99&grade=A // MyBean
public class MyBean
{
int score;
char grade;
public void setScore(int scr)
{
score = scr;
}
public int getScore()
{
return score;
}
public void setGrade(char gra)
{
grade = gra;
}
public int getGrade()
{
return grade;
}
}
//MyJSP
<html>
<head>
</head>
<body>
<jsp:useBean id="myBean" class="MyBean"/>
<jsp:setProperty name="myBean" property="*"/>
Score : <%=myBean.getScore()%> + 1
Grade : <%=myBean.getGrade()%> + "+"
</body>
<html>
a)Score : 100 Grade : A+
b)Score : 100 Grade : 65+
c)Compile Time Error
d)None of the above
29. Who is responsible for setting the database mappings for CMP entity beans ?
a)Bean Developer
b)Application Assembler
c)Application Deployer
d)Server Provider
30. In a valid deployment descriptor, which of the following sets of XML elements and their permissible values is NOT correct ?
a)<session-type> : Stateful, Stateless
b)<transaction-type>: Supports, NotSupported, Requires, RequiresNew, Mandatory, Never
c)<persistence-type> : Bean, Container
d)<reentrant> : True, False