MCQ Bank
What will you do if two servers are running on the same system with same port number?
- A) Delete the server.xml file of both servers
- B) Assign unique port to each server
- C) Two servers can’t run simultaneously
- D) Servers can run with same port
The destroy() method is called only once at the _________ of the life cycle of a servlet.
- A) end
- B) both start and end
- C) middle
- D) start
The _________ method simply creates or loads some data that will be used throughout the life of the servlet.
- A) servlet()
- B) init()
- C) loads()
- D) creates()
There is/are ServletContext object(s) per web application.
- A) 2
- B) 3
- C) 1
- D) 4
A servlet life cycle can be defined as the entire process from its creation till the ___________.
- A) constructor
- B) destruction
- C) initialization
- D) construction
The servlet calls ____________ method to process a client's request.
- A) init()
- B) service()
- C) start()
- D) request()
A GET request results from a normal request for a URL or from an HTML form that has no METHOD specified and it should be handled by _______ method.
- A) doPost()
- B) post()
- C) get()
- D) doGet()
The init method is designed to be called ____________.
- A) twice
- B) only once
- C) many times
- D) thrice
The RequestDispatcher interface provides the facility of dispatching the request to another resource it may be ___________.
- A) Servlet Only
- B) Any of HTML, JSP or Servlet
- C) HTML Only
- D) JSP Only
_________ is the protocol that allows web servers and browsers to exchange data over the web.
- A) JAXB
- B) XML
- C) HTTP
- D) Servlet
How many methods are defined in RequestDispatcher interface?
- A) 4
- B) 1
- C) 2
- D) 3
A POST request results from an HTML form that specifically lists POST as the METHOD and it should be handled by _____________ method.
- A) doGet()
- B) get()
- C) doPost()
- D) post()
For compiling the Servlet, ________ file is required to be loaded.
- A) jar
- B) pdf
- C) html
- D) xml
The servlet is terminated by calling the ______________ method.
- A) servlet()
- B) terminate()
- C) end()
- D) destroy()
The servlet is initialized by calling the __________ method.
- A) destroy()
- B) servlet()
- C) init ()
- D) service()
Which of the following is not a benefit of Servlet?
- A) Low Performance
- B) Secure
- C) Robust
- D) Portable
The servlet container loads the servlet before invoking the ___________ method.
- A) doPost
- B) init()
- C) service()
- D) doGet()
Creating war file has an advantage that moving the project from one location to another takes _____ time.
- A) Correct time as required
- B) Less
- C) More
- D) Some extra time
Which of the following is used to request data from a server?
- A) DTD
- B) XMLHttpRequest object
- C) XLink
- D) XML Schema
Node object can have ________________.
- A) only one parent node object.
- B) only two parent node objects.
- C) many parent node objects.
- D) any number of parent node objects.