2.1 BInary (B02) Flashcards

1
Q

why do computers use binary?

A

A computer’s electronic circuits consist of hundreds of thousands of tiny switches, called transistors.
they can be either on or off. When a transistor is on it produces a ‘1’ and when it is switched off, it produces a ‘0’.

Transistors can switch on and off thousands of times per second, which enables computers to process huge amounts of data very quickly.

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

most significant bit

A

the one with most value (furthest to the left)

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

how to do denary -> binary

A

divide X by 2, find quotient, find remainder (remainder is bit 1)

divide quotient by 2, find new quotient, find remainder (remainder is bit 2)

keep going!

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

overflow

A

happen when the largest number that a register can hold is exceeded. The number of bits that it can handle is called (strangely) the word size

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

adding 1 to a binary number

A

Loop through the digits of the original number from the RIGHT:
If you find a 1, change it to 0.
If you find a 0, change it to 1 and STOP.
All remaining digits are unchanged.

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

how to represent negative binary

A

Two’s Compliment:

Start with the 8-bit representation of the equivalent positive integer.
Reflect each bit of the bit pattern (change 0 to 1, and 1 to 0).
Add one.

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

errors when manipulating unsigned integers

A

If the result is too large to fit into the number of bits assigned to it, an “overflow” is said to have occurred. For example if the result of an operation using 16 bit integers is larger than 65,535, an overflow results.

If the result is below zero (e.g. 54 – 58), then how is the computer meant to represent it as a minus number, given that it stores data using only 0s and 1s?

In the division of two integers, if the result is not itself an integer, a “truncation” is said to have occurred: 10 divided by 3 is truncated to 3, and the extra 1/3 is lost.

Any division by zero is an error, since division by zero is not possible in the context of arithmetic.

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

what range of numbers can be represented using 8 bits (w/ Two’s compliement)

A

-128 to +127

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

bitwise operation

A

another name for shifts

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

logical vs arithmetic shift

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

what symbols does hexadecimal use

A

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.

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

why is hexadecimal used

A

computers do not store data in hexadecimal format. They only ever use binary. Hex benefits humans, not computers:

Binary produces long strings and can be difficult to work with. Hex is shorter.
Strangely, it is easier to convert numbers from binary to denary when using hexadecimal.

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