title: AP Computer Science Logical Operators
body: <p>Which of the following will evaluate to true only if boolean expressions <code>A</code>, <code>B</code>, and <code>C</code> are all <code>false</code>?</p>
  
  <blockquote>
    <p><em>Answer:</em> <code>!(A || B || C)</code><br>
    <em>My answer:</em> <code>!(A &amp;&amp; B &amp;&amp; C)</code></p>
  </blockquote>
  
  <p>Why is my answer incorrect? If <code>A</code>, <code>B</code> and <code>C</code> are all <code>false</code> and the <code>!</code> is distributed, it will make all of them <code>true</code>, thus returning <code>true</code>.</p>
  
  <hr>
  
  <p>Given that <code>a</code>, <code>b</code> and <code>c</code> are integers, consider the boolean expression</p>
  
  <pre><code>(a &lt; b) || !((c == a * b) &amp;&amp; (c &lt; a))
  </code></pre>
  
  <p>Which of the following will guarantee that the expression is <code>true</code>?</p>
  
  <blockquote>
    <p><em>Answer:</em> <code>c &lt; a</code> is <code>false</code></p>
  </blockquote>
  
  <p>Doesn't the result rely on <code>(c == a * b)</code> being <code>false</code> also because of the <code>&amp;&amp;</code>? </p>