wood burning stoves 2.0*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes some questions on J2EE test Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "some questions on J2EE test" Watch "some questions on J2EE test" New topic
Author

some questions on J2EE test

kathy Tsui
Greenhorn

Joined: Oct 08, 2004
Posts: 2
There may be up to three correct answers to the following questions. I'm not sure aboout them and come here to get your help.

1. if the business logic of an existing application is implemented using a set of CGI programs, which of the following Java
technologies can be used to implement the CGI programs as a Java-based solution?
A. Servlets
B. Enterprise JavaBeans
C. Screen Scrapers
D. JMAPI
E. CORBA

2. In the doPost() method of a servlet below, assuming that getNameFromDB() returns NULL. Which of the following
statements are correct?

public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
PrintWriter out=response.getWriter();
out.println("Hello, ");
out.flush();
String name = getNameFromDB();
if(name==null) {
response.sendError(HttpServletResponse.SC_NOT_FOUND, "Unable to get name");
}
out.println(name);
}

A. It will throw an IllegalStateException
B. It will throw a NullPointerException while serving a request
C. It will throw an InvalidStateException while serving a request.
D. It will throw a ServletException while serving a request.
E. It will not throw any exception.

3. Assume that the subcontexts com and com/sams already exist in the JNDI directory. Upon excuting the "try"
blocks below, which of the following events will result?

try{
Context ctx=new InitialContext();
ctx.createSubContext("com/sams/book");
}
catch(NamingException exe){
System.err.println(exe);
....
}
A. The context com/sams/book and the subcontext sams/book are automatically created.
B. The context com/sams/book is suscessfully created.
C. The contet com/sams/book is created and the subcontext sams/com/book are automatically created.
D. NameAlreadyBoundException is thrown.
E. No changes occur in the directory system.

For question 1, I think answer is A; question 2, I don't know how the servlet get commited. I checked its API. it is said that if the Servlet is already commited, sendError() would throw IllegalStateException. For question 3, my answer is B.

Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: some questions on J2EE test
 
Similar Threads
error invalid column name
sendRedirect ( qsn from Study kit)
doubt in Exam Kit Book
response commitment
sendError