Take as many assements as you can to improve your validate your skill rating
Total Questions: 15
1. In which file do we define a servlet mapping ?
Correct Answer is : web.xml
2. which of the following URLs will correctly request the Servlet ?
Correct Answer is : http://www.mywebapp.com/secureapp/do/Login?name="bob"
3. Servlets and JavaServer Pages have become so popular that they are now supported directly or with third-party plug-ins by most major Web servers and application servers.
Correct Answer is : TRUE
4. All servlets must implement the Servlet interface of package:
Correct Answer is : javax.servlet
5. A get request gets information from a client. A post request posts data to a client.
Correct Answer is : FALSE
6. How constructor can be used for a servlet?
Correct Answer is : Initialization and Constructor function
7. Can servlet class declare constructor with ServletConfig object as an argument?
Correct Answer is : FALSE
8. Which of the following code is used to get an attribute in a HTTP Session object in servlets?
Correct Answer is : session.getAttribute(String name)
9. Which method is used to get three-letter abbreviation for locale’s country in servlets?
Correct Answer is : Request.getISO3Country()
10. Which of the following code retrieves the body of the request as binary data?
Correct Answer is : DataInputStream data = request.getInputStream()
11. When destroy() method of a filter is called?
Correct Answer is : The destroy() method is called only once at the end of the life cycle of a filter
12. Which of the following is true about servlets?
Correct Answer is : Servlets execute within the address space of web server, platform independent and uses the functionality of java class libraries
13. How is the dynamic interception of requests and responses to transform the information done?
Correct Answer is : servlet filter
14. 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
Correct Answer is : i, ii, iv, v
15. 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