Data Types Flashcards
What is an Integer
- A whole number
- Zero is an integer
- Negative numbers are integers
- Can’t have a fractional part
What is a Real Number
- Positive or negative numbers
- Can have a fractional part
What is a Character
- A single symbol used by a computer
- The letters A to Z
- The numbers 0 to 9
- Symbols like %, £, and,
What is a String
- A collection of characters
- Can be used to store a single character or many characters in succession
- Don’t cut off leading 0s like numeric types
What is a Boolean
Value restricted to True and False
What are the names for how binary is stored
- Bit - single binary digit
- Nibble - 4-bits grouped together
- Byte - 8-bits or 2-nibbles grouped together
What are the Binary Addition Rules
- 0 + 0 = 0
- 0 + 1 = 1
- 1 + 0 = 1
- 1 + 1 = 0 carry 1
Convert the following Binary to Decimal
- 0110 1010
- 0000 1000
- 0001 1001
- 1100 0010
- 0101 0100
0110 1010 - 106
0000 1000 - 8
0001 1001 - 25
1100 0010 - 194
0101 0100 - 84
Convert the following Decimal to Binary
- 10
- 84
- 160
- 53
- 137
10 - 0000 1010
84 - 0101 0100
160 - 1010 0000
53 - 0011 0101
137 - 1000 1001
What are the two ways negative numbers are represented in binary
- Sign magnitude
- Two’s complement
How do you convert a Binary Number into a negative number using Sign Magnitude
- A leading 1 is added for a negative number
- A leading 0 is added for a positive number
Convert the decimal number -21 into a two’s complement binary number (Method)
128 64 32 16 8 4 2 1
0 0 0 1 0 1 0 1
One’s Complement (Flip) - 1 1 1 0 1 0 1 0
Two’s Complement (+1) - 1 1 1 0 1 0 1 1
Answer = 1110 1011
Subtract the binary number
0000 1111 from 1001 0100
Two’s Complement 0000 1111 = 1111 0001
Add the two numbers - 1001 0100
+ 1111 0001
=[1] 1000 0101
Answer = 1000 0101
Compare Decimal and Hexadecimal Numbers
Convert the binary 1111 0101 into hexadecimal
Split into 4 - 1111 0101
Work out the value of both parts - 1111 = 15 0101 = 5
Convert into Hexadecimal - 15 = F 5 = 5
Answer = F5