9.4.2 Interrelationship between hardware and software Flashcards

1
Q

Explain how to convert a binary number to a decimal

A

Binary numbers consist of either 1 or 0 in place values that are powers of 2.

Determine the place value of each 1 and sum them.

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

Explain how to convert a decimal number to binary

A

Moving from left to right, “fill up” the binary values as much as possible for each value.

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

How many distinct values can be stored in a binary number?

A

2 to the power of n, where n is the length of the binary number.

For example, a byte (8 bits) can store 256 values because 2^8 = 256.

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

How does the hexadecimal number system work?

A

Hexadecimal is base 16. The hexadecimal digits are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, A, B, C, D, E, F.

Because 16 is a power of 2, the hexadecimal number system is used as a shorthand way of writing binary numbers.

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

Explain how to convert a hexadecimal number to binary.

A

Each group of 4 bits corresponds to a single hexadecimal digit. Just join them together!

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

Explain how to convert hexadecimal numbers to decimal

A

Multiply each digit value by the place value of the power of 16.

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

Explain how negative integers are represented using sign-modulus form.

A

The leading bit indicates whether or not the integer is negative (0 for positive, 1 for negative).

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

Explain how negative integers are represented using 1s complement form.

A

Invert all bits of the positive number

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

Explain how negative integers are represented using 2s complement form.

A

The leading bit takes on a negative value

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

What is the process for adding 2 binary numbers?

A

Use vertical addition, carrying bits as needed

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

What is the process for subtracting 2 binary numbers?

A

Add the negative.

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

What is the process for multiplying 2 binary numbers?

A

Use long multiplication (“shift and add”)

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

What is the process of dividing 2 binary numbers

A

Use the process of long division: repeated steps of divide, multiply through, subtract, bring down.

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

How are characters represented in ASCII

A

Each character is represented as a 7-bit binary number, giving a total of 128 characters. Most of these are printable characters found on a standard keyboard, but some are “control characters”

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

What is the ASCII code for the capital letter ‘A’?

A

65 in decimal
100 0001 in binary

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

What is the relationship between capital letters and their lowercase equivalents in ASCII?

A

Each pair of uppercase/lowercase letter is separated by 32, which is a single place value in binary.

17
Q

How does Unicode allow for a greater range of characters?

A

By using a variable number of bits to represent characters.

ASCII is embedded in Unicode, so ‘A’ is still 100 0001, but other characters have been added that require more bits. For example, ‘💩’ is 11111010010101001.

(Teacher note - of course you don’t have to remember that example! And you don’t need to know how these are encoded)

18
Q

How are floating point numbers represented in binary?

A

The bits the come after the binary point are in decreasing powers of 2 - i.e. 1/2, 1/4, 1/8 etc.

These “bicimals” are expressed in scientific notation, consisting of a sign, mantissa and exponent.

19
Q

How are floating point numbers encoded in IEEE754 single precision format?

A

32 bits are allocated to the number:
* The first bit is the sign bit
* The next 8 bits are the exponent, but it is offset by 127.
* The remaining 23 bits are the mantissa but only the bits after the radix point are stored.

20
Q

Outline the general process for converting a 32-bit single precision number to a decimal.

A
  1. If the first bit is a 0, the number is positive.
  2. Take the next 8 bits as an unsigned integer and subtract 127 to get the exponent.
  3. Add “1.” to the next 23 bits to get the full mantissa.
  4. The number can now be expressed in scientific notation - use the exponent to “jump” the binary point according to the exponent
  5. Convert the resulting “bicimal” using binary place value.