13: Data Types Flashcards
What are 5 kinds of data type?
String, character, float, boolean, integer
What is meant by a primitive data type?
Any basic data type provided by a language as a fundamental building block
What is an integer?
Any positive or negative whole number
What is a real/float?
Any positive or negative real-world quantity that can be expressed as a number
What is a string?
A collection of characters
What is a boolean data type?
Used to represent one of two truth values associated with logic and Boolean algebra: True and False
What is meant by casting?
Converting from one data type to another
What are the highest and lowest numbers that can be represented using Sign and Magnitude?
127 and -127
What are some rules to follow to represent a number in two’s complement?
- Write out positive version of the number
- Starting from the right-most digit (LSB) copy each of the digits exactly as they appear, up and including the first 1
- From that point on, swap the digits
How do you do binary subtraction?
- Make the second number using two’s complement
- add
What is the advantage of using floating point binary instead of normal binary?
gives greater flexibility as the range and precision of the numbers that can be stored in the same number of bits
How does range relate to accuracy in floating point binary?
- the more bits assigned to the whole number part of the mantissa, the larger the number that can stored, but at the cost of accuracy of the fractional part
What is the mantissa?
Number itself
What is the exponent?
The position of the binary point in the number
What do positive normalised numbers start with?
01