• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

McKenzie's Mock Exam Question 13-3 on pg. 286 has wrong answers.

 
Ranch Hand
Posts: 31
Android Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I believe the answers are wrong for question 13- 3 on page 286 in the McKenzie's Mock Exam Questions book.

The question is:

Given the declarations below, which of the following conditional statements would evaluate to true?



a) (x1<x2)&&(x2>x1)
b) (x1<x2)||(x2>x1)
c) ! (b == true) && (x1 > d)
d) (b == true) && (x1 > d)

On page 295, it lists the correct answers as a, b, c - which I believe it should be a, b, d. I'm using Java(TM) SE Runtime Environment (build 1.6.0_18-b07).

Answer c cannot evaluate to true because of the exclamation point before the left hand expression. The right hand expression does result in true, but the left hand expression would result in false.

Am I missing something here?
 
author and cow tipper
Posts: 5009
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Indeed. It was an error in the book.

Thanks for the update!

-Cameron
 
I wasn't selected to go to mars. This tiny ad got in ahead of me:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic