This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Mock Exam Doubts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Mock Exam Doubts" Watch "Mock Exam Doubts" New topic
Author

Mock Exam Doubts

sravanthi pulukuri
Ranch Hand

Joined: Mar 15, 2007
Posts: 125
Given an HttpServletRequest request and an HttpServletResponse response:
1 HttpSession session = null;
2 // insert code here
3 if(session == null) {
4 // do something if session does not exist
5 } else {
6 // do something if session exists
7 }
To implement the design intent, which statement must be inserted at line 42?
A. session = response.getSessionj();
B. session = requset.getSessionj();
C. session = response.getSessionj(true);
D. session = response.getSessionj(false);
E. session = response.getSessionj("jsessionid"););
Answer: D

I Think it should be
request .getSessionj(false);

2.
Given in a single JSP page:
<%@ taglib prefix='java' uri='myTags' %>
<%@ taglib prefix='JAVA' uri='moreTags' %>
Which two are true? (Choose two.)
A. The prefix 'java' is reserved.
B. The URI 'myTags' must be properly mapped to a TLD file by the web container.
C. A translation error occurs because the prefix is considered identical by the web container.
D. For the tag usage <jave:tag1/>, the tag1 must be unique in the union of tag names in 'myTags' and
'moreTags'.
Answer: A, B

Please clarify
Harvinder Thakur
Ranch Hand

Joined: Jun 10, 2008
Posts: 231
Question 1) yes , it should be request.getSession(false); assuming it is line 2 and not 42

Question 2) D is wrong as prefixes act as namespaces or package names as in java classes.
C is wrong as i guess prefixes are case sensitive. Please verify...


thanks
Harvinder
sravanthi pulukuri
Ranch Hand

Joined: Mar 15, 2007
Posts: 125
hi,

Yes even i feel B is the wrong answer.
Harvinder Thakur
Ranch Hand

Joined: Jun 10, 2008
Posts: 231
Sorry B was a typo...... actually i've modified my previous message to change from B to C.

B is correct as you have to specfiy the <uri>myTags</uri> element in the .tld file. This uri then maps to the uri attribute of the taglib directive
Harvinder Thakur
Ranch Hand

Joined: Jun 10, 2008
Posts: 231
Also it is generally nice to mention the source of your mock exam questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Mock Exam Doubts
 
Similar Threads
SCWCD questions
mock exam questions 54 and 61
<taglib> and uri doubt
Exam question errata? help please
HFSJ 2nd edition Mock exam questions 6, 11,26,34,49 and 69