Data types (unit 6) (Finished) Flashcards
(6.1) What is a primitive data type?
A primitive data type is one which is provided by (or built into) a programming language
(6.1) What are some examples of primitive data types
Integer
real/float
boolean
(6.1) Why are data types important?
Because all data types are held in binary, so knowing the data type of the number is extremely important
(6.1) Why do some variables need to be defined?
some variables need their data types defining so that they can be properly utilized
Such as in Java
(6.1) What is base 10?
Denary- only uses 10 numbers to create every number
(6.1) What is base 2?
Binary- only uses 1s and 0s
(6.1) What is base 16?
Hexadecimal- uses 1-9 and A-F for 10-15
(6.1) How is denary converted to hex?
divide by 16 and add the remainder as a separate number
eg 43/16= 2 remainder 11
because 11= b the answer is 2b
to check that this is correct we can do
2*16= 32 + b(11)= 43
(6.1) How is binary converted to hexadecimal?
binary number is split into 2 bits and a number is made of each
eg 11101011 = 1110 1011
1110 = 14= E
1011 = 11 = B
EB
(6.1) What is hexadecimal used in?
RGB colour codes
MAC addresses
Memory locations
(6.1) Why is hex used?
A hexadecimal value is much easier to read and remember than a string of binary digits
It is quicker to write or type, since a hex digit takes up only one character, not four
There is less chance of making an error when typing hex characters than a string of 1s and 0s
It is very easy to convert to and from binary
(6.2) In what way are computers similar to light bulbs?
Data is stored and processed using combinations of ON and OFF voltages, equivalent to a lamp turning on and off where ON = 1 and OFF = 0
(6.2) What is a bit?
Each individual digit in a binary value is referred to as a bit, (from the term binary digit)
(6.2) What is a byte?
A byte is a collection of 8 bits
Two or more bytes can be grouped together to hold larger values
(6.2) What are the names and amounts for types of bytes?
kilo(kB)- 1.000
mega(MB)- 1,000,000
giga(GB)- 1,000,000,000
tera(TB)- 1,000,000,000,000
(6.2) What is ASCII code?
American Standard Code for Information Interchange, (ASCII,)- used to encode symbols found in the English alphabet
Had limitations due to the amount of characters it could contain
(6.2) why are numerical characters not always the same binary value as their converted value?
because not all numbers are going to be used in a numerical/mathematical way. For example, a house number in a database full of addresses
(6.2) What is Unicode?
Standardises the encoding of characters from all languages
(6.2) What are some advantages of Unicode?
Every character in every language can be represented
(6.3) How does binary addition work?
add the digits in the same columns, carry when the value is >1
(6.3) What is the problem with adding binary values?
it can cause overflow errors
(6.3) What is the formula for calculating the range of which a number of binary values can represnet?
2(to the power of n)- 1