Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Wrapper Q - JDiscuss - Wrong Answer Given Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Wrapper Q - JDiscuss - Wrong Answer Given" Watch "Wrapper Q - JDiscuss - Wrong Answer Given" New topic

Wrapper Q - JDiscuss - Wrong Answer Given

Vishnu Prakash
Ranch Hand

Joined: Nov 15, 2004
Posts: 1026

What will happen if it is run with the following command line:
java Parser one

Select 1 correct option.

1.It will print 'Problem in 0'
2.It will throw an exception and end without printing anything.
3.It will not even compile.
4.It will not print anything if the argument is '1' instead of 'one'.
5.None of the above.

Answer given is: option 5

Correct answer is: option 1


Servlet Spec 2.4/ Jsp Spec 2.0/ JSTL Spec 1.1 - JSTL Tag Documentation
Satish Chilukuri
Ranch Hand

Joined: Jun 23, 2005
Posts: 266
When you are in doubt the best thing to do is to compile the code and execute it yourself. The output you get is **THE** correct answer regardless of the what the test answer might say.

Coming to the question, the answer is neither option 1 nor option 5. It is option 3. The variable i is not visible to the catch block.
Vishnu Prakash
Ranch Hand

Joined: Nov 15, 2004
Posts: 1026
Thanks satish
latha yeduguri

Joined: Jun 24, 2005
Posts: 17
It won't even compile as it can't recognize the variable i.
Nicky Eng
Ranch Hand

Joined: Mar 26, 2005
Posts: 378
wont compile due to the reason variable i .

From NickyEng
Diploma in Computer Studies
SCJP 1.4
Formula 1 app by Maxis (Playbook)
I agree. Here's the link:
subject: Wrapper Q - JDiscuss - Wrong Answer Given
Similar Threads
Problem with Conversion
JDiscuss Test5 Question
Enthuware question
just a problem....H E L P ! ! ! !