Sun Certified Web Component Developer for Java 2 Platform Practice Questions

      Next    
Q. No Question
1 Which of the following files is the correct name and location of deployment descriptor of a web application. Assume that the web application is rooted at \doc-root. Select the one correct answer ?
 
  A \doc-root\dd.xml
  B doc-root\web.xml
  C \doc-root\WEB-INF\web.xml
  D \doc-root\WEB_INF\web.xml
  E \doc-root\WEB-INF\classes\web.xml
   
  Answer
2 Which element of the deployment descriptor is used to specify the class of the Servlet. ?
 
  A <servlet-class>
  B <servlet-name>
  C <servlet_name>
  D <servlet_class>
  E <servlet>
   
  Answer
3

Which of the following statements is true regarding MyServlet?

import javax.servlet.*;
import javax.servlet.http.*:
import java.io.*;

public class MyServlet extends HttpServlet implements SingleThreadModel
{
    String myName;

    public void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException  {
    response.setContentType("text/plain");
             PrintWriter out = res.getWriter();
  myName = req.getParameter("name");
  sayHello(out);
  out.close();
    }

   public void sayHello(PrintWriter out)  {
  out.println("Hello " + myName);
   }
}

 
  A MyServlet is thread safe
  B MyServlet is not thread safe because myName is an instance variable
  C MyServlet is not thread safe because MyServlet implements SingleThreadModel.
  D None of the above
   
  Answer
4 Which of the following combinations regarding Design Patterns are correct?
 
  A Business Delegate - Reduces the coupling between presentation-tier clients and business services.
  B Data Access Object - Allows for Multiple Views using the same model
  C MVC - Enables easier migration to different persistence storage implementations.
  D Value Object - Reduces Network Traffic
   
  Answer
5 Which of these is true about deployment descriptors. Select one correct answer.
 
  A The order of elements in deployment descriptor is important. The elements must follow a specific order.
  B The elements of deployment descriptor are not case insensitive
  C The servlet-mapping element, if defined, must be included within the servlet element.
  D The web-app element must include the servlet element
   
  Answer
6 Which element of the deployment descriptor includes the exception-type as a sub-element ?
 
  A <exception>
  B <error-page>
  C <error>
  D <exception_type>
  E <error_page>
   
  Answer
7 Which of these is a correct fragment within the web-app element of deployment descriptor. Select the two correct answer.
 
  A <error-page> <error-code>404</error-code> <location>/error.jsp</location> </error-page>
  B <error-page> <exception-type>mypackage.MyException</exception-type> <error-code>404</error-code> <location>/error.jsp</location> </error-page>
  C <error-page> <exception-type>mypackage.MyException</exception-type> <error-code>404</error-code> </error-page>
  D <error-page> <exception-type>mypackage.MyException</exception-type> <location>/error.jsp</location> </error-page>
   
  Answer
8 Which element of the deployment descriptor of a web application includes the welcome-file-list element as a sub element.
 
  A <welcome>
  B <welcome-files>
  C <list>
  D <web-app>
  E <context>
   
  Answer
9 Which of these is a correct example of specifying a listener element resented by MyClass class. Assume myServlet element is defined correctly. Select one correct answer.
 
  A <listener>MyClass</listener>
  B <listener> <listener-class>MyClass</listener-class></listener>
  C <listener> <listener-name>aListener</listener-name> <listener-class>MyClass</listener-class> </listener>
  D <><listener> <servlet-name>myServlet</servlet-name> <listener-class>MyClass</listener-class> </listener>
   
  Answer
10 Which of the following is legal JSP syntax to print the value of i. Select the one correct answer
 
  A <<%int i = 1;%>
<%= i; %>
  B <%int i = 1;
i; %>
  C <%int i = 1%>
<%= i %>
  D <%int i = 1;%>
<%= i %>
  E <%int i = 1%>
<%= i; %>
   
  Answer
      Next    
 
 
 
Logo
 
All rights reserved.  Terms and Conditions