0% found this document useful (0 votes)
6 views13 pages

Enterprise Java Exam Questions Guide

Uploaded by

Tejas Ruikar
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views13 pages

Enterprise Java Exam Questions Guide

Uploaded by

Tejas Ruikar
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

dDw tMjIw Njg5MjE

QuestionID : 9584 Subject Name Enterprise Java


Q1. What helps to load a Driver and connect to a database
1. Driver Manager
2. Driver
3. Statement
4. All
Correct Answer : 1
Your Answer : 2
QuestionID : 9719 Subject Name Enterprise Java
Q2. The JDBC returns the query in ____________
1. Resultset
2. DatabaseMetadata
3. preparedstatment
4. calablestatement
Correct Answer : 1
Your Answer : 3
QuestionID : 9753 Subject Name Enterprise Java
Q3. A message-driven bean developed for a JMS messaging system puts
its business processing logic within which method?
1. setSessionContext method
2. onMessage method
3. ejbRemove method
4. setMessageDriverContext method
Correct Answer : 1
Your Answer : 3
QuestionID : 9769 Subject Name Enterprise Java
Q4. To send binary output in response,the following method
of HttpServletResponse may be used to get the appropriate Writer/Stream
object,Select the one correct answer
1. getStream
2. getOutputStream
3. getBinaryStream
4. getWriter
Correct Answer : 2
Your Answer : 3
QuestionID : 9801 Subject Name Enterprise Java
Q5. Which of the following statement are TRUE.
1. < %int i=0;% > is a variable declaration that has local scope within the
service method of the servlet.
2. < %int i;% > is a variable declaration that is class scope to the service
method.
3. < %!int i;% > a variable declaration that has local scope within the
service method of the servlet.
4. < %int i=0;% > is a variable declaration that has local scope within the
doGet method of the servlet.
Correct Answer : 1
Your Answer : 3
QuestionID : 9809 Subject Name Enterprise Java
Q6. The idea behind the J2EE platform is to provide a simple,_____ standard
for distributed application through a component-based application model.
1. effective
2. efficient
3. unified
4. None
Correct Answer : 3
Your Answer : 2
QuestionID : 10097 Subject Name Enterprise Java
Q7. Using a FlowLayout manager, which is the correct way to add elements
to a container:
1. add(component);
2. add("Center", component);
3. add(x, y, component);
4. set(component);
Correct Answer : 1
Your Answer : 3
QuestionID : 10458 Subject Name Enterprise Java
Q8. Interface "connection" helps to manage connection between java &
database
Correct Answer : T
Your Answer : F
QuestionID : 10809 Subject Name Enterprise Java
Q9. What are different scope values for the < jsp:usebean >
[Link]
[Link]
[Link]
[Link]
1. i,ii,iv
2. ii,iii
3. iii,iv
4. only ii
Correct Answer : 1
Your Answer : 3
QuestionID : 12791 Subject Name Enterprise Java
Q10. The implementation for the Enterprise is in the following :
1. Remote interface
2. Home interface
3. Enterprise Bean class
4. None of the above
Correct Answer : 3
Your Answer : 2
QuestionID : 12793 Subject Name Enterprise Java
Q11. The stateful session in a session bean interface declares the ____
method(s).
1. ejbRemove
2. ejbActivate
3. setSessionContext
4. All of the above
Correct Answer : 4
Your Answer : 3
QuestionID : 12794 Subject Name Enterprise Java
Q12. Introspection only works on
1. objects
2. source code
3. events
4. none of the above
Correct Answer : 1
Your Answer : 4
QuestionID : 12805 Subject Name Enterprise Java
Q13. RMI objects are stored as
1. DLL
2. EXE
3. Bytecodes
4. None of the above
Correct Answer : 3
Your Answer :
QuestionID : 12817 Subject Name Enterprise Java
Q14. The signatures of the ejbCreate methods must meet the following
requirement(s)
1. The access return type must be void
2. The modifier cannot be static or final
3. Arguments must be legal types for java RMI
4. all of the above
Correct Answer : 4
Your Answer :
QuestionID : 12834 Subject Name Enterprise Java
Q15. Identify the Deployment Descriptor element name and syntax that
declares Servlet Context Initilisation parameters.
1. < context-parameters >
< param-name >Parameter Name< /param-name >
< param-value >Parameter Value< /param-value >
< /context-parameters >
2. < init-param >
< param-name >Parameter Name< /param-name >
< param-value >Parameter Value< /param-value >
< /init-param>
3. < context-param >
< param-value >Parameter Name< /param-value >
< param-name >Parameter Value< /param-name >
< context-param >
4. None of these
Correct Answer : 4
Your Answer :
QuestionID : 12838 Subject Name Enterprise Java
Q16. getLastModified method belongs to which interface ?
1. Servlet Interface
2. HttpServlet Interface
3. Generic Servlet
4. HttpServletRequest
Correct Answer : 2
Your Answer :
QuestionID : 12844 Subject Name Enterprise Java
Q17. Identify the correct statements
1. < error-page >
< exception-type >< error-code >404< /error-code >< /exception-type >
< location >/[Link]< /location >

2. < error-page >


< exception-type >[Link]< /exception-type >
< /error-page >
3. < error-page >
< error-code >404< /error-code >
< location >[Link]< /location >
< /error-page >
4. None of these
Correct Answer : 4
Your Answer :
QuestionID : 12853 Subject Name Enterprise Java
Q18. Which of the following is legal JSP syntax to print the value of i.
1. < %int i = 1;% >
< %= i; % >
2. < %int i = 1;
i; % >
3. < %int i = 1% >
< %= i % >
4. < %int i = 1;% >
< %= i % >
Correct Answer : 4
Your Answer :
QuestionID : 12856 Subject Name Enterprise Java
Q19. Which of the following correctly represents the following JSP
statement.
< %=x% >
1. < jsp:expression=x/ >
2. < jsp:expression >x< /jsp:expression >
3. < jsp:statement >x< /jsp:statement >
4. < jsp:scriptlet >x< /jsp:scriptlet >
Correct Answer : 2
Your Answer :
QuestionID : 12860 Subject Name Enterprise Java
Q20. What gets printed when the following JSP code is invoked in a
browser?
< %= if([Link]() < 0.5) % >
hello
< %= } else { % >
hi
< %= } % >
1. The browser will print either hello or hi based upon the return value of
random.
2. The string hello will always get printed.
3. The string hi will always get printed.
4. The JSP file will not compile.
Correct Answer : 4
Your Answer :
QuestionID : 12875 Subject Name Enterprise Java
Q21. Which of the following represents a correct syntax for usebean.
1. < jsp:usebean id="fruit scope ="page"/ >
2. < jsp:usebean id="fruit class="Fruit" beanName="Fruit"/ >
3. < jsp:usebean id="fruit type ="String" beanName="Fruit"/ >
4. All of the Above.
Correct Answer : 3
Your Answer :
QuestionID : 12886 Subject Name Enterprise Java
Q22. JSP pages have access to implicit objects that are exposed
automatically. One such object that is available is request. The request object
is an instance of which class?
1. HttpServletRequest
2. ServletRequest
3. HttpSessionRequest
4. HttpRequest
Correct Answer : 1
Your Answer :
QuestionID : 12887 Subject Name Enterprise Java
Q23. JSP pages have access to implicit objects that are exposed
automatically. Name the implicit object that is of type HttpSession.
1. httpSession
2. session
3. HttpSession
4. Session
Correct Answer : 2
Your Answer :
QuestionID : 12890 Subject Name Enterprise Java
Q24. The page directive is used to convey information about the page to JSP
container. Which of these is legal syntax of page directive.
1. < % page info="test page" % >
2. < %@ page isThreadSafe=true % >
3. < %@ page session="true" % >
4. < %@ page isErrorPage="[Link]" % >
Correct Answer : 3
Your Answer :
QuestionID : 12891 Subject Name Enterprise Java
Q25. Is the following JSP code legal?
< %@page info="test page" session="false"% >
< %@page session="false"% >
1. Yes. This is legal JSP syntax.
2. No. This code will generate syntax errors.
3. null
4. null
Correct Answer : 2
Your Answer :
QuestionID : 12930 Subject Name Enterprise Java
Q26. To send text outptut in a response, the following method of
HttpServletResponse may be used to get the appropriate Writer/Stream
object.
1. getStream
2. getOutputStream
3. getBinaryStream
4. getWriter
Correct Answer : 4
Your Answer :
QuestionID : 13005 Subject Name Enterprise Java
Q27. The contents of tag handler class MyPage. are
package tags;
import [Link].*;
import [Link].*;
import [Link].*;
import [Link].*;
public class MyPage extends BodyTagSupport
{
int k=10;
public int doStartTag() throws JspException
{
return EVAL_BODY_INCLUDE;
}
public int doAfterBody() throws JspException
{
if(k < 13)
{
k++;
return EVAL_BODY_TAG;
}
return SKIP_BODY;
}
public int doEndTag() throws JspException
{
return EVAL_PAGE;
}
}
The contents of tag library descriptor [Link] are:
< taglib >
< tag >
< name >mypage< /name >
< tagclass >[Link]< /tagclass >
< bodycontent >JSP< /bodycontent >
< /tag >
< /taglib >
The contents of jsp file are
< HTML >
< HEAD >
< %@ taglib uri="[Link]" prefix="abhishek"% >
< /head >
< abhishek:mypage >
< %="Hello"% >
< /abhishek:mypage >
< /html >
On executing jsp file guess Hello would be printed how many times
1. Not even Once
2. Once
3. Twice
4. Four
Correct Answer : 4
Your Answer :
QuestionID : 13035 Subject Name Enterprise Java
Q28. Which of the following are true with respect to sendRedirect method of
HttpServletResponse?
1. Path can be only relative
2. To support clients without redirect capability, method writes a short
response body that contains a hyperlink to the new location
3. Must be called after response is committed else throws
IllegalStateException
4. None
Correct Answer : 2
Your Answer :
QuestionID : 13050 Subject Name Enterprise Java
Q29. Which of the following methods can be invoked on the EntityContext
from
inside the ejbActivate() method of an entity bean class
1. getPrimaryKey(),getEJBObject()
2. getCallerPrincipal()
3. getRollbackOnly()
4. isCallerinRole()
Correct Answer : 1
Your Answer :
QuestionID : 13289 Subject Name Enterprise Java
Q30. Which of the following are true about an enterprise bean according to
the EJB 2.0
spec
1. A bean cannot use Java. net. Socket
2. A bean instance variable cannot be declared static and final
3. A bean cannot listen on a socket as a server
4. none of the above
Correct Answer : 3
Your Answer :
QuestionID : 13354 Subject Name Enterprise Java
Q31. Which of the following statements are true about session beans
1. You must declare a no-argument create ( ) method both in the home
interface and the component interface of a stateless session bean
2. You must write a no-argument remove ( ) method in both the remote
home
interface and the remote component interface of a session bean
3. A stateless session bean does not need a create ( ) method because the
container creates the scateless session bean instances without any call from
the client
4. None of the above
Correct Answer : 4
Your Answer :
QuestionID : 13362 Subject Name Enterprise Java
Q32. Which of the following are the bean providers responsibility in the case
of a session bean
1. To declare the no-argument remove ( ) method in the home interface
2. To implement the methods of the EJBObj ect interface
3. To make sure the business methods declared in the component
interface are
neither final nor static
4. None of the above
Correct Answer : 3
Your Answer :
QuestionID : 13390 Subject Name Enterprise Java
Q33. Which of the following statements are correct about a session bean
whose class
contains the following method? public void ejbCreate (String id)
1. It is a stateful session bean
2. The component interface ofthe bean has the method ejbCreate (String
id) declared in it
3. None of the above
4. all of the above
Correct Answer : 1
Your Answer :
QuestionID : 13485 Subject Name Enterprise Java
Q34. Which of the following are valid declarations for the business methods
in the class
of a session bean
1. public void ejbSetDiscount (float number)
2. public void setDiscount (float number) throws
RemoteException
3. public static void setDiscount (float number)
4. public void setDiscount()
Correct Answer : 4
Your Answer :
QuestionID : 13489 Subject Name Enterprise Java
Q35. getInitParameterNames method returns names of the context`s
initialization parameters as Enumeration of String objects
Correct Answer : T
Your Answer :
QuestionID : 13532 Subject Name Enterprise Java
Q36. The contents of [Link] are
< html >
< form method=post action=[Link] >
Name< input type=text name="name" >
< input type=submit value=click >
< /form >

The contents for abhishekServlet are


import [Link].*;
import [Link].*;
import [Link].*;
public class abhishekServlet extends HttpServlet
{
public void doGet(HttpServletRequest req,HttpServletResponse res) throws
IOException,ServletException
{
PrintWriter out=[Link]();
[Link]("Name is "+[Link]("name"));
}
}
Suppose that user enters name as Abhishek,
Select the correct output generated
1. Prints Name is Abhishek
2. Prints Name is null
3. gives compilation error
4. Prints Name is
Correct Answer : 3
Your Answer :
QuestionID : 13798 Subject Name Enterprise Java
Q37. Which of the following are possibly valid tags in defining the type of a
CMR field
in a deployment descriptor
1. < cmr-field-type > Java .util. List < /cmr-field-type >
2. < cmr-field-type > [Link] < /cmr-field-fcype >
3. < cmr-field-type > [Link] .Collection < /cmr-field-
type >
4. < cmr-field > [Link] < /cmr-£ield >
Correct Answer : 3
Your Answer :
QuestionID : 13800 Subject Name Enterprise Java
Q38. Which of the following statements are true about an entity bean that
uses container-
managed persistence and relaionships
1. It can have a relationship that involves only one other bean and Its class
must be declared abstract by the bean provider
2. It can have a relationship that involves many other beans
3. It can have a relationship with only a session bean
4. None of the above
Correct Answer : 1
Your Answer :
QuestionID : 15272 Subject Name Enterprise Java
Q39.
Clients can use session beans as agents for accessing entity beans. Which of t
he following is NOT an advantage of doing this?
1. Reduces network traffic and connections
2. Any changes in the entity beans do not require changes to the client
3. Limits the no of stubs used by the client
4. Can model data in the database as objects
Correct Answer : 4
Your Answer :
QuestionID : 15303 Subject Name Enterprise Java
Q40.
What design pattern is similar to the Publish/Subscribe messaging model?
1. Publisher pattern.
2. Flyweight pattern.
3. Observer pattern.
4. Chain of Responsibility pattern.
Correct Answer : 3
Your Answer :
QuestionID : 15313 Subject Name Enterprise Java
Q41. Does a 3–
Tier architecture have the potential to introduce any new problems?
1. Reduced performance
2. Reduced separation of business logic
3. Single point of failure
4. Poor manageability
Correct Answer : 4
Your Answer :
QuestionID : 15314 Subject Name Enterprise Java
Q42.
What will happen if a transactional client invokes an enterprise Bean method
whose transaction attribute is set to `Never` within a transaction context ?
1. TransactionRequiredException is thrown to the client.
2. TransactionNotSupportedException is thrown to the client.
3. Transaction is suspended till the bean method is completed.
4. RemoteException is thrown to the client.
Correct Answer : 4
Your Answer :
QuestionID : 15663 Subject Name Enterprise Java
Q43. Which of the following describes the correct sequence of the steps
involved in making a connection with a database.
1. Loading the driver
2. Process the results.
3. Making the connection with the database.
4. Executing the SQL statements.
1. 1,2,3,4
2. 1,3,4,2
3. 1,4,2,3
4. 4,1,2,3
Correct Answer : 2
Your Answer :
QuestionID : 15823 Subject Name Enterprise Java
Q44. Which of these is true about deployment descriptors. Select the
one correct answer.
1. The order of elements in deployment descriptor is important. The
elements must follow a specific order.
2. The elements of deployment descriptor are case insensitive.
3. The servlet-mapping element, if defined, must be included within the
servlet element
4. The web-app element must include the servlet element.
Correct Answer : 1
Your Answer :
QuestionID : 15830 Subject Name Enterprise Java
Q45. An enterprise bean may set up a timer notification using the
TimerServices createTimer method. Such timer notification may occur
1. After a specified duration
2. At a specified time
3. On a recurring basis
4. All of the above
Correct Answer : 4
Your Answer :
QuestionID : 15886 Subject Name Enterprise Java
Q46. If servlet needs to handle all requests like get, post etc, .......service
method should be used init method
1. Is called Only once in the life cycle of servlet
2. Gets called per request.
3. Doesn’t get called if one servlet is calling other servlet.
4. Is used for one time initialization of class level variables.
Correct Answer : 1
Your Answer :
QuestionID : 15889 Subject Name Enterprise Java
Q47. If we use [Link](true) then
1. Every time this statement gets executed new session is created.
2. It should be called from init to avoid creation of new session
3. Returns the current session associated with this request, or if the
request does not have a session, creates one.
4. Returns the current session associated with this request, or if the
request does not have a session, throws exception.
Correct Answer : 3
Your Answer :
QuestionID : 15899 Subject Name Enterprise Java
Q48. Introspection is used for
1. Discovering a component during component’s execution
2. Reading and understanding bean code
3. Drag and drop feature from GUI
4. Can’t be used for Java beans
Correct Answer : 1
Your Answer :
QuestionID : 15900 Subject Name Enterprise Java
Q49. Which of the following is the base Java Server Page class?
1. [Link]
2. [Link]
3. [Link]
4. None of the above
Correct Answer : 1
Your Answer :
QuestionID : 15901 Subject Name Enterprise Java
Q50. Object Serialization indicates
1. Writing into stream where definition and Current State of object can be
preserved
2. Writing into stream where definition and current state of object cannot
be preserved
3. Writing object only to File
4. Bean cannot be sending on net
Correct Answer : 1
Your Answer :

You might also like