The NOT gate
Answers are for parents and teachers.
1
A signal goes through six NOT gates in a row. The first input is 1. What is the final output, and why?
1. Each pair of NOTs cancels, and six NOTs make three pairs.
2
A tank heater should run when the water is NOT warm enough. Name the input and the output and give the table.
Input: water warm enough (A). Output: heater on (Y). A = 0 gives Y = 1; A = 1 gives Y = 0.
3
Trace the NOT simulator for six clicks from the start state and write the state after each click.
Off lit, On unlit, Off lit, On unlit, Off lit, On unlit.
4
What does echo !0; print in PHP, and what does Console.WriteLine(Not 0) print in VB.NET?
PHP prints 1, because !0 is true. VB.NET prints −1, because Not works on the bits.
5
Write the PHP test for a lamp that is lit when $a is "on" and $b is not "on".
if ($a == "on" && $b != "on") (or !($b == "on") for the second part)