|
|
||
| You are here: | ||
|
True/False and multiple choice. You have a good chance of being right, right?
|
Try these, assuming: char c = 'y'; int x = 5; int y = -5; int z = 2; 1. ((c == 'y') && (x == 5) || (z > y))Does it matter whether z is greater or less than y? 2. (!(c == 'y') && (x == 5) || !(z > y)) Did you have to evaluate all parts of the expression this time? 3. !((c == 'y') && (x == 5) || (z > y)) Just checking, I'm sure you've got it by now... try something different: 4. (!(c == 'F') && !(y == 5) || (z-x > y)) OK Let's try our flip flp fly again: int x = 9; What's the value of answer? Related: [ Java Core | previous AddSub | next:Repetition ] |
A few exercises for formative evaluation (testing yourself against the machine) |
|
|
|||
|
Questions or problems related to this web site should be addressed to Richard Jones who asserts his right to be identified as the author and owner of these materials - unless otherwise indicated. Please feel free to use the material presented here and to create links to it for non-commercial purposes; an acknowledgement of the source is required by the Creative Commons licence. Use of materials from this site is conditional upon your having read the additional terms of use on the about page and the Creative Commons Licence. View privacy policy. This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License. © 2001 - 2009 Richard Jones, PO BOX 246, Cambridge, New Zealand; This page was last modified: May 31, 2009 |