1.4.1 - Data Types Flashcards

1
Q

What is an integer?

A

An integer is a whole number. It can be positive or negative.

eg. 6, 47238, -12, 0, 15

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

What is a real/float?

A

A real number is a number with a fractional part.

eg. -71.5, 5.01, -80.8, 15.0

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

What is a character?

A

A single symbol used by a computer.

eg. A, Z, (, #

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

What is a string?

A

A string is a collection of characters.

eg. ‘Hello, world!’, 07789

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

What is a boolean value?

A

A true or false value.

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

Convert the binary number 1101 into denary.

A

13

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

Convert the denary value 47 into binary.

A

0010 1111

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

Add these two binary numbers: 1011 and 1110.

A

11001.

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

Add the two binary numbers: 0011 0011 and 1001 0110.

A

1100 1001

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

Two equal (unsigned) integers, shown below, are added together. Calculate the result, showing your working. [2 marks]

00010101
00010101

A

0010 1010

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

What are the two ways of expressing negative numbers in binary?

A

Sign and Magnitude.

Two’s Complement.

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

How does sign and magnitude work?

A

The leftmost bit indicates the sign of the binary value.

A 0 represents a positive number and a 1 represents a negative number.

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

Convert the denary number -8 into an 8-bit sign and magnitude number.

A

1000 1000

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

Show a representation of denary -119 in 8-bits using sign and magnitude. [1 mark]

A

1111 0111

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

How does two’s complement work?

A

The left-most significant bit is a negative number.

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

How do you convert to two’s complement?

A

Flip all of the bits in the positive version of the binary number and then add one.

17
Q

Convert the denary number -8 to an 8-bit two’s complement binary number.

18
Q

Show a representation of denary -119 in 8-bits using two’s complement. [1 mark]

19
Q

Subtract 12 from 8 using two’s complement.

20
Q

What base is hexadecimal?

21
Q

Convert the hexadecimal number A6 into denary.

22
Q

Convert the hexadecimal number B2 into binary.

A

1011 0010.

23
Q

Convert the hexadecimal number B2 to denary.

24
Q

Convert the 10-bit mantissa and 6-bit two’s complement number into denary.

1100 1001 11 0001 01

25
A computer represents floating point binary numbers using a 6-bit mantissa and a 4-bit exponent, both using two's complement. Add the following three numbers together and give the answer in the format described. [6 marks] 010100 0010 011000 0001 100010 0010
010000 1111
26
What does normalising a floating-point binary number allow for?
It makes sure the number is as precise as possible.
27
What does a normalised positive floating-point binary number start with?
01
28
What does a normalised negative floating-point binary number start with?
10
29
Normalise the following binary number. 000110100101 0101
0110 1000 0011
30
What must be the same to add floating-point binary numbers?
Their exponents.
31
Add the following floating-point numbers. 000100 0011 000101 0010
011010 0001
32
What is a shift used for in the manipulation of binary?
To multiply or divide a number.
33
Explain how, using bit shift, the unsigned binary number 00101100 can be divided by 4. [2 marks]
Shift right two places.
34
00001100 is shifted two places to the left. Show the result. Identify what arithmetic operation this shift is equivalent to. [2 marks]
0011 0000 Multiplying by 4.
35
An AND operation with the mask 10101010 is applied to the binary number 01010101. Show the result. [1 mark]
0000 0000
36
An OR operation with the mask 10101010 is applied to the binary number 01010101. Show the result. [1 mark]
1111 1111
37
Two floating point numbers are shown below. Calculate the answer of the second number subtracted from the first. You must show your working and ensure your answer is normalised. [5 marks] 01001100 0011 - 01001010 0010
01001110 0010