Connie Ky Leung

Ranch Hand
+ Follow
since Jan 29, 2006
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Connie Ky Leung

I passed SCWCD 6 exam today with 80%, I was hoping for a higher score but a pass is a pass. Therefore, I should be happy.

I originally prepared for SCWCD 5 but switched to SCWCD 6 track in September. The transition was seamless because new knowledge could be obtained by reading Servlet 3.0 spec.

I used the following aids to pass the exam:

1) HFSJ 2nd edition
2) Read Servlet 3.0 spec twice
3) Did the mock exams of Niko
4) Did the Null Haus servlet 3.0 examinations three times.
5) The mock exam simulator of Ethuware.


My real exam score is 10% lower than my test scores in Enthuware. I generally scored between 86% and 88% in the standard tests but I knew I was in trouble when exam asked <c:forToken>.

7 years ago


This mock exam question is from javachampion.com.
The output is 1 1 2
Can someone explain how the result is produced?
I don't know how to trace it on paper.

Thanks,

Connie



Henry Wong wrote:
First please QuoteYourSources -- which mock exam did this come from?

Connie KY Leung wrote:
I don't get why one statement causes compilation error and the other returns a boolean value. Can someone explain it to me please?



In the second case, where false was returned -- it is basically because the compiler could not determine, in a guaranteed manner, that an instance of Individual is not an instance of Colorable.

By just looking at the code, you can argue that the compiler is just being stupid -- and I would agree. But here is why it is allowed... It is possible for a class to extend Individual that implements Colorable, and hence, possible that a class that IS-A both Individual and Colorable. From the way the code is written, it's not possible for the comparison, but the compiler isn't that smart.

Henry



Source updated in the original post. Thanks.


The mock exam is from JavaChampion.com, question 8 of Inheritance test. I deleted some lines that are irrelevant to my question.

I did wrong in the above mock exam question. When I executed the program in eclipse, I got more confused than before.
If right operand is a class and the object is not in the same inheritance tree, compilation error occurs. I understand this part.
If right operand is an interface and the object does not implement the interface, no compilation error occurs and the program prints out "false".

I don't get why one statement causes compilation error and the other returns a boolean value. Can someone explain it to me please?

Thanks,

Connie



I downloaded the mock exam engine of Mughal book for SCJP 1.6. When I tried to execute the jar file, ExceptionInInitializerError is thrown.

Can anyone tell what I did wrong?

It means the session never times out.

Originally posted by Srikanth shetty Nukala:
Hi found this question in several mocks,

so need clarification.

URL is : http://server:8080/AppName/Abc/Servlet?param1=value1¶m2=value2

so what is the context path, servlet path and path info for these URL's?

Thanks.





Context path is AppName

If directory match is performed against the servlet, then servlet path is ABC and path info is Servlet.

If exact match is performed against the servlet, then servlet path is ABC/Servlet and path info is null.

Please correct me if I am wrong.
The question in JavaRanch targes Servlet spec 2.3. In 2.3, <listener> must appear before <servlet> element in deployment descriptor. As of 2.4, the order of <servlet> and <listener> does not matter.
The +20% rule is applied to your score obtained HFSJ final mock exam. It means your score in the real exam is usually 20% higher than your score in HFSJ final mock exam. In your case, your exam score will be at least 76% if everything goes as expected

Hope this helps ease your mind going to the exam.

Originally posted by Richard Rex:
Hi,

Where does exactly in deployment descriptor is the

<jsp-config>
<jsp-property-group>
<url-pattern>*.jsp</url-pattern>
<scripting-invalid>true</scripting-invalid>
</jsp-property-group>
</jsp-config>

be located?

Also, for <context-param> tags? I tried placing them before or after servlet configuration and mapping and it both worked in either position. Is the order of the tags really matters here?



<jsp-config> element is located at web.xml
The order of <filter-mapping> and <listener> tags matters in the deployment descripter.

Originally posted by Felipe Pittella:
Hi,

I got a litlle confused with some issues reagrding "IF" and "FC".

1 - What is the best pattern for "authentication" and "authorization" issues?

2- What is teh best pattern for validing request params?

Tks.

cya



1) If the logic of authentication and authorization is common for all or a lot of servlets in a web application, then you should encapsulate the logic in a filter class. I had a question in similar context during the exam, I chose Intercepting Filter pattern and was marked correct.

2) I will say Front Controller because Strut allows developer to define a form bean to validate request parameters and then forward the request to appropriate page based on the result of the validation.

Please correct me if I am wrong.

Originally posted by Felipe Pittella:
Hi,

I got this question:

Which of the following are invalid uses of the <c:set> action? (Choose three.)

1- <c:set scope="page">value</c:set>
2- <c:set value="value" var="${myVar}" />
3- <c:set var="myVar" scope="${scope}">value</c:set>
4- <c:set target="${myTarget}" property="myProp">propValue</c:set>

5- <c:set value="${myVal}" target="myTarget" property="${myProp}" />

With the following answer for the 5th option:

"5 is also valid syntax. Value, target, and property are set as attributes, with the values for value and property coming from EL expressions, which is legal."

i guess it�s wrong.

1- "property" attribute does NOT take a "request-time expresion".
2- IT�s MANDATORY for "target" attribute to be a request-time expression.

am i wrong?

Tks;




After going over JSTL specification and HFSJ regarding <c:set>, I believe the answers to this question are 1,2, 3 and 5.

5 is invalid because the value of target is a string literal. Its value is EL expression, <%= %> or <jsp:attribute> that evaluats to a Map object or a Java bean.

Please correct me if I am wrong.
I have them on my exam too. One is a multiple choice question and the other is a task question.
For Q22, option D is not JSP code , it is code written in Java language