Tag: web technology

Questions Related to web technology

  1. Use the method 'HttpServletRequest.getParameterNames()' which will return an enumeration of parameter names.

  2. Use the method 'HttpServletResponse.getParameterNames()' which will return an enumeration of parameter names.

  3. Use the method 'HttpServletRequest.getAllParameters()' which will return an enumeration of parameter names.

  4. There is no direct support in the Servlet API to retrieve the name of all the parameters sent by the client.


Correct Option: A
  1. The value of the 'test' variable will be 2.

  2. The value of the 'test' variable will be 0.

  3. The value of the 'test' variable will be 1.

  4. The variable 'test' must be declared at global scope, else a run-time error will occur


Correct Option: C
  1. out.println(config.getServletContext().getParameter("app-name")); out.println(config.getInitParameter("app-name"));

  2. out.println(config.getInitParameter("app-name")); out.println(config.getServletContext().getInitParameter("app-name"));

  3. out.println(config.getServletContext().getInitParameter("app-name")); out.println(config.getInitParameter("app-name"));

  4. out.println(config.getServletContext().getInitParameter("app-name")); out.println(config.getParameter("app-name"));


Correct Option: C
  1. ${request.getAttribute()}

  2. ${request.attribute}

  3. ${pageContext.request.getAttribute()}

  4. ${pageContext.request.attribute}


Correct Option: D
  1. Use the method 'HttpServletRequest.getParameterNames()' which will return an enumeration of parameter names.

  2. Use the method 'HttpServletResponse.getParameterNames()' which will return an enumeration of parameter names.

  3. Use the method 'HttpServletRequest.getAllParameters()' which will return an enumeration of parameter names.

  4. There is no direct support in the Servlet API to retrieve the name of all the parameters sent by the client.


Correct Option: A
  1. ${request.getAttribute()}

  2. ${request.attribute}

  3. ${pageContext.request.getAttribute()}

  4. ${pageContext.request.attribute}


Correct Option: D
  1. The value of the 'test' variable will be 2.

  2. The value of the 'test' variable will be 0.

  3. The value of the 'test' variable will be 1.

  4. The variable 'test' must be declared at global scope, else a run-time error will occur


Correct Option: C
  1. The Servlet will output 'javabeat null' in the Server Console.

  2. The Servlet will fail to load as the init param property 'no-name' is not mentioned in the deployment descriptor

  3. A NullPointerException will be raised as calling getServletConfig() in the init() method will return a null reference.

  4. The Servlet will output 'javabeat ' in the Server Console.


Correct Option: A