Servlet and Overview
On This Page
This set of Advanced JAVA Multiple Choice Questions & Answers (MCQs) focuses on Servlet and Overview
Q1 | Which HTTP Request method is non-idempotent?
- GET
- POST
- Both A & B
- None of the above
Q2 | Which object is created by the web container at time of deploying the project?
- ServletConfig
- ServletContext
- Both A & B
- None of the above
Q3 | What is the lifecycle of a servlet?
- Servlet class is loaded
- Servlet instance is created
- init,Service,destroy method is invoked
- All mentioned above
Q4 | 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
Q5 | Which are the examples of Application Server?
- Apache
- Tomcat
- JBoss
- Weblogic
Q6 | How many techniques are used in Session Tracking?
- 4
- 3
- 2
- 5
Q7 | In HTTP Request method Get request is secured because data is exposed in URL bar
- True
- False
- none
- all
Q8 | In the following statements identify the disadvantages of CGI?
- If number of clients increases, it takes more time for sending response
- For each request, it starts a process and Web server is limited to start processes
- It uses platform dependent language e.g. C, C++, perl
- All mentioned above
Q9 | Servlet technology is used to create web application
- True
- False
- none
- all
Q10 | Which method is used to specify before any lines that uses the PintWriter?
- setPageType()
- setContextType()
- setContentType()
- setResponseType()
Q11 | What are functions of Servlet container?
- Lifecycle management
- Communication Support
- Multithreading Support
- All of the above
Q12 | Which object of HttpSession can be used to view and manipulate information about asession?
- session identifier
- creation time
- last accessed time
- All mentioned above
Q13 | Which methods are used to bind the objects on HttpSession instance and get the objects?
- setAttribute
- getAttribute
- Both A & B
- None of the above
Q14 | Which method take a string not a URL?
- sendRedirect
- forward
- Both
- None
Q15 | Which of the following are interface? 1. ServletContext 2. Servlet 3. GenericServlet 4. HttpServlet
- 1,2,3,4
- 1,2
- 1,2,3
- 1,4
Q16 | The life cycle of a servlet is managed by
- servlet context
- servlet container
- the supporting protocol (such as http or https)
- All of the above
Q17 | Which of the following code is used to get an attribute in a HTTP Session object inservlets?
- session.getAttribute(String name)
- session.alterAttribute(String name)
- session.updateAttribute(String name)
- session.setAttribute(String name)
Q18 | What is the difference between servlets and applets?i. Servlets execute on Server; Applets execute on browser ii. Servlets have no GUI; Applet has GUI iii. Servlets creates static web pages; Applets creates dynamic web pages iv. Servlets can handle only a single request; Applet can handle multiple requests
- i, ii, iii are correct
- i, ii are correct
- i, iii are correct
- i, ii, iii, iv are correct
Q19 | Which are the session tracking techniques?i. URL rewriting ii. Using session object iii.Using response object iv. Using hidden fields v. Using cookies vi. Using servlet object
- i, ii, iii, vi
- i, ii, iv, v
- i, vi, iii, v
- i, ii, iii, v
Q20 | A deployment descriptor describes
- Web component response settings
- Web component setting
- Web component request objects
- All of the above
Q21 | The values of and in web.xml file
- must be same
- must not be same
- may be same
- None of the above
Q22 | Which one is the correct order of phases in JSP life cycle?
- Initialization, Cleanup, Compilation, Execution
- Initialization, Compilation, Cleanup, Execution
- Compilation, Initialization, Execution, Cleanup
- Cleanup, Compilation, Initialization, Execution
Q23 | Which technology do we mix our business logic with the presentation logic?
- Servlet
- JSP
- Both A and B
- None of the above
Q24 | Which attribute specifies a JSP page that should process any exceptions thrown but not caught in the current page?
- The ErrorPage Attribute
- The IsErrorPage Attribute
- Both A & B
- None of the above
Q25 | The ASP and JSP technologies are quite similar in the way they support the creation of Dynamic pages, using HTML templates, scripting code and components for business logic.
- True
- False
- none
- all