File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes nikojava Mock question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "nikojava Mock question" Watch "nikojava Mock question" New topic
Author

nikojava Mock question

Dieter Quickfend
Bartender

Joined: Aug 06, 2010
Posts: 543
    
    4

It's question #22 from niko's servlet mock listed in the scwcdmocks section of this site.
The question goes as follows:

What happens when this servlet is compiled and deployed? (1 correct answer)


1. Compilation fails because doGet() is protected.
2. Compilation fails because doGet() does not declare a ServletException.
3. Deployment succeeds and clients are served just fine.


My answer was 2, but the answers list 3 as the correct answer. However, I've checked the API, and doGet throws ServletException, which is a checked exception and no subclass of IOException, so it should be 2, shouldn't it?


Oracle Certified Professional: Java SE 6 Programmer && Oracle Certified Expert: (JEE 6 Web Component Developer && JEE 6 EJB Developer)
Dieter Quickfend
Bartender

Joined: Aug 06, 2010
Posts: 543
    
    4

Also, question #27:

Does this servlet compile successfully? (1 correct answer)
1. Compilation succeeds.
2. There is a compilation error at line #1.
3. There is a compilation error at line #2.
4. Both lines #1 and #2 contain a compilation error.

My answer was 3, 'cause println() is a void method, but the answer listed as the correct one is 4.. That's not right, is it? IOException and ServletException are both subclasses of Exception, so Exception will catch either, no?
Dieter Quickfend
Bartender

Joined: Aug 06, 2010
Posts: 543
    
    4

never mind this. It appears that in all my wrong answers (I got like 12 wrong answers), it is actually the answer listing that is mistaken. That is so confusing.

Anyone have any other, more reliable, mock exams? I really want to do some more mocks before taking my SCWCD, but I don't want to have to pay for them... Already did the Inquisition ones, and the ones from the book...
Nidhi Sar
Ranch Hand

Joined: Oct 19, 2009
Posts: 252

Dieter,

Are you sure the answers are wrong? Both answers seem right to me. Remember in Java, the overriding method can narrow exceptions (hence the first one is right) but cannot broaden exceptions (hence the second one is right).

- Nidhi


"A problem well stated is a problem half solved.” - Charles F. Kettering
SCJP 6, OCPJWCD
Frits Walraven
Creator of Enthuware JWS+ V6
Bartender

Joined: Apr 07, 2010
Posts: 1734
    
  25

Hi Dieter,

I agree with Nidhi on both answers and explanations.

There ar a lot of free mock exams, but the quality is not always good and not to mention about the outdated questions. The one (commercial) mock exam product that will for sure make you pass the exam is the one of Enthuware. The level of difficulty and the way questions are asked is simular to the real exam.....

Regards,
Frits
Dieter Quickfend
Bartender

Joined: Aug 06, 2010
Posts: 543
    
    4

Argh, you're right. Extremely sorry. I should get some more sleep. Thank you!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: nikojava Mock question