W5 - NUMBER SYSTEMS AND SAFE PROGRAMMING Flashcards

1
Q

W5-1: Why Binary?

A

Unambiguous and Unequivocal state:
_ 0 or 1 for storage of a value in a bit
. Electric current in RAM, magnetic charge on HDD, magic in SSD
_ TRUE or FALSE to make a decision (Boolean logic)
. hardware uses logic gates,
. software uses Selection logic,
EX: IF statements resolve to TRUE or FALSE.

Faster Processing:
CPUs, ALUs, FPUs, GPUs are faster in binary

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

W5-2: Hexadecimal

A

_ Hex is base 16

_ Why? Hex is easier than binary.

_ 8 bit byte holds 256 values. 16 * 16 = 256 thus Hex.

0–15: One – Nine, Able, Baker, Charlie, Dog, Easy, Fox

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

W5-3: HTML uses Hexadecimal color codes

A

_ Hex codes take LESS SPACE to write than decimal and are used in HTML colour representations, as in: #XXXXXX

_ Each red, green, and blue value ranges from “00” (lowest intensity) to “FF” (highest intensity) in HEX

_ Web-safe colors

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

W5-4: What is BYTE?

A

_ A sequence of adjacent bits (binary digits) that can be operated on as a unit by a computer;

_ the smallest usable machine word;

_ nearly always eight bits, which can represent an integer from 0 to 255 or a single character of text.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

W5-5: Two’s Complement

A

_ Positive and Negative numbers share half the bits of an integer.

_ High order bit indicates the sign.
0 is positive, 1 is negative

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q
#W5-6: Floats and Doubles — fractions
In a binary system, what value is between 0 and 1?
A

_ Every fractional value to the right of the decimal point is an approximation between 0 and 1.

_ Not to be used for monetary or exact values in business => Use DECIMAL data type instead

_ DECIMAL data types are essentially integers with an implied fixed decimal position.
EX: DECIMAL size 9.2 contains 1,234,567.89

_ BE VERY CAREFUL MIXING INTeger and FP types

How well did you know this?
1
Not at all
2
3
4
5
Perfectly