• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

some questions on J2EE test

Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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

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, ");
String name = getNameFromDB();
if(name==null) {
response.sendError(HttpServletResponse.SC_NOT_FOUND, "Unable to get 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?

Context ctx=new InitialContext();
catch(NamingException 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.

In the renaissance, how big were the dinosaurs? Did you have tiny ads?
the value of filler advertising in 2021
    Bookmark Topic Watch Topic
  • New Topic