About Question enthuware.jwpv6.2.1059 :

Moderator: admin

Post Reply
jmkenny
Posts: 8
Joined: Sun Jun 02, 2013 11:04 am
Contact:

About Question enthuware.jwpv6.2.1059 :

Post by jmkenny »

Hi,

I just have a question regarding the correct answer of this question.

Code: Select all

String user = loginUser(req);
You said "Assuming loginUser() and generateReport() are valid methods". This does not guarantees that loginUser(req) will never return null. In this case (returns null), even if the LoginServlet receives a post first, generateReport() will not be executed.

So, unless loginUser() can never return null (which should be mentionned), the answer selected is not always the correct one.

Thanks!

admin
Site Admin
Posts: 10384
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.jwpv6.2.1059 :

Post by admin »

That is correct and that is what you expect from the code to do as well. The fact that you need userid to be not null is evident in the give code itself. So it need not be stated explicitly.

HTH,
Paul.

jmkenny
Posts: 8
Joined: Sun Jun 02, 2013 11:04 am
Contact:

Re: About Question enthuware.jwpv6.2.1059 :

Post by jmkenny »

Why are we supposed to make such assumptions ourserlves?
In the tests, you always mention things like "assuming xxx is correct...". Why do you bother with such statements?

admin
Site Admin
Posts: 10384
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.jwpv6.2.1059 :

Post by admin »

The assumptions are stated for things that are not reflected in the given code. For example, the code doesn't show loginUser method anywhere, so it is given in the problem statement that this method is valid.

HTH,
Paul.

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 9 guests