1.4 - Data types, data structures and algorithms Flashcards
What is a data type?
It is the classification of data telling the computer how the computer will use the data.
What is an integer?
Any positive/negative whole number.
What is a real/float?
Any real world quantity expressed as a number (decimals).
What is boolean?
Used to represent one of two truth values (True/False)
What is a character?
Represents a single character, alphanumeric/symbol.
What is a string?
A collection of characters.
What is casting data types?
Changing data types
What is a primitive data type?
A basic data type.
What base in binary?
Base 2 = 01
What base is denary?
Base 10 0-9
What base is hexadecimal?
Base 16 0-9, A-F
What are the 5 positives of hexadecimal?
- Values easier to remember/read than binary.
- Quicker to write, less characters.
- Less chance of eror when typing hex.
- Defines colours, MAC addresses, in assembly languages/machine code.
- Easy to convert to/from Binary.
How do you use sign + magnitude?
(Negative numbers in binary)
The most significant number represents whether the number is positive (= 0)/negative (=1).
How do you use two’s compliment?
(Negative numbers in binary)
The most significant number represents whether the number is positive (= 0)/negative (=1). Then all the numbers afterwards (until the last 1 (1 closest to the end)) are switched to the opposite value.
How do you convert from Denary to Binary?
Put in place value to add to make total of the number.
e.g. 99 = 01100011
128/64/32/16/8/4/2/1
0 1 1 0 0 0 1 1
How do you convert from Hexadecimal to Denary
Do the rule of place values. 256 16 1 time number based on plate.
How do you convert from Denary to Hexadecimal?
Divide number by 16 and add remainder.
e.g. 43/16 = 2 + 11 = 2B
(11 = remainder in the example)
How do you convert from Binary to Hexadecimal?
Divide binrary number into 2 (2 x 4 digits)= 0011 1100 (Use 8421 place values) and then add to make up the 2 hex digits.
What is a bit?
An individual digit in a binary value.
Used to represent ON + OFF voltage signals om a computer.
What is a byte
- 8 Bits grouped together.
- Can group 2 or more bytes together to hold larger values.
What is a fixed bit?
extra zeros that pad the data at the front. So that the binary can be a full byte.
How big is a Kilobyte?
10^3 = 1,000 bytes
KB = Kilobyte
How big is a Megabyte?
10^6 = 1,000,000 Bytes
MB = Megabyte
How big is a Gigabyte?
10^9 = 1,000,000,000 Bytes
GB = Gigabyte