This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes couple mock exam questions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "couple mock exam questions" Watch "couple mock exam questions" New topic

couple mock exam questions

Yan Zhou
Ranch Hand

Joined: Sep 02, 2003
Posts: 137
<%! int i; %> is a variable declaration that has object scope within the servlet.

I suppose that this is true.

But what is difference from object scope vs. class scope? The term object scope is new to me. I guess object scope means instance, and class scope means class variables like statics. is that right?


<%= "Hello " + userName %>

the answer says that this is an example of jsp Expression.
I suppose this is also an example of scriptlet since scriptlet includes expressions, is that right?


Servlets that implement the SingleThreadModel cannot share a
single HttpSession Object accross multiple servlets.

the answer says that this is false. But I think this is a true statement.

I did not understand this, SingleThreadModel guarantees one single thread per Servlet, but there may be more than one thread as long as there are multiple servlets. If so, HttpSession is not protected against that.

Victor Santos
Ranch Hand

Joined: Jan 12, 2004
Posts: 31
On first question you are right about class vs instance variable .
On second you are too . Expression is a scriptlet .
On third , the container can intantiate more than none servlet if the servlet implements SingleThreadModel . A client makes a request and a Session is created with a sessionId that will de send back to the client . on second request the client send the sessionId back and the container checks if there is a Session with the sessionId .
I think that helps
I agree. Here's the link:
subject: couple mock exam questions