Match the following interfaces of Java. Servlet package :…

2014

Match the following interfaces of Java. Servlet package :

\(\begin{array}{clcl} & \textbf{List – I} && \textbf{List – II}\\ \text{a.}& \text{Servlet config} & \text{i} & \text{Enables Servlets to log events} \\ \text{b.}& \text{Servlet Context} & \text{ii.} & \text{Read data from a client} \\ \text{c.} & \text{Servlet Request} & \text{iii.} & \text{Write data to a client } \\ \text{d.} & \text{Servlet Response } & \text{iv.} & \text{To get initialization parameters}\\ \end{array}\)

Codes :

  1. A.

    a-iii, b-iv, c-ii, d-i

  2. B.

    a-iii, b-ii, c-iv, d-i

  3. C.

    a-ii, b-iii, c-iv, d-i

  4. D.

    a-iv, b-i, c-ii, d-iii

Attempted by 231 students.

Show answer & explanation

Correct answer: D

Correct matching:

  • ServletConfig → To get initialization parameters. Use methods like getInitParameter("name").

  • ServletContext → Enables servlets to log events and share application-level information (methods include log(...), getAttribute(...), setAttribute(...)).

  • ServletRequest → Read data from a client (use getParameter(...), getInputStream(), or getReader()).

  • ServletResponse → Write data to a client (use getWriter() for text or getOutputStream() for binary data).

Thus the correct mapping is: a → iv, b → i, c → ii, d → iii.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Nta Ugc Net Paper 2

Loading lesson…