1.4.1 Flashcards

1
Q

What are the 5 primitive data types?

A
  • Real / Floating Point – Stores decimal numbers (3.141)
  • Character - A single letter, number or special character (‘H’)
  • String – A collection of characters (“Hello World”)
  • Boolean – TRUE or FALSE
  • Integer – A positive or negative whole number (24, -34)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is casting?

A

The process of changing one data type into another.

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

What is a character set?

What are some examples?

A
  • Contains all the characters the computer can represent.
  • Each character is represented by a unique binary value.
  • Used to map binary values to characters.
  • Examples: UNICODE and ASCII
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Describe the ASCII character set

A
  • ASCII is a character set which is a subset of UNICODE
  • Uses 7 bits, or 8 bits for extended ASCII
  • Fewer characters can be represented than UNICODE
  • Characters from different languages cannot be represented in ASCII
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Describe the UNICODE character set

A
  • Each character is represented by 1-4 bytes.
  • It supports a very large number of characters
  • It is backwards compatible with ASCII
  • Text using UNICODE rather than ASCII would take up more storage (roughly 4 times more)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Left shift the following 8-bit number 3 places: 00111010

What mathematical operation is this equivalent to?

A

Remove the required number of bits from the left

Add the same number of zeros to the right

11010000

Equivalent to multiplying the number

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

Right shift the following 8-bit number 3 places: 00111010

What mathematical operation is this equivalent to?

A

Remove the required number of bits from the right

Add the same number of zeros to the left

00000111

Equivalent to dividing the number

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

Convert 177 to an unsigned 8-bit binary number

A

10110001

128+32+16+1 = 177

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

Convert the unsigned 8-bit binary number 10110010 to denary

A

128+32+16+2 = 178

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

Convert 188 to Hex

A

BC

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

Convert the hex FE to a denary number

A

11111110 = 254

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

Convery -49 to an 8-bit binary number using two’s complement

A

11001111

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

Convert 49 to an 8-bit binary number using two’s complement

A

00110001

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

Convert -49 to an 8-bit binary number using sign and magnitude

A

10110001

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

Add the following two binary numbers

01101010 + 00111111

A

10101001

Carries - 11111100

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

Subtract the following two binary numbers

00101111 - 00010111

A

00011000

An overflow should have occured

17
Q

Mask 11010101 using the AND mask 10101010

A

10000000

18
Q

Mask 11010101 using the OR mask 10101010

A

11111111

19
Q

Mask 11010101 using the XOR mask 10101010

A

01111111

20
Q

Normalise 0001011000 001100

A

0101100000 001010

(Remove the two extra bits from the front of the mantissa and reduce the exponent value by 2)

21
Q

Convert 5.25 to an 6-bit mantissa and 3-bit exponent

A

010101 011

22
Q

Convert -5.25 to an 6-bit mantissa and 3-bit exponent

A

101011 011

23
Q

**Convert 01110 0001 to floating point denary

A

1.75

24
Q

Convert 0.125 to an 6-bit mantissa and 3-bit exponent

A

010000 110

25
Q

Convert -0.125 to an 6-bit mantissa and 3-bit exponent

A

100000 101

Remember to normalise

26
Q

Add the following floating point binary numbers stored in the two’s complement format.

0110 0010 and 0100 0011

A

0111 0011

27
Q

Why do we normalise floating point numbers?

A

Allows for more accuracy/precision from the given number of bits

So that the representation of each binary value is unique

28
Q

What impact does increasing the size of the exponent have?

A

Increasing the number of bits used for the exponent increases the size of the number that can be stored.

29
Q

What impact does increasing the size of the mantissa have?

A

Increasing the number of bits used for the mantissa increases the precision of the number that can be stored.

30
Q

Subtract the following floating point binary numbers stored in the two’s complement format.

010010 0100 - 010010 0010

A

0110110 0011