Computer Systems
There are 10 groups of people in the world Those who understand binary Those who don’t
What you need to know Conversion from binary to decimal and vice versa Representation of positive numbers up to 32 bits Representation of negative numbers (using two’s compliment) up to 8 bits Conversion to and from bit, byte, kilobyte, megabyte, gigabyte, terabyte Description of floating point representation
Data Representation
Computer Data The purpose of this unit is to find out how data is stored in a computer There are 3 types of data: Numbers (integer (+ and -) and real) Text (ASCII and Unicode) Graphics (bit mapped and vector)
Why we use decimal numbers Humans use the number system called base 10 (decimal). The reason for this is that humans have ten toes and ten fingers. This system requires the use of ten different numbers (0 to 9).
If we have to represent a number greater than nine then we have to introduce another column (10’s). The place value system that works with decimal is shown below 10,000 1,000 100 10 units
Binary numbers Binary numbers are numbers which represent the base 2. The columns in binary are… 27 26 25 24 23 22 21 20 128 64 32 16 8 4 2 1
Binary Vocabulary Here is an example of how to convert the binary number 11011010 to a decimal: 128 64 32 16 8 4 2 1 1 1 0 1 1 0 1 0 = 128 + 64 + 16 + 8 + 2 = 218
Binary Vocabulary - Revision A bit is short for binary digit. A bit can either be a 1 or a 0. A byte is a group of 8 bits. This can take on 28 = 256 possible values. A nibble is a group of 4 bits. There are 2 nibbles in 1 byte.
Positive Integers Positive integer numbers can be converted exactly in to their equivalent binary numbers. The size of number that can be handled depends on the number of bytes allocated to each number.
For example, if two bytes (16 bits) are used to store each integer number then this can handle numbers in the range from 00000000 00000000 up to 11111111 11111111 In decimal this is 0 to 216-1 = 0 to 65535
If you use 3 bytes to store an integer this can handle numbers in the range from In decimal this would be 224 -1 = 0 to 16777215
Storing Positive Integers The range of numbers which can be stored is dependent on the number of bytes allocated 1 byte = 0 to 28 -1 2 bytes = 0 to 216 -1 3 bytes = 0 to 224 -1 4 bytes = 0 to 232 -1
If you use 4 bytes to store an integer this can handle numbers in the range from In decimal this would be 232 -1 = 0 to 4 294 967 295
Written Task Complete Qs 1 – 4 on pages 2 and 3 of How to Pass Higher Computing
More Revision Petabyte Exabyte Zettabyte Yottabyte 1 byte – 8 bits 1 kilobyte = 1024 bytes 1 megabyte = 1024 kilobytes 1 gigabyte = 1024 megabytes 1 terabyte = 1024 gigabytes Petabyte Exabyte Zettabyte Yottabyte
Conversion You need to be able to convert to and from bits – bytes - kilobytes, etc If you have 2 quantities in different unit values you must put them into the same unit value to perform calculations
Conversion example 1 A CD writer writes at 1200 Kb per second Hard disk writes at 2 Mbs per second 300 megabytes of file size Calculate the time the transfer will take on each device 300 Mb * 1024 = 307200 Kb 307200 / 1200 = 256 seconds 2. 300/2 = 150 seconds (already in same format so no need to convert)
Conversion Example 2 CD writer reads at a speed of 1500 Kbps 3 minutes to read a file What is the size of the file? 3 minutes * 60 = 180 seconds 1500 kbps * 180 seconds = 270000 Kbs 270000 / 1024 = 263.67 Mb If the answer is greater than 1024 you should always divide again
Negative Integers Negative integers can be represented using a method called Two’s Compliment Two’s compliment involves 3 simple steps Convert the positive number to binary Change all the 1’s to 0’s and all the 0’s to 1’s (called inverting) Add 1 to the result
Example Two’s complement of 5 (to get negative 5) +5 in binary = 00000101 Invert to 11111010 change 1s to 0s + 00000001 add 1 11111011 = -5 in two’s complement
-5 in two’s compliment to get +5 10000101 Invert to 01111010 change 1s to 0s + 00000001 add 1 11111011 = -5 in two’s complement
Sample Exam Question Write the following numbers as 8-bit binary numbers using two’s compliment (i) –18 (ii) –26 +18 in binary = 00010010 Invert = 11101101 Add 1 = 00000001 -18 in 2s comp =11101110 +26 in binary = 00011010 Invert = 11100101 Add 1 = 00000001 -26 in 2s comp =11100110
Express -10 using 2’s compliment
Express -10 using 2’s compliment
Express -6 in binary using two’s compliment
Express -6 in binary using two’s compliment
Express -25 in binary using two’s compliment
Express -25 in binary using two’s compliment
Express -92 in binary using two’s compliment
Practice for you Chose 5 numbers between 1 and 100 and show the binary negative number using two’s compliment – to be done in your jotter Check your answers using the Scholar website
Real Numbers We can represent real numbers in decimal by extending the power column further to the left as show below: 103 102 101 100 . 10-1 10-2 10-3
The same method can be used to represent fractional numbers in binary: 23 22 21 20 . 2-1 2-2 2-3 8 4 2 1 . 1/2 1/4 1/8
How does the binary number 1001.111 represent in decimal ? 8 4 2 1 . 1/2 1/4 1/8 1 0 0 1 . 1 1 1 Add up 8 + 1 + 1/2 + 1/4 + 1/8 = 9.875 (8 + 1 +0.5 + 0.25 + 0.125 )
This system is not usually used as there is no way to find out where the binary point is stored. The solution to this is to keep the binary point in a fixed position and move the bits about.
Floating Point Representation Any decimal number can be represented by using a mantissa, an exponent and a base. exponent 0.23 X 1056 mantissa base
The same system can be used in binary as long as the binary point is assumed to be at the start of a floating point number. Example The fractional number 1001.111 would be stored as 1001111 (mantissa) 100 (exponent).
1001.111 1001111 (mantissa) - the number being stored 100 (exponent) – the number of places to move the binary point (remember the exponent is also stored in binary so 100 means 4!!!)
1001.111 The exponent (100) tells the computer to place the binary point four places from the start of the mantissa. As the binary point is assumed to be at the start of any floating point number, only the mantissa and exponent need be stored.
To change 1101.0011011101 in to floating point in binary is similar except the point is moved in front of the first 1 and we are in binary. So 1101.0011011101 would be written as .11010011011101 * 24 where the 4 is the number of places that the point has moved and the 2 is the base (because we are working in binary)
1101.0011011101 The full answer is .11010011011101 *2100 because the 4 is converted into binary as well. The computer would store the mantissa 11010011011101 and exponent 100 Because we are always working in binary with a base of 2 we don’t need to store the base
ANOTHER EXAMPLE 11100101 =11100101.0 =0.11100101 x 28 (because we have moved the point 8 places) MANTISSA BASE EXPONENT The exponent would be store as 00001000
The normal way is to use four bytes for the mantissa and one byte for the exponent This gives nine figure accuracy when converted to decimal) and a range of 20 to 2255 which is approximately 100 to 1076.
Accuracy - Mantissa 1/3 = 0.33333333333333 ………….. 1/3 = 0.333 The first method is more accurate because there are more decimal places In floating point the number of bits in the Mantissa determines the accuracy – the more bits the more accuracy.
Range - Exponent Increasing the number of bits allocated to the exponent increases the range of numbers that can be stored. Exponent with 4 bits = 24 = 16 numbers Exponent with 8 bits = 28 256 numbers
Written Task Complete Q 11 on page 5 of How to Pass Higher Computing
Representing Text ASCII and Unicode
What you should already know Every character is stored as a unique binary code A character is a letter, number or symbol from the keyboard Character Set is all the characters that the computer can store and process
How is Text stored? Two common methods of storing text are ASCII Unicode
ASCII American Standard Code for Information Interchange. Each character has a unique ASCII code Allows text to be transmitted between computers using a common standard
ASCII codes can be used to represent the following: Digits 0 to 9 Upper and Lower case letters Symbols such as (!,#$?) Control characters
Control Characters ASCII codes 32 – 47 are for symbols and control characters Return Break Escape Caps Lock 48 – 57 represent 0 – 9 65 – 122 represent upper and lower case letters
More… On all computers the ASCII codes from 0 to 127 are fixed Those from 128 to 255 can be used for anything the computer manufacturer desires
How many characters can be stored? 7 bits are used to store each character The 8th bit is used as a parity check digit (explained later) If 7 Bits are used: = 27 = 128 characters If 8 Bits are used: = 28 = 256 characters
Unicode Developed to enable representation of all languages not just English/American/European Uses 16 bits to represent each character 216 = 65536 characters
Advantages of Unicode over ASCII More characters can be represented Many languages can be represented Unicode becoming more popular as the standard for text transfer
Written Task Complete Qs 12 – 15 on page 6 of How to Pass Higher Computing
Disadvantage of Unicode Requires double the storage space of ASCII to store each character
Representing Graphics
What you need to know about graphics Features of bitmapped graphics Relationship between bit depth and number of colours (up to 24 bit true colour) Features of vector graphics Advantages and disadvantages of different methods of graphic representation Relationship between bit depth and file size The need for data compression
How are graphics stored? There are 2 ways to store a graphic: Bit Mapped Graphic Vector Graphic
Bitmapped Graphics
Bit Mapped Graphics Computer stores the graphic as a 2 dimensional array of pixels On a monochrome image each pixel is represented by 1 bit Once drawn, each pixel can be edited individually Every pixel is stored
Disadvantages of Bitmaps Graphic cannot be resized without pixelation occurring Graphic will always stay the same resolution that it was created in – this is called Resolution Dependent Take up a large amount of storage space
Resolution Dependent A graphic is created at 300 dpi A printer prints at 600 dpi The graphic is sent to the printer The graphic only prints at 300 dpi not 600 dpi
Storage requirements of bitmaps Storage in bits = area X resolution X bit depth
Black and White – Example 1 Graphic resolution 600 dpi Graphic size 2” x 5” 2 X 5 X 600 X 600 x 1 =3600000 bits / 8 =450000 bytes / 1024 =439.5 Kb
Black and White Example 2 A4 page (10” x 8”) Resolution 1200 dpi 10 X 8 X 1200 X 1200 x 1 = 115200000 bits / 8 = 14400000 bytes / 1024 = 14062.5 Kb / 1024 = 13.73 Mb
Using Colour We have seen that each pixel of a monochrome image can be represented by 1 bit where 1 represents black and 0 represents white If we wish to display more than just black or white then each pixel requires more than 1 bit
Real life isn’t just black and white – even if grey is used there are 256 different shades of grey!!! Lots of colours are required to represent real life Each pixel needs more than 1 bit to represent each colour or shade This is know as the bit depth of a graphic
This image uses 16 colours
This image uses 256 colours
This image uses 16,777,216 colours – this is called true colour
Number of colours available The number of colours or shades depend on the bit depth of each pixel The greater the bit depth the greater the range of colours
No. of bits No. of possible used colours 1 21 = 2 colours 2 22 = 4 colours 3 23 = 8 colours 4 24 = 16 colours 5 25 = 32 colours 6 26 = 64 colours 7 27 = 128 colours 8 28 = 256 colours The more colours an image has, the greater the memory requirements.
Colour – example 1 Same as example 1 for black and white but with a range of 16 colours (24) Graphic resolution 600 dpi Graphic size 2” x 5” Bit depth 4 Calculate the storage requirements?
Colour Example 1 2 x 5 x 600 x 600 x 4 = 14400000 bits / 8 = 1800000 bytes / 1024 = 1757.81 Kb / 1024 = 1.72 Mb This is substantially different from the 2 colour version at 439.5 Kb
Colour example 2 Same graphic but with a bit depth of 24 bits and a resolution of 1200 dpi 2 x 5 x 1200 x 1200 x 24 = 345600000 bits / 8 = 43200000 bytes/1024 / 1024 = 41.2 Mb
Colour Example 3 Graphic size is 2” X 2” Resolution of 90 dpi is used 256 colours are used 2 X 2 X 90 X 90 = 32400 pixels Bits per pixel = 8 (256 colours) 32400 X 8 = 259 200 259 200 / 8 = 32400 bytes/1024 = 32Kb
Colour Example 4 Graphic size is 4” X 5” Resolution of 100 dpi is used 16 shades of grey are used 4 X 5 X 100 X 100= 200000 pixels Bits per pixel = 4 (16 colours) 200000 X 4 = 800000 bits 800000 / 8 = 100000 bytes/1024 = 98 Kb
Colour Example 5 Graphic size is 4” X 2” Resolution of 200 dpi is used 256 colours are used 4 X 2 X 200 X 200= 320000 pixels 8 Bits per pixel = 256 colours 200000 X 8 = 2560000 bits 2560000 / 8 = 320000 bytes/1024 = 312.5 Kb
Colour Example 6 Graphic size is 3” X 6” Resolution of 80 dpi is used 64 colours are used 3 X 6 X 80 X 80= 115200 pixels Bits per pixel = 6 (64 colours) 115200 X 6 = 691200 bits 691200 / 8 = 86400 bytes/1024 = 84 Kb
Points to remember about Bitmaps If a graphic is made larger, then it appears blocky (pixelated) 2. Bit-mapped graphics which have a high resolution or use many colours have a high storage requirement 3. The storage requirement for a screen stays constant even if you add more detail to it
4. A blank screen takes up the same storage requirements as a complex screen. 5. Examples of commands which are unique to bit-mapped applications are those that directly alter a pixel or a group of pixels, for example, set pixel, fill area. 6. Bit-mapped graphics are usually created in paint packages like Paint Shop Pro 7. You can’t edit a whole object, move whole objects or layer objects
Compression Because of their large file size many bitmapped graphics are compressed Colours are compressed Extraneous data is deleted
Vector Graphics A vector graphic is a graphic stored as a set of commands of how to draw the object (similar to a program) Each object is made up out of different attributes (Properties)
Circle has the following attributes Centre X, Centre Y, radius, line thickness, fill pattern, pen colour, fill colour Centre (X,Y) Radius
Rectangle has the following attributes Start X, Start Y, End X, End Y, line thickness, fill pattern, pen colour, fill colour Start (X,Y) End (X,Y)
Layering It is possible to combine 2 or more objects together to make another shape These objects can be moved individually and one can be sent behind the other – this is called layering
The following example uses a circle in the background, a rectangle in the middle and text in the foreground No Entry + + No Entry
Commands are not dependent on the number of pixels on the screen or on how many colours can be displayed Objects are resolution independent When a vector graphic is sent to print the attributes/program for each shape are sent This allows the graphic to print at the resolution of the printer
Points to know about vector graphics If the image is resized then the quality of the image should stay constant Allows layers of objects (good for DTP and CAD) Eg allows you to move a circle in front of a square without destroying the square.
A blank screen takes up very little storage compared to the bit-mapped version As more objects are placed on screen, the storage requirements increase The vector graphic take advantage of any high resolution device they are used on (resolution independence)
Past paper questions on graphics 1. A graphic of resolution 72 DPI is printed on a 300 DPI printer, the graphic will still only print at a resolution of 72 DPI. Explain why this might happen? 2. Describe 2 ways of finding out if a graphic was created using a bitmap or a vector graphics package.
Vector Actions Examples of actions which can be carried out in vector applications are: Order of objects could be changed Individual Objects can be resized Individual Objects can be moved or edited Objects can be resized with no loss of quality
Written Task Complete questions 16 – 21 on pages 8 and 9 of How to Pass Higher Computing
Written Task In your jotter copy and complete the table below showing the advantages and disadvantages of each type of graphic Bitmap Graphic Vector Graphic Advantages Disadvantages
Graphics Practical Exercise You should now complete the practical exercises on vector graphics
What you should have learned in about storing numbers Conversion from binary to decimal and vice versa Representation of positive numbers up to 32 bits Representation of negative numbers (using two’s compliment) up to 8 bits Conversion to and from bit, byte, kilobyte, megabyte, gigabyte, terabyte Description of floating point representation
What you should have learned about representing text Description of ASCII Description of Unicode Advantages and disadvantages of each method of representing text
What you should have learned about storing graphics Features of bitmapped graphics Relationship between bit depth and number of colours (up to 24 bit true colour) Features of vector graphics Advantages and disadvantages of different methods of graphic representation Relationship between bit depth and file size The need for data compression
What you should do now Complete the end of topic confidence evaluation sheet Complete the Activote Assessment Complete the End of Topic Checkup