Question - 1
How do you get the IP address of the client in servlet?
get.getRemoteAddr()
request.getRemoteAddr()
request.getRemoteip()
None of the above
Show Answer
Solutions
Answer- B
Question - 2
Which method is used to specify before any lines that uses the PintWriter?
setPageType()
setContextType()
setContentType()
setResponseType()
Show Answer
Solutions
Answer- C
Question - 3
What are the functions of Servlet container?
Lifecycle management
Communication support
Multithreading support
All the above
Show Answer
Solutions
Answer- D
Question - 4
Which of the following is true about servlets?
Servlets execute within the address space of web server
Servlets are platform-independent because they are written in java
Servlets can use the full functionality of the Java class libraries
Servlets execute within the address space of web server, platform independent and uses the functionality of java class libraries
Show Answer
Solutions
Answer- D
Question - 5
What is the full form of JSP?
Java servlet program
Java server pages
Java server pages
Java server program
Show Answer
Solutions
Answer- B
Question - 6
Which JDBC driver Type(s) can be used in either applet or servlet code?
Both Type 1 and Type 2
Both Type 1 and Type 3
Both Type 3 and Type 4
Type 4 only
Show Answer
Solutions
Answer- C
Question - 7
Which of the following code retrieves the MIME type of the body of the request?
new MimeType()
request.getContentType()
response.getContentType()
None of the above
Show Answer
Solutions
Answer- B
Question - 8
Which methods are used to bind the objects on HttpSession instance and get the objects?
setAttribute
getAttribute
Both A & B
None of the above
Show Answer
Solutions
Answer- C
Question - 9
Which JDBC driver Type(s) is(are) the JDBC-ODBC bridge?
Type 1
Type 2
Type 3
Type 4
Show Answer
Solutions
Answer- A
Question - 10
How many JDBC driver types does Sun define?
Answer- D
Question - 11
What is javax.servlet.http.HttpServlet
interface
abstract class
concreate class
None of the above
Show Answer
Solutions
Answer- B
Question - 12
Which of the following code is used to set the session timeout in servlets?
session.setMaxInactiveInterval(interval)
response.setMaxInactiveInterval(interval)
request.setMaxInactiveInterval(interval)
None of the above.
Show Answer
Solutions
Answer- A
Question - 13
Which class provides stream to read binary data such as image etc. from the request object?
ServltInputStream
ServletOutputStream
Both A & B
None of the above
Show Answer
Solutions
Answer- A
Question - 14
Which of these ways used to communicate from an applet to servlet?
RMI Communication
HTTP Communication
Socket Communication
All mentioned above
Show Answer
Solutions
Answer- D
Question - 15
Which method is used to send the same request and response objects to another servlet in RequestDispacher ?
forward()
sendRedirect()
Both A & B
None of the above
Show Answer
Solutions
Answer- A
Question - 16
Which HTTP Request method is non-idempotent?
GET
POST
BOTH A & B
None of the above
Show Answer
Solutions
Answer- B
Question - 17
How is the dynamic interception of requests and responses to transform the information done?
servlet container
servlet config
servlet context
servlet filter
Show Answer
Solutions
Answer- D
Question - 18
Which of the following code is used to get an attribute in a HTTP Session object in servlets?
session.getAttribute(String name)
session.alterAttribute(String name)
session.updateAttribute(String name)
session.setAttribute(String name)
Show Answer
Solutions
Answer- A
Question - 19
Which of the following code encodes the specified URL by including the session ID in it?
response.encodeURL(url)
request.encodeURL(url)
Header.encodeURL(url)
None of the above.
Show Answer
Solutions
Answer- A
Question - 20
Which method in session tracking is used in a bit of information that is sent by a web server to a browser and which can later be read back from that browser?
HttpSession
URL rewriting
Cookies
Hidden form fields
Show Answer
Solutions
Answer- C
Practice more set questions