| 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
|
 |
 |
|
|
subject: Mock Exam Doubts
|
|
|