Forums Register Login

Enthuware Test 3 Question 1 - Is this misleading

+Pie Number of slices to send: Send
Okay, sometimes I don't get Enthuware's rationale....

Some questions trick you by requiring you to think in the most literal terms and then there's this question:

What will the following code print?


A million 1
A million 2
Compilation error because of //1
Compilation error because of //2
Compilation error because of //3
Compilation error because of //1 and //3 <-- This is the correct answer according to Enthuware

Yes, there are compilation errors on //1 and //3 but that's not what the question is asking. It's asking "what will the following code print?" In the most literal sense, wouldn't all of the answers be incorrect because the compiler spits out multiple lines? From what I can tell, it never reaches //3 because it stops after //1 is executed.

Wouldn't //1 be more appropriate in this case? Technically, it's the closest to what the compiler actually prints.






+Pie Number of slices to send: Send
I would choose #1 not compiling because that's the error the command line compiler gives. What does Enthuware say the answer is?
1
+Pie Number of slices to send: Send
I don't see anything wrong with this question. It's definitely one you might even encounter on the actual exam ad well!

Most questions will have "what will this code print", "what's the output of this code", "what's the result of this code",... And most of them will have "runtime exception occurs" and "compilation fails" as possible answers. Obviously if compilation fails, there will be no output
Some of these questions will even mention (like this one) the line(s) causing compilation failure, e.g. "A) compilation fails due to error on line X", "B) compilation fails due to error on line Y" and "C) compilation fails due to error on line X and line Y". It's your task to select the most appropriate answer. So if you spot compiler error only on line X, you select A. If you spot compiler errors on both line X and line Y, you select answer C and just move on to the next question.

Hope it helps!
Kind regards,
Roel
+Pie Number of slices to send: Send
 

What does Enthuware say the answer is?


//1 (obviously) and //3 (duplicate case label).

And now I'm off for some !
+Pie Number of slices to send: Send
 

I don't see anything wrong with this question. It's definitely one you might even encounter on the actual exam ad well!


Of course you don't seen anything wrong with the question Roel; that because you have superhuman Java powers!

For the rest of the mere mortals, I hope if it's on the exam, it's phrased more appropriately, e.g., choose the best option, which line(s) won't compile, etc... would all be more appropriate, in my opinion.
+Pie Number of slices to send: Send
 

Brian Brumpton wrote:I hope if it's on the exam, it's phrased more appropriately, e.g., choose the best option, which line(s) won't compile, etc... would all be more appropriate, in my opinion.


I would be surprised if you didn't have at least one question with possible answers like "Compilation fails due to an error on line X". And these are actually more easy than "regular" questions, because with such a question, you'll only have to look at the lines mentioned in the answer to check for compiler errors and you can ignore all other lines
We can fix it! We just need some baling wire, some WD-40, a bit of duct tape and this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 682 times.
Similar Threads
Questions about switch ... case ?
java.ditmas.net mock
JavaRanch #223
Iteratively and Recursively Summing and Reversing an a array of Longs
Single Topic Mock Exams
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 18:49:18.