Q.1.

The JDBC APIs provided by Sun are all concrete classes?

  1. True
  2. False

Q.2.

The code below will compile and run, if c is a valid Connection resource.

1: try {
2:   Connection c = ...
3:   String procedure = "{call sp_intrest[(?)]}";
4:   CallableStatement statement = c.prepareCall( procedure );
5:   statement.execute();
6:   c.commit();
7: } catch (Exception e) {
8:   e.printStackTrace();
9: }

  1. True
  2. False

Q.3.

When you want to send character data to the client. Which method can you use to obtain a writer?

Q.4.

Given:
<web-app>
<init-param>
<param-name>Friend</param-name>
<param-value>Carl</param-value>
</init-param>
</web-app>

Which class and method can be used to get the value of Friend?

  1. HttpServlet, getInitParameter()
  2. Servlet, getInitParameter()
  3. ServletContext, getInitParameter()
  4. HttpServletRequest, getParameter()

Q.5.

Which of the following statements immediately invalidate(s) HttpSession?

  1. session.invalidate();
  2. session.setMaxInactiveInterval(-1);
  3. session.setMaxInactiveInterval(0);

Q.6.

What is the relative file path of the deployment descriptor?

A../META-INF/web.xml

B../web.xml

C../WEB-INF/web.xml

D../WEB-INF/classes/web.xml

E../myapplication/WEB-INF/web.xml

Q.7.

Assuming the web-application is properly configured with perfect web.xml , what will be the output of the following code?

……

public class MyServlet extends HttpServlet

{

PrintWriter out=resp.getWriter();

out.println(“Hello world”);

}

  1. will print “Hello world ” on console
  2. will throw Exception
  3. will give compile-time-error
  4. will not print anything
  5. will print “Hello world” on browser.

Q.8.

If your class extends HttpServlet, you have to implement either doGet or doPost methods only, you cannot implement the service method.

  1. True
  2. False