Pex Software Java Developer Test

44 Questions | Total Attempts: 169

SettingsSettingsSettings
Please wait...
Java Quizzes & Trivia

Questions and Answers
  • 1. 
    JSP. What is wrong with this code?AccountingAllocation allocation = new AccountingAllocation("001"); it = allocatedFrom.iterator();while (it.hasNext()) {       if (allocation == null) continue;       System.out.println("Value = " + allocation.getValue()); }
    • A. 

      You can't use continue in a while loop.

    • B. 

      Endless loop because it.next() is missing.

    • C. 

      Never print anything because allocation is always null.

    • D. 

      Allocation.getValue() Could give nullPointerException.

    • E. 

      None of these

  • 2. 
    JSP.  What is wrong with this statement on a JSP page?<%=session.getAttribute("NominalReportTitle");%> 
    • A. 

      You need to delete the ; character

    • B. 

      Use

    • C. 

      Use

    • D. 

      None of them

  • 3. 
    JSP. What is the key difference between using a < jsp:forward > and HttpServletResponse.sendRedirect()?
    • A. 

      Forward executes on the server while sendRedirect() executes on the client.

    • B. 

      Forward executes on the client while sendRedirect() executes on the server.

    • C. 

      The two methods perform identically.

    • D. 

      None of these

  • 4. 
    JSP. When a JSP page is compiled, what is it turned into ?
    • A. 

      Applet

    • B. 

      Servlet

    • C. 

      Application

    • D. 

      Mailet

  • 5. 
    JSP. What is wrong with the following code ? <%if(strPassword.equals("boss")){< jsp:forward page="Welcome.jsp" flush="true" / >}else{}%>
    • A. 

      Unmatched bracket in for statement

    • B. 

      Flush attribute must be false

    • C. 

      Keyword 'file' should be used instead of 'page' in the action

    • D. 

      Actions cannot be used within scriptlet blocks

  • 6. 
    JSP. What is wrong with the following code ?<%Cookie c = new Cookie("UserName", "Alastair Gulland");response.addCookie(c);%>
    • A. 

      Cookie class can not take parameters in it's constructor

    • B. 

      The request object is used for creating cookies

    • C. 

      Although no error will be reported the use of the action means that the response object can't be used to create cookies.

    • D. 

      The action must be placed inside the script block

  • 7. 
    JSP. The < jsp:include /> action can pass parameters to the page which it is including. How does this second page obtain thevalue of these parameters ?
    • A. 

      Using the < jsp:readParam /> action

    • B. 

      Using the < jsp:getParam /> action

    • C. 

      Use the request.getParameter() method

  • 8. 
    JSP. What is the difference between doing an include or a forward with a RequestDispatcher ?
    • A. 

      The two methods provide the same functionality, but with different levels of persistence.

    • B. 

      The forward method is deprecated as of JSP 1.1 and the include method should be used in order to substitute portions of a dynamic display at runtime.

    • C. 

      The include method transfers control to a dynamic resource, while the forward method allows for dynamic substitution of another JPS pages output, returning control to the calling resource.

    • D. 

      He forward method transfers control to the designated resource, while the include method invokes the designated resource, substitutes its output dynamically in the display, and returns control to the calling page.

  • 9. 
    JSP. Choose the statement that best describes the relationship between JSP and servlets:
    • A. 

      Servlets are built on JSP semantics and all servlets are compiled to JSP pages for runtime usage.

    • B. 

      JSP and servlets are unrelated technologies.

    • C. 

      Servlets and JSP are competing technologies for handling web requests. Servlets are being superseded by JSP, which is preferred. The two technologies are not useful in combination.

    • D. 

      JSPs are built on servlet semantics and all JSPs are compiled to servlets for runtime usage.

  • 10. 
    JSP. Which jar file should be mandatory be there in the CLASSPATH for working with Servlet.
    • A. 

      Javax.servlet.*

    • B. 

      Java.servlet.*;

    • C. 

      Javax.servlet.HttpRequest

    • D. 

      Javax.servlet.HttpResponse

  • 11. 
    JSP. Which of the following statements is true regarding the scope of the ‘session’ in JSP?
    • A. 

      Objects with session scope are accessible from pages processing requests that are in the same session as the one in which they were created.

    • B. 

      It is not legal to define an object with session scope from within a page that is not session-aware.

    • C. 

      All references to the object shall be released after the associated session ends.

    • D. 

      References to objects with session scope are stored in the session object associated with the page activation.

    • E. 

      All above

  • 12. 
    JSP. Which packages in the java provide the writing of the Servlet
    • A. 

      Javax

    • B. 

      Java

    • C. 

      Java.io

    • D. 

      Java.lang

  • 13. 
    Some Operating Systems have a limitation on the Max Length of the URL, which are normally _______ characters.
    • A. 

      255

    • B. 

      225

    • C. 

      264

    • D. 

      250

  • 14. 
    JSP. Which of the following statement is true for the tag. (Multiple choice) 
    • A. 

      Can include dynamically generated output.

    • B. 

      Provides benefit of automatic recompilation.

    • C. 

      Can be used to incorporate contents from static documents

    • D. 

      It offers option of sharing local variables and better run time efficiency

  • 15. 
    JSP. Java Server Pages specification includes (Multiple choice) 
    • A. 

      JSP standard directives

    • B. 

      JSP standard actions.

    • C. 

      Script language declarations, scriplets and expressions.

    • D. 

      A portable tag extension mechanism.

  • 16. 
    JSP. Which of the following correctly defines JSP technology 
    • A. 

      JSP page is a text-based document that describes how to process a request to create a response.

    • B. 

      JSP page is a text-based document that describes how to process a to response create a request.

    • C. 

      JSP page is a xml-based document that describes how to process a request to create a response.

    • D. 

      JSP page is a xml-based document that describes how to process a to response create a request.

  • 17. 
    JSP. Which of the following statements is true about the scope of ‘application’ in JSP ?
    • A. 

      Objects with application scope are accessible from pages processing requests that are in the same application as they one in which they were created.

    • B. 

      All references to the object shall be released when the runtime environment reclaims the ServletContext.

    • C. 

      Objects with application scope can be defined (and reached) from pages that are not session-aware

    • D. 

      References to objects with application scope are stored in the application object associated with a page activation

  • 18. 
    JSP. The wrapper function like <%! String blanknull(String s) { return (s == null) ? "" : s; } %> then use it inside your JSP form, like < input type="text" name="shoesize" value="<%=blanknull(shoesize)% >" > prevents the word  _______   from apperaring in an HTML page.
  • 19. 
    JSP. Which of the following points is true regarding the general and selling point of Servlet (Multiple choice)
    • A. 

      A Servlet can handle multiple requests concurrently, and synchronize requests.

    • B. 

      Servlet support systems such as online real-time conferencing.

    • C. 

      Servlet can forward requests to other servers and Servlet.

    • D. 

      Servlet can be used to balance load among several servers that mirror the same content, and to partition a single logical service over xseveral servers, according to task type or organizational boundaries.

  • 20. 
    JSP. Calling of which of the following method causes unpredictable results in the Servlet.
    • A. 

      DoPost()

    • B. 

      DoGet()

    • C. 

      System.out.println()

    • D. 

      System.exit(0);

  • 21. 
    JSP. Request.getServerName () is used to get the name of the server on which the Jsp is running
    • A. 

      True

    • B. 

      False

  • 22. 
    JAVASCRIPT. Inside which HTML element do we put the JavaScript?
    • A. 

      < scripting >

    • B. 

      < javascript >

    • C. 

      < script >

    • D. 

      < js >

  • 23. 
    JAVASCRIPT. What is the correct JavaScript syntax to write "Hello World"?
    • A. 

      response.write("Hello World")

    • B. 

      document.write("Hello World")

    • C. 

      ("Hello World")

    • D. 

      Echo("Hello World")

  • 24. 
    JAVASCRIPT. How do you call a function named "myFunction"?
    • A. 

      Call function myFunction

    • B. 

      MyFunction()

    • C. 

      Call myFunction()

  • 25. 
    JAVASCRIPT. How do you write a conditional statement for executing some statements only if "i" is equal to 5?
    • A. 

      if i==5 then

    • B. 

      if i=5 then

    • C. 

      if (i==5)

    • D. 

      if i=5

Back to Top Back to top