Binary
| Purpose-driven system (built from gates) | Core gate(s) | Why it’s helpful / real-world impact |
|---|---|---|
| Secure door lock — opens only when every credential is valid (badge AND PIN,[ AND ]) | AND | Raises physical security; reduces unauthorized entry by demanding multiple independent proofs of identity. |
| Burglar alarm — sounds if any sensor trips (window, motion, glass-break, OR) | OR | Improves safety by turning one of many possible intrusions into a single, timely alert. |
| Automatic night light — lamp turns on when it’s dark AND someone is present (light sensor NOT + AND with PIR) | NOT + AND | Saves energy and extends bulb life while still providing illumination only when it’s actually useful. |
| Emergency-stop latch — machine runs while enable-switch is 1 AND no fault is present (NOT fault AND run) | AND + NOT | Prevents equipment damage/injury by forcing the motor off the instant a fault line goes high. |
| Majority-vote controller — critical system keeps working if ≥ 2 of 3 subsystems agree (3-input majority) | combinations of AND/OR | Provides fault-tolerance in aerospace/medical devices; a single faulty sensor can’t bring the system down. |
| Parity / XOR error-checker — detects flipped bits on data links | XOR | Increases data reliability; corrupted packets are caught before they cause crashes or wrong results. |
| Adders, multiplexers & registers (building blocks of CPUs) | AND, OR, XOR, NOT | Deliver the speed-and-power advantages of digital computing to everything from phones to pacemakers. |
The circuit is true when:
X AND Y are both 1 OR
Z is 1 (regardless of X and Y).
That’s literally the expression
( 𝑋 ∧ 𝑌 ) ∨ 𝑍 (X∧Y)∨Z Answer: A. (X AND Y) OR Z
(The other options either evaluate the OR/AND in the wrong order or negate the wrong part.)
def secure_entry_system(keycard, pin, voice):
"""
Returns 1 (granted) only if *all three* credentials are present.
Each argument should be 0 or 1.
"""
def AND3(a, b, c):
return a & b & c # 3-input AND logic using bitwise-AND
return AND3(keycard, pin, voice)
# --- Test cases ---
print(secure_entry_system(1, 1, 1)) # ➜ 1 (Access granted)
print(secure_entry_system(1, 0, 1)) # ➜ 0 (Denied: wrong PIN)
print(secure_entry_system(0, 1, 1)) # ➜ 0 (Denied: no keycard)
print(secure_entry_system(1, 1, 0)) # ➜ 0 (Denied: voice mismatch)
1
0
0
0