Servlets - Advanced Java Test
1) In which advantage of servlet, Servlets are managed by JVM so no need to worry about memory leak, garbage collection etc.?
A) Better performance
B) Portability
C) Robust
D) Secure
View Answer / Hide Answer2) In the following statements identify the disadvantages of CGI?
A) If number of clients increases, it takes more time for sending response
B) For each request, it starts a process and Web server is limited to start processes
C) It uses platform dependent language e.g. C, C++, perl
D) All mentioned above
View Answer / Hide AnswerANSWER: D) All mentioned above
3) Servlet technology is used to create web application?
A) True
B) False
View Answer / Hide Answer4) In HTTP Request Which Asks for the loopback of the request message, for testing or troubleshooting?
A) PUT
B) OPTIONS
C) DELETE
D) TRACE
View Answer / Hide Answer5) In HTTP Request method Get request is secured because data is exposed in URL bar?
A) True
B) False
View Answer / Hide Answer6) In the HTTP Request method which is non-idempotent?
A) GET
B) POST
C) BOTH A & B
D) None of the above
View Answer / Hide Answer7) Give the examples of Application Server from the following?
A) Apache
B) Tomcat
C) JBoss
D) Weblogic
E) Both C & D
View Answer / Hide Answer8) Abbreviate the term MIME?
A) Multilevel internet Mail Extension
B) Multipurpose internet Mail Extension
C) Multiuse information Mail Extension
D) None of the above
View Answer / Hide AnswerANSWER: B) Multipurpose internet Mail Extension
9) Which packages represent interfaces and classes for servlet API?
A) javax.servlet
B) javax.servlet.http
C) Both A & B
D) None of the above
View Answer / Hide Answer10) The web container maintains the life cycle of a servlet instance,give the lifecycle of a servlet?
A) Servlet class is loaded
B) Servlet instance is created
C) init,Service,destroy method is invoked
D) All mentioned above
View Answer / Hide AnswerANSWER: D) All mentioned above
11) The sendRedirect() method of HttpServletResponse interface can be used to redirect response to another resource, it may be servlet, jsp or html file?
A) True
B) False
View Answer / Hide Answer12) In RequestDispacher which method is used to sends the same request and response objects to another servlet?
A) forward()
B) sendRedirect()
C) Both A & B
D) None of the above
View Answer / Hide Answer13) An object of Which is created by the web container at time of deploying the project?
A) ServletConfig
B) ServletContext
C) Both A & B
D) None of the above
View Answer / Hide AnswerANSWER: B) ServletContext
14) An attribute in servlet is an object that can be set, get or removed from one of the following scopes?
A) session scope
B) request scope
C) application scope
D) All mentioned above
View Answer / Hide AnswerANSWER: D) All mentioned above
15) How many techniques are used in Session Tracking?
A) 4
B) 3
C) 2
D) 5
View Answer / Hide Answer16) Which cookie it is valid for single session only; it is removed each time when user closes the browser?
A) Persistent cookie
B) Non-persistent cookie
C) Both A & B
D) None of the above
View Answer / Hide AnswerANSWER: B) Non-persistent cookie
17) Which object of HttpSession can be used to view and manipulate information about a session, such as the?
A) session identifier
B) creation time
C) last accessed time
D) All mentioned above
View Answer / Hide AnswerANSWER: D) All mentioned above
18) Which methods are used to bind the objects on HttpSession instance and get the objects?
A) setAttribute
B) getAttribute
C) Both A & B
D) None of the above
View Answer / Hide Answer19) Which class provides stream to read binary data such as image etc. from the request object?
A) ServltInputStream
B) ServletOutputStream
C) Both A & B
D) None of the above
View Answer / Hide AnswerANSWER: A) ServltInputStream
20) These methods doGet(),doPost(),doHead,doDelete(),deTrace() are used in?
A) Genereic Servlets
B) HttpServlets
C) Both A & B
D) None of the above
View Answer / Hide Answer21) Sessions is a part of the SessionTracking and it is for maintaining the client state at server side?
A) True
B) False
View Answer / Hide Answer22) In Session tracking which method 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?
A) HttpSession
B) URL rewriting
C) Cookies
D) Hidden form fields
View Answer / Hide Answer23) Using mail API we cannot send mail from a servlet?
A) True
B) False
View Answer / Hide Answer24) Servlets handle multiple simultaneous requests by using threads?
A) True
B) False
View Answer / Hide Answer25) Which type of ServletEngine is a server that includes built-in support for servlets?
A) Add-on ServletEngine
B) Embedded ServletEngine
C) Standalone ServletEngine
D) None of the above
View Answer / Hide AnswerANSWER: C) Standalone ServletEngine
26) Connection Pooling Class manages no of user requests for connections to improve the performance?
A) True
B) False
View Answer / Hide Answer27) Which of these ways used to communicate from an applet to servlet?
A) RMI Communication
B) HTTP Communication
C) Socket Communication
D) All mentioned above
View Answer / Hide AnswerANSWER: D) All mentioned above
28) Web server is used for loading the init() method of servlet?
A) True
B) False
View Answer / Hide Answer29) Which class can handle any type of request so it is protocol-independent?
A) GenericServlet
B) HttpServlet
C) Both A & B
D) None of the above
View Answer / Hide AnswerANSWER: A) GenericServlet
30) In Servlet Terminology what provides runtime environment for JavaEE (j2ee) applications. It performs many operations that are given below:
1. Life Cycle Management
2. Multithreaded support
3. Object Pooling
4. Security etc.
A) Server
B) Webserver
C) Container
D) Application Server
View Answer / Hide Answer