1.4.1 Data types - Suprit Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

Define Real Numbers

A

Positive or negative numbers that typically have a decimal point

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

Define Integer

A

A whole number

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

Define Characters

A

Any symbol used by the computer

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

Define String

A

A collection of characters stored in succession

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

Define Boolean

A

Represents True or False

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

How do computers store whole numbers?

A

Computers store whole numbers as binary

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

How many bits make up a nibble?

A

4 bits

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

How many nibbles make up a byte?

A

2 nibbles

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

Convert binary number 1101 to denary

A

13

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

How many bits in a kilobyte?

A

8000

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

Convert 47 into binary

A

101111

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

What is 1011 + 1110?

A

(1)1001
(1) is an overflow

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

What does 0 and 1 at the start of a binary number represent in Sign Magnitude?

A

0 = Positive Number
1 = Negative Number

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

If 10101101 = 173, what does Sign Magnitude number 010101101 mean in denary?

A

It’s also 173

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

Convert -105 to a Sign Magnitude number

A

101101001

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

What is another way to represent positive and negative numbers in binary?

A

Two’s Complement

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

How do you convert a binary number into Two’s Complement?

A

Flip all of the individual bits and add 1
Example - 00000111 (7) becomes 11111000 when its initially flipped, and becomes 11111001 (-7) once 1 has been added on.

18
Q

How does subtraction work in Two’s Complement?

A

It works by adding a negative number to a positive number

19
Q

Subtract 10100 from 01000 in Two’s Complement.

A

11100 (-4)

20
Q

What base is Hexadecimal?

A

Base 16

21
Q

What numbers and characters are used in hexadecimal?

A

Numbers 0-9 and Characters A-F

22
Q

How do you convert Hexadecimal to Binary?

A
  1. Split the Hexadecimal number into individual digits
  2. Convert each digit into denary
  3. Convert the denary into binary nibbles (4 bits)
  4. Combine the nibbles together to get the answer.
23
Q

Convert F1A2 to binary

A

Answer = 1111000110100010
Explanation -
1. Split F, 1, A, and 2
2. Convert each digit -
F = 15
1 = 1
A = 10
2 = 2
3. Convert the denary into binary nibbles -
15 = 1111
1 = 0001
10 = 1010
2 = 0010
4. Combine them -
1111000110100010

24
Q

How do you convert hexadecimal to denary?

A
  1. Split the Hexadecimal number into individual digits
  2. Convert each digit into denary
  3. Convert the denary into binary nibbles (4 bits)
  4. Combine the nibbles together to get the answer.
  5. Convert the binary number into denary
25
Q

Convert F1A2 into denary

A

Answer = 61858
Explanation -
1. Split F, 1, A, and 2
2. Convert each digit -
F = 15
1 = 1
A = 10
2 = 2
3. Convert the denary into binary nibbles -
15 = 1111
1 = 0001
10 = 1010
2 = 0010
4. Combine them -
1111000110100010
5. Convert into binary -
1111000110100010 = 61858

26
Q

What 2 parts make up Floating Point Numbers in Binary?

A

Mantissa and exponent

27
Q

What does the mantissa represent?

A

The original number

28
Q

What does the exponent represent?

A

The shift in the decimal point

29
Q

Is there a leading sign bit in Floating Point Binary?

A

Yes

30
Q

How do you convert floating point binary into denary?

A
  1. Check if the sign bit is positive (0) or negative (1)
  2. The mantissa has the binary point (binary equivalent of decimal point) after the most significant bit. Make sure to place this there.
  3. Convert the exponent into decimal (it’s in two’s complement, so check if it starts with a 0 or a 1)
  4. Move the binary point by the same number of times that represents the exponent, moving it left if its negative, and moving it right if its positive.
  5. Now convert into denary
31
Q

Convert 01100100111000101 to binary, where this number starts with a sign, has a 10 bit mantissa, and has a 6 bit exponent.

A

A = 50.4375
Explanation -
1. Check if the sign bit is positive or negative (0 = Positive)
2. Place binary bit after most significant bit in mantissa -
1.100100111
3. Convert the exponent -
000101 = 5
4. Move the binary point depending on the exponent -
Exponent = 5, so 1.100100111 = 110010.0111
5. Convert 110010.0111 into denary -
110010.0111 = 50.4375

32
Q

How do you normalise binary numbers?

A
  1. Split the number into its mantissa and exponent
  2. Adjust the mantissa so that it starts with 01 or 10
  3. Add zeroes to the end depending on how many bits the mantissa was adjusted by
  4. Increase/Decrease the exponent depending on how the mantissa was changed.
33
Q

Normalise 000110100101, which has an 8 bit mantissa and a 4 bit exponent

A

A = 011010000011
Explanation -
1. Split Mantissa and Exponent -
M = 00011010
E = 0101
2. Adjust the mantissa so it starts with 01 or 10 -
00011010 = 011010
3. Add zeroes on the end to make it an 8 bit number again -
011010 = 01101000
4. Adjust the exponent -
As the mantissa increased by 2 bits, the exponent must decrease by 2
0101 = 0011

34
Q

How do you add floating point binary numbers together?

A
  1. Adjust the exponents so both of them are the same
  2. Add the mantissas together
  3. Normalise if necessary
35
Q

What is 00001000011 + 00001010010? Both numbers have a sign bit, a 6-bit mantissa and a 4-bit exponent.

A
  1. Adjust exponents so they are both the same -
    0011 = 0010
    0010 = 0010
    000100 becomes 001000 due to the change in exponent
  2. Add the mantissas -
    001000 + 000101 = 001101
  3. Normalise -
    00011010010 becomes 00110100001
36
Q

How do you subtract floating point binary numbers?

A
  1. Make the exponents the same
  2. Convert the mantissa of the number to be subtracted into two’s complement. Do this by flipping all the bits and adding 1
  3. Add the numbers
  4. Normalise answer
37
Q

What is a logical shift left the same as?

A

Multiplication

38
Q

What is a logical shift right the same as?

A

Division

39
Q

What does an AND mask do?

A

Multiplies inputs, so 1*1 = 1, but anything involving a 0 = 0

40
Q

What does an OR mask do?

A

If either bit is 1, 1 will be outputted, otherwise 0 will be outputted

41
Q

What happens to the binary number 00101011 when an AND mask of 10111011 has been applied?

A

A = It becomes 00101011
Explanation -
When applying the mask, because the mask is an AND mask, the rules of AND are applied. Therefore, when following the rules, you get 00101011.

42
Q

What happens to the binary number 00101011 when an OR mask of 10111011 has been applied?

A

A = 10111011
Explanation -
The mask is an OR mask, so you apply the rules of OR when applying the mask.