machines Flashcards
what you (as an up-and-coming computer-scientist) need to know about the machines that run your code
what do computers understand?
0’s and 1’s
how does a computer interpret electricity?
when the power flowing through a circuit is above a pre-specified level for a pre-specified period of time, the computer interprets that as a “1”, and when it is below a pre-specified level, for said amount of time, it perceives a “0”
and, yes, that pre-specified amount of time is wicked fast!!!
what are logic gates?
AND, OR, XOR, NOT, NAND, NOR and XNOR
you can create “electric circuits” (think: battery, wires, and a light-bulb) that cause the light to shine based on the logic of your circuit, as applied to it’s inputs
For example, if you create an “OR” gate-circuit, then only when one (and only one) of the two input-wires pass a current (i.e. 1’s) through your circuit, will result in the light glow.
for more see: https://whatis.techtarget.com/definition/logic-gate-AND-OR-XOR-NOT-NAND-NOR-and-XNOR
how do computers understand words?
as a string of binary (i.e. 1’s and 0’s)
what does “f” have to do with binary?
as you know binary #’s are base-2,
and hexidecimal #’s are base 16.
instead of the lazy humans having to type:
“0b1111” or (base-10) “15”, we simply type “f”
what is the base for binary #’s?
binary #’s are base 2
what is the base for the #’s we normally use?
decimal #’s are base-10
what base are the computer-related set of “numbers” require letters?
hexadecimal #’s are base 16
what is the decimal equivalent of a hexidecimal “b”?
11
what is the largest hexidecimal digit?
f
what is the decimal equivalent of a hexidecimal “f”?
15
how to computers interpret the letter “A” (when it’s intended as a letter and not a number)?
65 (according to the “ascii” encoding system;
see: https://ascii.cl/
if computers understand numbers why can I program with words?
because some nice-humans who wrote in “binary”, wrote software (i.e. compilers & interpreters) that translate what you type into #’s …so you don’t have-to…