• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Enthuware Test 3 Question 1 - Is this misleading

 
Ranch Hand
Posts: 40
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.






 
author & internet detective
Posts: 40198
816
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would choose #1 not compiling because that's the error the command line compiler gives. What does Enthuware say the answer is?
 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Roel De Nijs
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

What does Enthuware say the answer is?


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

And now I'm off for some !
 
Brian Brumpton
Ranch Hand
Posts: 40
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
Roel De Nijs
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic