The document contains 5 sample questions about implementing the single thread model in servlets and JSPs. The single thread model ensures that only one request is processed at a time by a servlet or JSP, making instance variables thread-safe. To make a servlet single threaded, implement the SingleThreadModel interface or add a configuration in web.xml. For JSPs and tag files, use page directives like <%@ page threadSafe="true" %>.
1 of 12
Download to read offline
More Related Content
5 sample questions about Single Thread Model (Cx 310 083)
2. Tems of use
You may use this document for your own purpose only if you leave the document as is.
息 Copyright 2010 Prolector.
For more information please visit http://www.prolector.nl
2
3. Question 1:
Which of the following statements is true about the Single Thread Model?
A The single Thread model applies to servlets and JSP's.
B The single Thread model applies to only JSP's.
C It is possible that two different requests can be served at the same time by the
servlet container
D The single thread model is a recommended programming model when you need to
make sure that you can access your servlet instance variables in a threadsafe way
3
4. Question 1:
Which of the following statements is true about the Single Thread Model?
A The single Thread model applies to servlets and JSP's.
B The single Thread model applies to only JSP's.
C It is possible that two different requests can be served at the same time by the
servlet container
D The single thread model is a recommended programming model when you need to
make sure that you can access your servlet instance variables in a threadsafe way
4
5. Question 2:
Which of the following statements is true when you make a servlet thread safe?
A Implement the interface javax.servlet.SingleThreadModel
B javax.servlet.http.SingleThreadModel
C javax.servlet.jsp.SingleThreadModel
D You need to add the element <single-thread>true</single-thread> in the servlet
mapping in de web.xml
5
6. Question 2:
Which of the following statements is true when you make a servlet thread safe?
A Implement the interface javax.servlet.SingleThreadModel
B javax.servlet.http.SingleThreadModel
C javax.servlet.jsp.SingleThreadModel
D You need to add the element <single-thread>true</single-thread> in the servlet
mapping in de web.xml
6
7. Question 3:
Which of the following statements is true if you make a jsp thread safe?
A Implement the interface javax.servlet.SingleThreadModel
B <%@ page threadSafe="true" %>
C <%@ page isThreadSafe="true" %>
D You can not make a JSP thread safe
7
8. Question 3:
Which of the following statements is true if you make a jsp thread safe?
A Implement the interface javax.servlet.SingleThreadModel
B <%@ page threadSafe="true" %>
C <%@ page isThreadSafe="true" %>
D You can not make a JSP thread safe
8
9. Question 4:
Which of the following statements is true if you make a tag file thread safe?
A Implement the interface javax.servlet.SingleThreadModel
B <%@ tag threadSafe="true" %>
C <%@ tag isThreadSafe="true" %>
D You can not make a tag file thread safe
9
10. Question 4:
Which of the following statements is true if you make a tag file thread safe?
A Implement the interface javax.servlet.SingleThreadModel
B <%@ tag threadSafe="true" %>
C <%@ tag isThreadSafe="true" %>
D You can not make a tag file thread safe
10
11. Question 5:
How many methods should you implement when implementing the interface
javax.servlet.SingleThreadModel ?
A 0
B 1
C 2
D 3
E 4
11
12. Question 5:
How many methods should you implement when implementing the interface
javax.servlet.SingleThreadModel ?
A 0
B 1
C 2
D 3
E 4
12