Data Types and Binary Flashcards
(15 cards)
What is an integer?
A whole number e.g. 1,5 or -16.
What is a float?
Also known as a real it is a decimal number like 3.5 or -0.123.
What is a boolean?
A variable that can only take the value true or false.
What is a char?
A single character, e.g. ‘A’.
What is a string?
An array of chars, a string of letters, e.g. “hello world”.
Why do we use hex?
Because it’s easier to write and understand than binary but is very easy to convert (as each digit is 4 binary digits).
What is ASCII?
American Standard Code for Information Interchange, it is a list of 128 different characters or values like NULL used to convert readable strings into integers the computer can use.
What is unicode?
A universal character set that allows computers from countries with different character sets to communicate.
What is an overflow error?
Where two binary numbers are added together and create a number larger than the largest number the datatype can store, this digit is then lost.
What are the two methods for representing negative numbers?
Sign and magnitude or two’s complement.
How do you convert a two’s complement number to a sign and magnitude one?
Flip the digits, add one and stick a 1 in front.
Uses of floating point?
Allows very small and large numbers to be stored in much smaller space but with a low accuracy.
What is the form of a normalised floating point number and why do we do it?
The first two digits must either be 1.0 or 0.1 giving maximum precision.
What is a logical shift right on a binary number?
All numbers are moved right with a 0 (or 1 if negative) added to the front of the number, equivalent to dividing by 2.
What does an arithmetic shift left do?
Moves all digits left ignoring the first digit (shifting should not make a positive number negative!), add a 0 on the end.