Servlets - Advanced Java Test

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 Answer

ANSWER: C) Robust




2) 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 Answer

ANSWER: D) All mentioned above




3) Servlet technology is used to create web application?

A) True
B) False
View Answer / Hide Answer

ANSWER: A) True




4) 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 Answer

ANSWER: D) TRACE




5) In HTTP Request method Get request is secured because data is exposed in URL bar?

A) True
B) False
View Answer / Hide Answer

ANSWER: B) False




6) 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 Answer

ANSWER: B) POST




7) Give the examples of Application Server from the following?

A) Apache
B) Tomcat
C) JBoss
D) Weblogic
E) Both C & D
View Answer / Hide Answer

ANSWER: E) Both C & D




8) 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 Answer

ANSWER: 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 Answer

ANSWER: C) Both A & B




10) 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 Answer

ANSWER: 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 Answer

ANSWER: A) True




12) 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 Answer

ANSWER: A) forward()




13) 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 Answer

ANSWER: 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 Answer

ANSWER: D) All mentioned above




15) How many techniques are used in Session Tracking?

A) 4
B) 3
C) 2
D) 5
View Answer / Hide Answer

ANSWER: A) 4




16) 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 Answer

ANSWER: 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 Answer

ANSWER: 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 Answer

ANSWER: C) Both A & B




19) 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 Answer

ANSWER: 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 Answer

ANSWER: B) HttpServlets




21) 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 Answer

ANSWER: A) True




22) 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 Answer

ANSWER: C) Cookies




23) Using mail API we cannot send mail from a servlet?

A) True
B) False
View Answer / Hide Answer

ANSWER: B) False




24) Servlets handle multiple simultaneous requests by using threads?

A) True
B) False
View Answer / Hide Answer

ANSWER: A) True




25) 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 Answer

ANSWER: 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 Answer

ANSWER: A) True




27) 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 Answer

ANSWER: D) All mentioned above




28) Web server is used for loading the init() method of servlet?

A) True
B) False
View Answer / Hide Answer

ANSWER: A) True




29) 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 Answer

ANSWER: 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

ANSWER: C) Container



Post your comment

    Discussion

  • RE: Servlets - Advanced Java Test -nag (01/30/15)
  • it helped me a very lot
  • RE: Servlets - Advanced Java Test -arjun (09/02/14)
  • this is the good and also give me explanation please.

You may like