Computer Science Topic 3 - Data
- Created by: 14imogehalli
- Created on: 27-01-19 15:59
Binary
A binary number is a way of representing Denary numbers in just two digits 0s and 1s. It is also known as base 2. One number in binary is known as a bit, 4 bits are a nibble and 8 bits are a byte. If there is a 1 it means that number is present in the denary number, but id theer is a 0 that number is not part of the sum to make the denary number
Example
128 64 32 16 8 4 2 1
0 1 0 0 0 1 1 1 = 64+4+2+1 = 71
Hexadecimal
Hexidesimal is like binary in the way that it is a way of the computer storing data without using words. However, unlike binary it uses letters and numbers and is base 16. It uses: 1,2,3,4,5,6,7,8,9,A,B,C,D,E and F (base 16). An advantage of hex is that it is shorter and not as complicated as binary and it takes up less storage than binary would. Hex only works in nibbles (4 bits). To convert from binary to hex, you seperate the binary into nibbles and work out the value of each nibble. These values are then converted into the corrosponding values in hex e.g. if one nibble was equal to 14 then the hex would be E. To convert from denary to hex then you initially convert it to binary, sepertae thebinary into nibbles and then convert the nibbles into hex. To convert from hex to denary, you multiply the denary equivalent of the hex bit to the left by 1 and the bit to the right by 16. These numbes are then added together.
ASCII
ASCII stands for American Standard Code for Information Interchange and is a 7-bit code that contains 128 characters. It is used to encrypt a message that is in English and not only contains letters but also symbols and punctuation.
Extended ASCII
Extended ASCII is slightly different to original ASCII as it refers to an 8-bit code not 7-bit. It is the same as normal ASCII however it contains another 128 characters that are used to represent many European languages that involve other punctuation such as accents and umlauts.
Unicode
Unicode is also a form of encryption however it was developed to account for every language in the world. The first 128 Unicode points are the same as ASCII but there are thousands more after that that consist of the rest of the characters. An example use of Unicode is that it would allow a user from any country to select their language when setting up an operating system - the Unicode character set would account for every language.
Signed Integers
An integer is a whole number and is used in binary and hexadecimal forms of encryption. A signed integer is an integer that has been given either a positive or negative value.
Twos Complement
Twos complement is a way of representing and performing calculations with negative numbers. An advantage of twos complement is that it is more effective when performing mathematical operations. Twos complement uses the first bit of a binary number as the MSB (Most Significant Bit). When the MSB is 1 then the number is negative, if it is 0 the the number is positive. When finding the twos complement of a denary number, you are finding the negative equivilant of that number written in binary form. To convert it you switch all of the numbers in the binary form to the opposite e.g. 100110010 becomes 011001101. From this you then find the first number that is a 0 and change all the other numbers befor ethis to a 0 e.g. 011001101 becomes 011001100. This binary number is then the twos complement of the original binary number.
Logic Shifts
Logice shifts are for multiplying and diviing unsigned numbers in binary form. To multiply a number you see how many powers of two are in the number you are multiplying the binary number by e.g 4 is 2 to the power of 2. You then shift all the binary numbers to the left however many times the power was e.g. 10011100 would be shifted twice to the left (if multiplying it by 4) to become 01110000. The bits at the end that replace the two missing bits become 0s. When dividing an unsigned integer you use the same process however instead of shifting to the left, you shift the bits to the right. The bits that replace the original ones at the start also become 0s e.g. 10011100 divide by 4 becomes 00100111.
Arithmetic shifts
Arithmetic shifts are also used to multiply/divide numbers in binary form however they are used for signed integers. To multipy a signed integer, you do the same process as you would when multiplying an unsigned integer. However, the MSB of the binary number does not move like the rest of them e.g. 100011101 becomes 1011101000 when multiplied by 4. When dividing signed the MSB also does not change and you use the sme process as you would for unsigned integers. Despite this, instead of replacing the original bts with 0s, they are replaced with copies of the MSB e.g. 11000011 divided by 4 becomes 11100001.
Types of data compression
There are two different types of compression used to compress file sizes. Lossy compression removes pieces of information that you cant't hear/see to reduce the amount of storage the file will take up and will leave the essential data. despite this, repeated compression will reduce the quality of the file. Lossless compression recognises patterns and goups together the data accordingly - it will only store repeating pixels in an image once. Lossless compression does not damage the quality of the file.
Image compression
Image compression is used to decrease the size of a dile either to end it orto decrease the amount of storage it uses. Advantages of image omprssion are that it allows more files to be stored on a system and that it reduces the time it takes to upload the image when receiving it. Disadvantages of image compression are that it can take a long time to compress larger files as they program has to run through every bit of information to suitably compress the image and that repeated compression will damage the quality of the image.
Bitmap and Vector images
An image is either a bitmap or a vector. Bitap refers to an image composed of pixels. The more pixels in a bitmap imae, the higher the resolution and therefore the better the quality. Vector images are images composed of different shapes.
Image file sizes
The size of an image file in bits depends on image size and colour depth. Colour depth refers to the number of pixels on a computer/TV screen. The more bits per pixel, the higher the colour variety and quality of the monitor. The file size in bits can be calculated using: (width (pixels) x height (pixels) x colour depth)/8.
Analog and Digital sound
An analog recording is made by impriniting the signal directly onto a master tape or master record, from which copies can be made into cassette tapes and vinyl records. Digital recordings take that analog signal and converts it into a digital representation of the sound, which is essentially a series of numbers for digital software to interpret.
Sound file sizes
To calculate the file size of a sound sample in bits, use:
(sample rate x sample resolution x number of seconds)
Run length encoding
RLE is a basic form of data compression that compresses data by compressing similair values into the value and how many times it is repeatd in one stage of the program e.g. AAABBCADDEE becomes 3A2BCA2D2E.
Encryption
Encryption is the scrambling of a message so that a third party cannot understand it. Encryption is carried out by a program called a cipher ehich often uses keys - one key is used to encrypt the code and another is used to decrypt it so it can be understood by the intended recipient. There are various different forms of encryption, one of which s Caesar Cipher - a simple encryption designed by Caesar to encrypt messages so that only those who knew the key could understand them. If the key is negative, you shift the letters to the left, and if it is positive you shift them to the right
e.g. A B C D E F G H I
-2 C D F G H I J K L
Databases
A database is an example of a way of storing structured data so that it is easy for a person to find data as the database will search and sort the data dor them. Structured data is data that is stored in an organised and ordered manner and makes it quicker for the user to retrieve the data. Unstructured data is data that is stored in an unorganised manner and often refers to emails, word documents, images and social networking activity ( emails can be stored in order of date and time they were created/received but for them to be truly structured they mus be organised into subject specific emails).
Attributes, entities and tables
An entity is something in a database that is recognised as being capable of independent existance outside of the database, which can be uniquely identified and which data can be stored against. An entity can be a physcial object or a concept. For example a school has many different entities - students, subjects, teachers and lessons to name a few. A student is taught a certain subject by a certain teacher in a particular lesson making it an entity. An attribute is a property that is used to describe an entity. In a table each entry is represented in a column that consists of attributes. This data is structured because it is stored in an organised manner.
Relational Databases
A relational database has more than one table and the tables are linked using key fields (a foreign key) . For example when a student joins a school a record is created - it stores the student's details such as their first name, surname etc that can be used to uniquely identify them.
Comments
No comments have yet been made