Data types Flashcards
What does an AND operator do? (Mask)
AND operator is used to clear a particular bit, leaves the other bits unchanged
AND 1 and 0 meaning
Use 1 to keep the number the same
Use 0 to change the number
What does an OR operator do? (Mask)
OR operator used to set a particular bit, leaves the other bits unchanged
OR 0 and 1 meaning
0 the keep the number the same
1 to change/set the number
What does a XOR operator do? (Mask)
XOR operator used to toggle a particular bit, leaves the other bits unchanged
XOR 0 and 1 meaning
1 toggles the number
0 keeps the number the same
And truth table
0+0=0
0+1=0
1+0=0
1+1=1
OR truth table
0+0=0
0+1=1
1+0=1
1+1=1
XOR truth table
0+0=0
0+1=1
1+0=1
1+1=0
What mask do you use to make lowercase
Apply OR mask
0010 0000
What mask do you use to make uppercase
AND mask
1101 1111
Normalised floating point rules
Mantissa always starts with:
01 for positive numbers
or
10 for negative numbers
Why should you use the correct data type
Different data types take up different amounts of memory. To optimise program performance it’s important to use the correct data type where possible
What are the different data types
Integer
Real/float
Boolean
Character
String
Define primitive data type
Any basic data type provided by a language as a foundational building block