Quiz PPAW

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

Quiz 1.

1. Suppose you want to know each time request comes in, so that you can log it. Which listener is
appropriate for that?

ServletRequestListener

2. If you want to know when a request attribute has removed, added or replace, then which listener is the
appropriate one?

ServletRequestAttributeListener

3. Which listener should use to find context has been created or destroyed?

ServletContextListener

4. How can we get context init parameter and run some code before rest of the application can service a
client?

ServletContextListener

5. Which of these are common mechanisms used for session tracking?

Cookies

6. If you want to track active session or how many users are there? So which lsitener you should use.

HttpSessionListener

7. What are the true sentences about Session-Id?

Session-IDs are usually stored in the cookies, URLs and hidden fields of Web pages.

A session-ID is an unique identification

It is transmitted between the client and the server

All of these (raspuns corect)

8. You have an attribute class, and you want object of this type should be notified when they are bound to
or removed from a session. So which listener is appropriate one?

HttpSessionBindingListener

9. Which Listener you should use, when you want to know session attribute has added, removed or
replaced?

HttpSessionAttributeListener

10. In which of these getAttribute() and setAttribute() method is not defined?

ServletConfig

Quiz 2.

1. How can we make existing session be invalidated?


Using session.invalidate()
2. Which of these are common mechanisms used for session tracking?

Cookies

3. What are the true sentences about Session-Id?


Session-IDs are usually stored in the cookies, URLs and hidden fields of Web pages.
A session-ID is an unique identification
It is transmitted between the client and the server
All of these (raspuns corect)
4. What are the correct statemnets about filter?

It checks security

It modifies the request or response

It is used for Logging and auditing

All of these (raspuns corect)

5. Servlet interface contains LifeCycle methods. True or false?

True

6. When we should use doPost() method? Choose the incorrect option

If your application should be faster

7. Which of these protocols are supported by HttpServlet?

http/Https

8. What are the new features added in Servlet 2.5?

Support for annotations

Severlt web.xml cnoveniences

Loading the class

All of these (raspuns corect)

9. Which of these statements are not true about GenericServlets?

Generic Servlet extends HttpServlet and override doGet() method

10. Which statement is true about HttpServlet?

This is an abstract class

HttpServlet extends GenericServlet and adds support for doGet(), doPost()

Service method defined here only take http specific request

Service method defined here only take http specific request

All of these (raspuns corect)

Quiz 3.

1. The Web server that executes the servlet creates an ...... object and passes this to the servlet’s
service method (which, in turn, passes it to doGet() or doPost()).

HttpServletRequest

2. A get request gets information from a client. A post request posts data to a client.

False

3. Which of the following describe ways that dynamic information can be made available to a request
sent to an application

Store the information in a HttpSession


4. Servlets and JavaServer Pages have become so popular that they are now supported directly third-
party plug-ins by most major Web servers and application servers.

True

5. The client can access the servlet only if the servlet is installed on a ...... that can response servlet
requests.

Server

6. Java Networking Java 1.1 natively supports which of the following protocols:

TCP, UDP, SMB

Rasp: 1 only

7. Which of the following URLs will correctly request the Servlet?

http://www...../secureapp/do/Login?name=”bob”

8. In which file do we define a servlet mapping?

Web.xml

9. All servlets must implement the Servlet interface of package:

Javax.servlet

10. Which statement is true about a non-static inner class?

It must implement an interface.

Quiz 4.

1. Which of the following is NOT true about servlets?

They are a mechanism used by the class loader to download applets.

2. Parameters are passed as .... pairs in a get request.

Name/value

3. The servlet initialization parameters are specified in the ... deployment descriptor file as part of a
servlet element.

Web.xml

4. Which of the following identifies the correct method a servlet developer should use to retrieve form
data from the client provided to the doPost() method?

Get Bytes() against the HttpServletRequest object

5. If you delete a field form a class and recompile the class, but then load an object that was seralised
before the new class was compiled what will happen?

The new object will contain all the data it used to including the removed field

6. Using relative paths to reference resources in the same context root makes your Web application
more flexible.

True

7. What is the servlet?

Server side program


8. What type of diagram does a Java Architect frequently produce?

Attribute diagram

9. Java Threads Which of the following can you do with the synchronized keyword:

Synchronise on an object

Synchronise on a static method

Synchronise around code that exists in a method of an instance of an object

Rasp: 1 and 2 only

10. Which of the following can be used to store client side user state information while avoiding any
impact due to the users web browser configuration?

HttpSessions

RESTful server – returnează un obiect

You might also like