Advanced Java Programming (3160707) MCQs

MCQs of Servlet API and Overview

Showing 11 to 20 out of 57 Questions
11.
What kind of task can performed after destroy() is executed?
(a) To close database connection
(b) To give end response to client
(c) To delete all the cookies
(d) To commit all the records
Answer:

Option (a)

12.
Parameters are encrypted in ______ method.
(a) doGet()
(b) doPost()
(c) doPut()
(d) doDelete()
Answer:

Option (b)

13.
Maximum size of data that can be sent using doGet() is?
(a) 240 bytes
(b) 1024 bytes
(c) 128 bytes
(d) 2048 bytes
Answer:

Option (a)

14.
Which exceptions are thrown by init()?
(a) ServletException
(b) IOExecption
(c) both A & B
(d) only A
Answer:

Option (c)

15.
______ provides an interface between the container and servlet.
(a) ServletConfig
(b) ServletContext
(c) ServletRequest
(d) ServletResponse
Answer:

Option (b)

16.
______ controls the behaviour of Java Servlet.
(a) ServletConfig
(b) ServletContext
(c) Servlet Interface
(d) web.xml
Answer:

Option (d)

17.
Which package is required while writing a servlet code?
(a) java.servlet.http
(b) javax.servlet.http
(c) java.Generic.Http
(d) javax.generic.http
Answer:

Option (b)

18.
Following are the difference between applet and servlet. Find the true one.
i) Applet executes on browser while servlet executes on webserver.
ii) Applets are GUI based while servlets are not.
iii) Applets are dynamic in nature while servlets are static in nature.
iv) Applets are multithreaded while servlet can handle only one thread at a time.
(a) i),ii) and iv) are true
(b) i) and ii) are true
(c) i) and iv) are true
(d) only i) is true
Answer:

Option (b)

19.
Which of the following code retrieves the body of the request as binary data?
(a) DataInputStream data = new InputStream()
(b) DataInputStream data = response.getInputStream()
(c) DataInputStream data = request.getInputStream()
(d) DataInputStream data = request.fetchInputStream()
Answer:

Option (c)

20.
Which of the following is true about servlets?
(a) Servlets execute within the address space of web server
(b) Servlets are platform-independent because they are written in java
(c) Servlets can use the full functionality of the Java class libraries
(d) All of these.
Answer:

Option (d)

Showing 11 to 20 out of 57 Questions