theory term 1-2 Flashcards

1
Q

what is a bit?

A

smallest bit of data that can be represented (0 or 1)

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

what is a nibble?

A

4 bits

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

what is a byte?

A

8 bits (2 nibbles)

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

what are some types of data?

A

number (signed/unsigned)
images
audio
text

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

what is an overflow error?

A

when the result of a calculation is too large to be represented in the amount of bits allocated

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

what is a signed integer?

A

a positive or negative number that has been assigned a positive or negative value.

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

what is an unsigned integer?

A

positive integer or zero, as it has not been assigned as + or -.

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

what is sign and magnitude?

A

sign = most significant bit (positive = 1 and negative = 0)
magnitude = the rest of the byte, size of number

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

what are some flaws with sign and magnitude?

A
  • a bit pattern is wasted
  • addition does not work in the desired way
  • it has 2 ways of representing 0
  • arithmetic works in 2s compliment and not in sign and magnitude
  • you cannot represent a negative sign in binary
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

what is two’s complement?

A

most common way of representing signed binary integers.
the first digit, if a one, means that one is negative, and then you perform your calculation as normal

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

what are some benefits of two’s complement?

A
  • only one way of representing 0
  • arithmetic works
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

how do you convert integers into two’s complement?

A

step 1:

BINARY FLIP ADD

  • write down the positive value of the integer in binary
    eg. 3 = 0011
  • flip each bit
    eg. 3 = 1100
  • perform binary addition with your flip by adding 0001
    eg. 1101

= -8 + 4 + 1 = -3!

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

what is a left logical shift?

A

a left logical shift by 1 = * 2
a left logical shift by 2 = * 4

most significant bit is shifted left and out of the bit pattern
all the other bits move left
a filler 0 is placed in the least significant bit

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

what is a right logical shift?

A

a right logical shift by 1 = / 2
a right logical shift by 2 = / 4

the least significant bit is shifted right and out of the bit pattern
all the other bits move right
a filler 0 is placed in the most significant bit

+ LOSS OF PRECISION!! 23 / 2 = 11.5, and that cannot be represented in binary. is truncated ig lol, you dont keep the decimal even if it’s 0.99

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

what is a left arithmetic shift?

A

a left arithmetic shift by 1 = * 2
a left arithmetic shift by 2 = * 4

most significant bit is shifted left and out of the bit pattern
all the other bits move left
a filler 0 is placed in the least significant bit

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

what is a right arithmetic shift?

A

a right arithmetic shift by 1 = / 2
a right arithmetic shift by 2 = / 4

the least significant bit is shifted right and out of the pattern
all the other bits move left
THE VALUE OF THE LEAST SIGNIFICANT BIT IS COPIED INTO WHATEVER IS EMPTY (BECOMES THE FILLER)

  • this is why right arithmetic shift is better, as it maintains sign (negative signs) !
  • it can overflow error however (bit of an L)
17
Q

what is hexadecimal?

A

an alternative method of representing long binary numbers.
hexadecimal is a base 16 number system.

18
Q

what is A ^16

A

10 ^ 10 = 1010 ^ 2 and A ^ 16

19
Q

what is F ^ 16

A

15 ^ 10 = 1111 ^ 2 = F ^ 16

20
Q

how do you convert between binary and hexadecimal?

A

divide your byte into nibbles!

eg.
0110 1100
4 +2 = 6 8 + 4 = 12 = C

0110 1100 = 6C

21
Q

how do you convert between hexadecimal and binary?

A

B E
B = 11 E = 15
1011 1111

BE = 1011 1111

22
Q

what is a common use for hexadecimal?

A

colours

23
Q

what is ASCII?

A

a standard way to encode text on early computers
7 bits

24
Q

how do you differentiate A from a?

A
  • difference of 32 in denary
  • the 32 bit is filled in on one, and not on the other
25
Q

A = 0100 0001
E = ?

A

E - A = 4 in between them

= fill in the 4 bit on the binary digit
0100 0101

26
Q

how many characters does ASCII represent?

A

128

27
Q

how many characters does extended ASCII represent?

A

512

28
Q

how many characters does unicode represent?

A

120,000

29
Q

why was unicode created?

A

ASCII did not support other languages, eg. french, german, cyrillic and mandarin