Hi Folks
Would you give me some inputs to answer the following IBM questions?
When comparing
servlets and JSPs, which of the following are true?
a) JSPs provide better performance than servlets.
b) JSPs may call servlets and servlets may also call JSPs.
c) A
JSP must be compiled into a servlet before it can be used.
d) Initialization and destruction behavior is supported in both servlets and JSPs.
(pick 2 answers)
I pick b and c. But I doubt that both servlets and jsp support initialization and destruction as well. Actually, one of the threads indicates both servlet and jsp have init and destroy. If it is true, please let me know why b or c is an incorrect answer.
Implementing the SingleThreadModel interface :
a) requires all servlet methods be declared as synchronized.
b) guarantees that synchronization problems will never occur.
c) may have a negative impact on performance.
d) prevents multiple HTTP request threads from accessing a single servlet instance concurrently.
Multiple Select - Please select all of the correct answers (this question has 2 correct choices).
I pick c and d. However, I think b is also a correct answer since there is at most one
thread being executed at a time. One reason I don't pick b because
if thread 1 executes and suppends. Thread 2 now can execute and wait for a resource that has been held by thread 1. Then synchronized problem may occur. Please, correct me if my rationale is incorrect.
Thanks in advance