This week's book giveaways are in the Angular and TypeScript and Web Services forums.
We're giving away four copies each of Programming with Types and The Design of Web APIs and have the authors on-line!
See this thread and this one for details.
Win a copy of Programming with Types this week in the Angular and TypeScript forum
or The Design of Web APIs in the Web Services forum!
  • 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
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Henry Wong
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Frits Walraven
  • Joe Ess
  • salvin francis

What is the output?

 
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm doing a practice test and this one has me stumped by the possible answers:



The possible answers are:

a.) 10+20Java
    Java+30
b.) 1020Java
    Java30
c.) 30Java
    Java1020

I'm not understanding how no answer has 200.  I thought that the order of operations would have the multiplication
 
Marshal
Posts: 24820
60
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree with you 100%. Can you tell us where you got this practice test from?
 
Bartender
Posts: 2431
107
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, It looks like you have posted this question twice here : https://coderanch.com/t/725128/java/output

I have locked your original thread, let's continue our discussion here.
 
Royale Summers
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul -

I would have to double-check but I think Quora.  I asked about the breadth and depth of knowledge required for an entry-level developer.  Someone posted a quiz for me.
 
Sheriff
Posts: 14614
243
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you ran the code, you'd see that you're right and the practice is wrong. Not the first time that's ever happened so always double check by actually running the code.

I threw the original thread that Salvin locked into the trash, by the way.
 
salvin francis
Bartender
Posts: 2431
107
Google Web Toolkit Eclipse IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe you have incorrectly typed it here ?
I see a "printlin" instead of "println" in your above code. I have this gut feeling that the question says
and
This would make one of the options right !

 
Royale Summers
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Salvin -

Thanks.  I already saw that and corrected it.  No, the operators are correct in the code.
 
Royale Summers
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Salvin -

I found it:

"You can ask the developer take this free online Java test:

https://hybrisarchitect.com/exam...

After the test, have the developer send you a screenshot of the test results."
 
Sheriff
Posts: 6551
176
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nothing at that URL (404).
 
Royale Summers
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Knute -

That's weird.  I got 404 also but it works when I click on the URL from within Quora?


Please try this one... https://hybrisarchitect.com/exam.html?courseID=java-dev-01&language=EN
 
Knute Snortum
Sheriff
Posts: 6551
176
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay, that works, but I'm not going to take the exam just to see the question and answer.  So, as has been stated, none of those answers are correct.
 
Royale Summers
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Knute -

Okay, thanks!
 
Marshal
Posts: 66975
255
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As somebody has said, it is more likely that the operators are +s, because there is a well‑known gotcha with  + and Strings.
 
Knute Snortum
Sheriff
Posts: 6551
176
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In which case the answer would be (c).
 
You don't like waffles? Well, do you like this tiny ad?
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!