Match the following interfaces of Java. Servlet package \(\begin{array}{clcl} \textbf{List
Duration: 1 min
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 :
- A.
a-iii, b-iv, c-ii, d-i
- B.
a-iii, b-ii, c-iv, d-i
- C.
a-ii, b-iii, c-iv, d-i
- D.
a-iv, b-i, c-ii, d-iii
Attempted by 230 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.