Question
Java/ Please answer all the questions 1. The Tomcat server implements the entire Java EE specication. (a) true (b) false 2. It is possible to
Java/ Please answer all the questions
1. The Tomcat server implements the entire Java EE specication.
(a) true (b) false
2. It is possible to create multiple servlet instances for a servlet in a Java web appli-
cation when necessary.
(a) true (b) false
3. A servlet can have multiple logical names.
(a) true (b) false
4. During a servlet's life cycle, its init() method can be called multiple times.
(a) true (b) false
5. In a Java web application, creating a database connection in the init() method of
a servlet is always a good way to do.
(a) true (b) false
6. When we send binary content in an HTTP request, which of the following parts of
the HTTP request contains the binary content?
(a) the request line (b) the request headers (c) the message body
7. There are only two HTTP methods: GET and POST.
(a) true (b) false
8. Every time a client request arrives, the Container creates a new servlet instance to
process the request.
(a) true (b) false
9. In your web application, the Java classes in which of the following folders will NOT
be loaded into the server automatically? (Assume that [Tomcat] represents your
Tomcat installation directory; and [WebApp] represents the context root of your
web application.)
(a) [Tomcat]/lib (b) [WebApp]/lib (c) [WebApp]/WEB-INF/lib
(d) [WebApp]/WEB-INF/classes
10. How to congure a servlet using an annotation with the URL pattern: /countServlet.
Answer:
11. You can send parameters to a servlet in both the request line and the message body
in one HTTP request.
(a) true (b) false
12. If you want to send large amount of data to a server, which of the following HTTP
methods should you use?
(a) GET (b) POST
13. If you want to let your users bookmark your page with specic set of parameters,
which of the following HTTP methods should you use to request this page?
(a) GET (b) POST
14. If you do not want to allow other people to view the user's sensitive data, which of
the following HTTP methods should you use to send the data?
(a) GET (b) POST
15. Every time a client's request arrives, the Container creates a new servlet instance
to process the request.
(a) true (b) false
16. When you need to upload les from a page, which of the following HTTP methods
should you use to send the data?
(a) GET (b) POST
17. Which of the following data formats should be used when you need to upload les?
(a) application/x-www-form-urlencoded (b) multipart/form-data
18. Which of the following data formats is the default content type for an HTTP re-
quest?
(a) application/x-www-form-urlencoded (b) multipart/form-data
19. What is the default HTTP method?
(a) GET (b) POST
20. The query parameters and the form parameters are retrieved in dierent ways in
your servlets.
(a) true (b) false
21. When we send a set of parameter values using checkboxes to send to a servlet un-
der the same parameter, which of the following methods should we use in the servlet?
(a) getParameter (b) getParameterValues (c) getParameterMap
22. In a Java web application, all the context init parameters can be accessed by all
the servlets in this web applications.
(a) true (b) false
23. Every time when you need to change any context init parameter, you have to re-
compile some of the Java classes in the Java web application.
(a) true (b) false
24. It is possible to change the databases in your web applications without re-compiling
your Java code in your Java web applications.
(a) true (b) false
25. In order to change a servlet's init parameters without recompiling the servlet,
which of the following ways should be used to do the conguration?
(a) in web.xml (b) using annotation
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started