Question 1 of 10
Which expression is equivalent to !(full && closed) for every pair of boolean values?
- A. !full && !closed
- B. full || closed
- C. !full || !closed
- D. full && !closed
Which expression is equivalent to !(full && closed) for every pair of boolean values?
A ferry holds if !(night || fog). Which expression is equivalent for every pair of boolean values?
This truth table shows expression F. Which Java expression matches F for every row?
| p | q | F |
|---|---|---|
| true | true | false |
| true | false | false |
| false | true | false |
| false | false | true |
Which expression is equivalent to !(x < 3 || y >= 10) for every int x and y?
Which expression is equivalent to !a || !b for every boolean a and b?
Which expression is equivalent to !(!p && q) for every boolean p and q?
Two dock labels are constructed separately. What text does this Java code display?
String m = new String("dock");
String n = new String("dock");
System.out.print(m.equals(n));
A harbor printer shows both a reference test and a content test. What text does this Java code display?
String m = new String("dock");
String n = new String("dock");
System.out.print((m == n) + ":" + m.equals(n));
Two optional labels are compared with ==. What text does this Java code display?
String left = null;
String right = null;
System.out.print(left == right);
A Badge stores an id string. Badge.equals returns true when both objects are non-null Badges whose id strings are equal according to String.equals.
| Member | Contract |
|---|---|
| Badge(String id) | constructs a Badge with the given id |
| equals | true when the other object is a non-null Badge with the same id |
What text does this Java code display?
Badge a = new Badge("K9");
Badge b = new Badge("K9");
Badge c = null;
System.out.print(a.equals(b) + " " + (a == b) + " " + (c == null));