Jsp-intermédiaire

Approved & Edited by ProProfs Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By Anis ZOUAOUI
A
Anis ZOUAOUI
Community Contributor
Quizzes Created: 2 | Total Attempts: 897
Questions: 7 | Attempts: 512

SettingsSettingsSettings
Jsp-intermédiaire - Quiz

Questions and Answers
  • 1. 

    What is true about MIME type?

    • A.

      It tells the browser what type of data browser will send

    • B.

      It tells the browser what type of data browser will receive

    • C.

      It tells the server what type of data server will receive

    • D.

      It tells the server what type of data server will send

    Correct Answer
    B. It tells the browser what type of data browser will receive
    Explanation
    The MIME type is a standardized way to indicate the type of data that is being sent over the internet. In this case, the correct answer states that the MIME type tells the browser what type of data it will receive. This means that the MIME type is used by the server to inform the browser about the format or structure of the data being sent, allowing the browser to interpret and display the data correctly.

    Rate this question:

  • 2. 

    Which tag doesn't belongs to web.xml?

    • A.

      Web-app

    • B.

      Welcome-file-list

    • C.

      Servlet

    • D.

      Servlet-mappings

    Correct Answer
    D. Servlet-mappings
    Explanation
    The tag "servlet-mappings" does not belong to web.xml. The web.xml file is used in Java web applications to configure the deployment settings and mappings for servlets. It includes tags such as "web-app" to define the web application, "welcome-file-list" to specify the default page, and "servlet" to define servlets. However, "servlet-mappings" is not a valid tag in web.xml.

    Rate this question:

  • 3. 

    Which is the life-cycle procedure?

    • A.

      Constructor call=>class loading=>init()=>service()=>destroy()

    • B.

      Constructor call=>class loading=>init()=>service()=>destroy()

    • C.

      Class loading=>constructor call=>init()=>service()=>destroy()

    • D.

      Constructor call=>class loading=>service()=>init()=>destroy()

    Correct Answer
    C. Class loading=>constructor call=>init()=>service()=>destroy()
    Explanation
    The correct answer is "class loading => constructor call => init() => service() => destroy()". This sequence represents the life-cycle procedure in which a class is loaded, the constructor is called, the init() method is invoked, followed by the service() method, and finally the destroy() method.

    Rate this question:

  • 4. 

    Which statement is not true about ServletContext?

    • A.

      There is one ServletContext per one application

    • B.

      Generally it is used to get web app parameters

    • C.

      We can get Server Information though it

    • D.

      There is one ServletContext per one servlet

    Correct Answer
    D. There is one ServletContext per one servlet
    Explanation
    The statement "There is one ServletContext per one servlet" is not true about ServletContext. ServletContext is a web application's execution environment and there is only one instance of ServletContext per web application, not per servlet. It provides a way to share data and communicate between servlets and other components within the same web application.

    Rate this question:

  • 5. 

    What is the meaning of response.setIntHeader("xyz" ,67); ?

    • A.

      Add a new header with integer value

    • B.

      Replace the value to integer to existing header

    • C.

      Replace the value to integer to existing header or Add a new header with integer value

    • D.

      Always add a new header

    Correct Answer
    C. Replace the value to integer to existing header or Add a new header with integer value
    Explanation
    The method response.setIntHeader("xyz", 67) is used to set the value of a header named "xyz" to the integer value 67. This method will either replace the existing value of the header if it already exists, or add a new header with the integer value if it doesn't exist.

    Rate this question:

  • 6. 

    Through which tag you can define servlet config  in web.xml?

    • A.

      Config-param

    • B.

      Context-param

    • C.

      Init-param

    • D.

      None

    Correct Answer
    C. Init-param
    Explanation
    The correct answer is "init-param". In the web.xml file, the "init-param" tag is used to define configuration parameters for a servlet. These parameters can be accessed by the servlet using the getInitParameter() method. The "config-param" tag does not exist in the web.xml specification, making it an incorrect option. The "context-param" tag is used to define configuration parameters for the entire web application, not for a specific servlet. Therefore, it is also an incorrect option. The option "None" is not a valid tag to define servlet config in web.xml.

    Rate this question:

  • 7. 

    How the web-application get servlet context ?

    • A.

      GetServletContext().getServletConfig().getInitParameter()

    • B.

      GetServletConfig().getInitParameter()

    • C.

      This.getServletConfig().getInitParameter()

    • D.

      All of these

    Correct Answer
    D. All of these
    Explanation
    All of these options can be used to obtain the servlet context in a web application. The getServletContext() method returns the ServletContext object, which can be used to access various resources and information about the application. The getServletConfig() method returns the ServletConfig object, which can also be used to access the servlet context. The this.getServletConfig() is another way to access the ServletConfig object. Therefore, all of these options are valid ways to obtain the servlet context in a web application.

    Rate this question:

Quiz Review Timeline +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Jul 22, 2024
    Quiz Edited by
    ProProfs Editorial Team
  • Dec 29, 2015
    Quiz Created by
    Anis ZOUAOUI
Back to Top Back to top
Advertisement