I recently learned about the NAND gate circuit with transistors in my circuits class as shown below.
Unfortunately I'm having a very difficult time comprehending as to why the output is 1 when A or B is turned on. It seems to me that if a voltage source is connected to A or B and is turned with sufficient voltage to produce a current V_{out} will not be V_{cc}.
Best Answer
It might be a little easier to understand if we start with switches:
simulate this circuit – Schematic created using CircuitLab
Figure 1. Hard-wired NAND gate.
Here it should be obvious that Q will be pulled high unless both SW1 and SW2 are closed. When both are closed Q will be pulled low (to ground).
The transistors in your example behave as switches controlled by current injected into their bases. If no current is injected into the base then no current will flow from collector to emitter and they behave as open switches.
If enough current is injected into the base (by connecting it to a positive supply, usually through a current limiting resistor) then current can flow from the collector to the emitter.
I hope that makes some sense.