GoConqr has a new look! Let us know what you think.

Quiz

Questões - Practice Test 1 ( OCWCD Certification )

Luis Felipe Guariento 57 questions

Take the quiz

Questions in this quiz (57)

  1. 1Identify the statements regarding CGI.
    1. ACGI programs are plataform dependent while Servlet are not
    2. BSevlet code is more secure than CGI
    3. CWith traditional CGI, a new process is started for each HTTP request while for Servlets a single instance serves multiple requests in different threads.
    4. DAll of above
    5. EOnly A
    6. FOnly B
    7. GOnly C
  2. 2The ProcessLoanApplication uses the following code for its business logic:

    public class ProcessLoanApplication extends HttpServlet
    {
    public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
    {
    try
    {
    //Connect to database and do the business operations
    //XXXXXXXXXXX
    }
    catch(SQLException e)
    {
    throw new ServletException(e);
    }
    }
    }

    This Servlet is configured in a web application with the following descriptor:

    <web-app>
    <error-page>
    <exception-type>java.sql.SQLException</exception-type>
    <location>/erros/DBErrorMessage.html</location>
    </error-page>
    <web-app>

    Which of the following is the behavior of the application when the database connection fails with an SQLException at the code XXXXXXXXXXX?
    1. AThe application gets redirected to the DBErrorMessage.html
    2. BThe container sends a response to the browser with the status code as 500.
    3. CThe application fails to deploy as the deployment descriptor contains a invalide element
    4. DNone of the options
  3. 3Given a following JSP page:

    <html>
    <body>
    HELLO <br>
    <%
    for (int k=0;k<2;k++)
    {
    %>
    out.print("welcome"+k);
    <%
    }
    %>
    </body>
    </html>

    What will be generated when the above JSP page is accessed?
    1. AHELLO welcome0welcome1
    2. BHELLO
    3. CHELLO out.print("welcome"+k); out.print("welcome"+k);
    4. DHELLO out.print("welcome"1); out.print("welcome"2);
  4. 4In case of Model View Controller (MVC) design pattern, which component plays the following roles?
    Renders the models
    Sends user gestures to controller
    Allow controller to select view
    Requests updates from models
    1. Amodel
    2. Bview
    3. Ccontroller
    4. DIntercepting filter
  5. 5While declaring an EL function in a Tag Library Description (TLD), which of the following entities need to be specified as a fully qualified names?
    1. Aclass name
    2. Bargument types
    3. Creturn type
    4. DAll of the above
    5. ENone of the above
  6. 6Consider the Servlet and JSP code below. Which of the given choices (when placed at //XXX position) will achieve
    the functionlity described below?

    On invoking the Servlet as http://localhost:8080/servlet/AskMeServlet?exam=SCWCD, "Yes, its easier than SCJP!" should be printed.
    Assume that the JSP and Servlet are placed in their respective directories on the web server.

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

    public class AskMeServlet extends HttpServlet
    {
    public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
    {
    res.setContentType("text/html");
    //XXX
    }
    }

    //Answer.jsp
    <html>
    <body>
    Yes, it's easier than SCJP!
    </body>
    </html>
    1. Aif(req.getParameter("exam").equals("SCWCD")){res.sendRedirect("../Answer.jsp");}
    2. Bif(req.getParameter("exam").equals("SCWCD")){res.forward("../Answer.jsp");}
    3. Cif(req.getParameter("exam").equals("SCWCD")){res.Redirect("../Answer.jsp");}
    4. Dif(req.getParameter("exam").equals("SCWCD")){req.Redirect("../Answer.jsp");}
    5. Eif(req.getParameter("exam").equals("SCWCD")){req.forward("../Answer.jsp");}
    6. Fif(req.getParameter("exam").equals("SCWCD")){req.sendRedirect("../Answer.jsp");}
  7. 7if you want to apply Model View Controller (MVC) design pattern on a web application, which of the following will be the role most suited for a Java Server Page (JSP)?
    1. AModel
    2. BView
    3. CController
    4. DNone of the options
  8. 8Which of the following method is considered to be non idempotent by the HTTP 1.1 specification?
    1. APOST
    2. BHEAD
    3. CCHOICES
    4. DGET
    5. EDELETE
    6. FPUT
  9. 9Consider the following HTML form. It accepts the user's name in a text input field, and has a submit button.

    //HelloByName.html

    <html>
    <body>
    <form action="/servlet/HelloByName">
    What's your name?<input type="text" name="name">
    <p><input type="SUBMIT"/>
    </form>
    </body>
    </html>

    The following is the servlet invoked when the submit button of the form is clicked -
    //HelloByName.java

    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class HelloByName extends HttpServlet
    {
    public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
    {
    res.setContentType("text/html");
    String name=req.getParameter("name");
    PrintWriter out = res.getWriter();
    out.println("<HTML>");
    out.println("<body>");
    out.println("Hello "+name+", I am the doGet method!!");
    out.println("</body>");
    out.println("</HTML>");
    }
    public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
    {
    res.setContentType("text/html");
    String name=req.getParameter("name");
    PrintWriter out = res.getWriter();
    out.println("<HTML>");
    out.println("<body>");
    out.println("I am the doPost method! I don't feel the need to say hello to you. "+name+" is a funny name in any case!");
    out.println("</body>");
    out.println("</HTML>");
    }

    What will be displayed in the browser when a name, say "Alfred", is entered in the text field on the form, and the submit button is clicked?
    1. AAn HTML page displaying "Hello, Alfred, I am the doGet method!!"
    2. BAn HTML page displaying "I am the doPost method! I don't feel the need to say hello to you. Alfred is a funny name in any case!
    3. CCompile Time Error
    4. DA blank HTML page
  10. 10Which of the following ensure that the session never gets invalidated automatically? ( Select four choices )
    1. AInvoke HttpSession.setMaxInactiveInterval(0)
    2. BInvoke HttpSession.setMaxInactiveInterval(-1)
    3. CInvoke HttpSession.setSessionTimeOut(0)
    4. DSpecify a value of -1 for element in the the deployment descriptor
    5. EInvoke HttpSession.setSessionTimeOut(-1)
    6. FSpecify a value of 0 for element in the the deployment descriptor

Information

Description
Concursos Públicos Desenvolvimento de Software (OCEJWCD 6 ONLINE COURSE) Quiz on Questões - Practice Test 1 ( OCWCD Certification ), created by Luis Felipe Guariento on 26/05/2018.
Language
Português
Views
0
Rating
No ratings yet
Rate this quiz
Rate this quiz

Feedback

What is it about?

What do you think of the new look?

How do you like it?