Data types Flashcards
What is a primitive data type?
A data type which is provided by a programming language
integer-whole number 2
real/float-decimal number 3.421
Boolean-true ,false
character-letter number symbol
string-anything enclosed in speech marks “peter” “9”
Hex
0-9:0-9
10-15:A TO F
Why to use hex?
Much easier to read and remember then a string of binary digits
quicker to write or type (only takes up one character)
less chance of making an error
What is a byte
A collection of 8 bits
Sign and magnitude
The first bit acts as the sign:
0 for +
1 for -
Two’s complement
Find value in binary if needed
Flip all the bits (0 to 1)
Add 1
What is ASCII
Each character of the alphabet and some special symbols and control codes are represented by agreed binary patterns
The ASC11 character set was original;y based on an 8-bit binary pattern using seven bits plus a single parity bit and was able to represent 128 separate characters
The extended ASC11 set uses eight bits and so can represent 256 separate characters
With just eight bits available in the ASC11 system the number of characters is limited to 256, making it impossible to display the wide range of characters for other alphabets or symbols sets
What is unicode?
Unicode was originally a 16-bit code allowing for more than 65000 characters were represented
This was updated to remove the 16-bit restriction by using a series of code pages with each page representing the chosen languages symbols
The original ASC11 representations have been included as part of the Unicode character set with the same numeric values.