Claire Hw
Hw and popcorn hacks
popcorn hack 1
Logic gates are used in computers to perform fast calculations, making modern computing and software possible. They control decision-making in safety systems, ensuring machines respond automatically to conditions like sensor inputs. They also store data in memory units, allowing devices to remember states and run programs efficiently.
popcorn Hack 2
Answer: A. (X AND Y) OR Z
Explanation:
A says: if X and Y are both 1, or Z is 1 → matches perfectly.
B says: X AND (Y OR Z) → this is different, because here X must be 1 no matter what.
C says: (X OR Y) AND Z → here Z must be 1, and either X or Y.
D says: NOT(X AND Y) OR Z → this is more like “if X and Y are not both 1, or Z is 1,” which is not the same.
def secure_entry_system(keycard, pin, voice):
def AND(a, b):
return a & b # AND logic
# Combine keycard and pin first, then combine with voice
return AND(AND(keycard, pin), voice)
# Test cases
print(secure_entry_system(1, 1, 1)) # Expected Output: 1 (Access Granted)
print(secure_entry_system(1, 1, 0)) # Expected Output: 0 (Access Denied)
print(secure_entry_system(1, 0, 1)) # Expected Output: 0 (Access Denied)
print(secure_entry_system(0, 1, 1)) # Expected Output: 0 (Access Denied)
1
0
0
0
explanation
Now, access is only granted if keycard, pin, and voice are all 1 (true), reflecting a stricter security system.