• 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
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Sybex OCA Java 8 Study Guide  RSS feed

 
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I'm working through Bonus Exam # 2, a question about lambdas, and according to what they reported, E and F are reversed. In other words, the authors' answer is correct, but the software graded it incorrectly. This is the solution to the question which might help you identify it:

"C, F.
Since the interface doesn’t take any parameters, we need to pass an empty parameter list. Option A is incorrect because it does not specify a parameter list. Options B and D are incorrect because they pass one parameter. Option E is incorrect because the return keyword is missing."


But while E is missing the return keyword, when graded, it tells me it is okay, and F, where there is the return keyword, is incorrect. That's backwards.

E. caller((0) -> {5});
F. caller((0) -> {return 5;});

I don't know if you have control over the software glitch that grades it, but they have it wrong. Your answer is correct, though.

m.
 
Marshal
Posts: 62819
203
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you checked the book's webpage for errata, to see whether that has already been reported? If not, please supply full details of the question for those of us who don't have that book.
 
Mark Kevin
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

It's not listed in the errata, and it's not in the book. It's part of Sybex's online mock exams, an extra bonus exam. They don't even use question numbers in the errata because they can be randomized and shuffled. Hence, it's difficult identifying the exact question. But the authors should be able to locate it with the information I provided.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
and this why is don't care for forums
 
Campbell Ritchie
Marshal
Posts: 62819
203
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

Please don't blame us for not knowing what nobody tells us.
 
Mark Kevin
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

It's not complicated. The online mock exam # 2 grades the following incorrectly because E. is wrong due to the fact that the lambda is missing the return statement, and F. as not correct. But that's backwards.

E. caller((0) -> {5}); [correct]
F. caller((0) -> {return 5;}); [not correct]

But the authors got it right. They identified E. as incorrect (because no return) and F. as correct. That's all I'm saying. It's a software glitch they might want to correct through the errata. One of the problems is trying to identify the question because they don't have fixed numbers or page numbers in the bonus exams. But the authors should be able to identify it with the information provided above. Just trying to be helpful.

Mark
 
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!