1.4.1 - Data Types Flashcards

1
Q

Why is it important to make sure data is stored with the right type?

A

So the right operations can be performed on it.

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

What is an integer?

A

An integer is a whole number. Integers include zero and negative numbers, they just can’t have a fractional part. Integers are useful for counting things.

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

What is a real number?

A

Real numbers are positive or negative numbers which can, but do not necessarily, have a fractional part. Reals are useful for measuring things. All integers are real numbers. Real numbers can also be represented using floating point, which is explained later.

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

What is a character?

A

A character is a single symbol used by a computer. These include the letters A to Z, the numbers 0 to 9 and hundreds of symbols like %, £ and :)

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

What is a string?

A

A string is a collection of characters. While a string can be used to store a single character, they can also be used to store many characters in succession.
Strings are useful for storing text and phone numbers which start with a 0, which numeric data types like integers would cut off.

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

What is a Boolean?

A

Named after the mathematician George Boole (hence written with a capital B), values taken by a Boolean data type are restricted to True and False. Booleans are useful for recording data that can only take two values.

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

What does base 2 mean?

A

Each step in place represents a value of two times the previous place.

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

What is a single binary digit?

A

A single binary digit is called a bit, and eight binary digits can be combined to form a byte.
Entertainingly, half a byte (four bits) is called a nybble.

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

What is the least significant bit of a binary number?

A

The one furthest to the right.

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

What is sign magnitude?

A

The most basic way to represent negative numbers in binary. The equivalent of adding a + or - sign, with a leading 1 for a negative and leading 0 for a positive.

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

What is two’s complement?

A

A method of representing negative numbers in binary which makes the most significant bit negative.

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

How to convert to two’s complement.

A

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

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

Why is two’s complement good?

A

It makes subtraction in binary easy. You simply add the twos complement version of a number.

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

How to convert from hexadecimal to binary?

A

Convert each hex digit to a decimal, then binary nybble. Then, combine the nybbles.

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

How to work out floating point binary.

A

Mantissa starts with decimal point after most significant bit. Moves places to the right, depending on what the exponent is in decimal.

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

How to normalise a floating point number?

A

Split into mantissa and exponent.
Adjust so it starts 01 or 10
Add the exponent to represent number of shifts right to get to original.

17
Q

How to add/subtract floating point numbers?

A

Adjust for same exponent.
Carry out binary addition/two’s complement subtraction.
Normalise result.

18
Q

What do shifts do in binary?

A

They move all of the bits a specified number to the left or right, which essentially multiplies or divides the original number by 2^n.

19
Q

How do we apply a mask to binary numbers?

A

Combine them with a logic gate.

20
Q

What is ASCII?

A

ASCII was the leading character set before Unicode. It uses 7 bits to represent 128 characters. There are codes for numbers and symbols too.

21
Q

When did ASCII encounter problems?

A

When computers needed to represent other languages with different characters.

22
Q

What does Unicode do?

A

Unicode solves the problem of ASCII’s limited character set. Unicode uses a varying number of bits allowing for over 1 million different characters, many of which have yet to be allocated. Because of this, Unicode has enough capacity to represent a wealth of different languages, symbols and emoji.