Olevel Computer Science Notes (2210)
December 1, 2016 | Author: Khawaja Shoaib | Category: N/A
Short Description
Notes For Perfect Revision Of O'level Computer Science (2210) Exam....
Description
1
Input Devices The devices that allow data and instructions to enter a computer (such as a keyboard, mouse, scanner) are called input devices. These further include kinds such as: Pointing devices Mouse Tracker-ball Touch-sensitive pad Joystick Light pen Text-input devices Keyboard Imaging and video input devices Webcam Image scanner / 3d Scanner Barcode reader Voice Input Device (Microphone) Sensors:-
Biometric Devices They allow people to be identified based on unique characteristics. Examples include fingerprint scans, iris scans, and voice recognition. Biometric devices utilize technology to capture and process this type of information. Such devices may be found at airports, government buildings, and law enforcement agencies Computer Science 2210/10th C Notes/By M Shoaib
2
Output Devices An output device is any piece of computer hardware equipment used to communicate the results of data processing carried out by an information processing system (such as a computer) which converts the electronically generated information into human-readable form.
Computer Monitor LCD LED Plasma screen Printers Inkjet Printer LaserJet Printer Dot-matrix Printer 3d Printer Audio Output Devices Speakers Headphones Projectors DLP LCD Plotter: Plotters are a specialist type of printer which is able to draw high quality images on very large pieces of paper, for example 3 foot wide by 10 foot long. LEDs (Indication lights)
Computer Science 2210/10th C Notes/By M Shoaib
3
Computer Science 2210/10th C Notes/By M Shoaib
4
Serial & Parallel Data Transmission Serial Transmission: In serial transmission, bits are sent sequentially on the same channel (wire) which reduces costs for wire but also slows the speed of transmission. Also, for serial transmission, some overhead time is needed since bits must be assembled and sent as a unit and then disassembled at the receiver. Parallel Transmission: In parallel transmission, multiple bits (usually 8 bits or a byte/character) are sent simultaneously on different channels (wires, frequency channels). Parallel devices have a wider data bus than serial devices and can therefore transfer data in words of one or more bytes at a time. As a result, there is a speedup in parallel transmission bit rate over serial transmission bit rate. Difference b/w Serial & Parallel Transmission In serial communication, data is sent one bit at a time, sequentially, over a communication channel or a computer bus. Communication links across which computers-or parts of computers-talk to one another may be either serial or parallel. Parallel transmits several streams of data simultaneously along multiple channels.
Operating Systems The operating system (OS) is a program that, after being initially loaded into the computer by a boot program, manages all the other programs/applications. On a PC, the first program that runs is stored on a ROM chip. This program checks the system hardware to make sure everything is functioning normally. This checks the CPU, memory and basic input-output systems (bios) for errors. If all is satisfactory, the BIOS will activate the disk drives. When the hard drive is activated, the OS is found in the boot and is then loaded. The following is a list of functions carried out by various operating systems:
provides a user interface device management (input/output control) security (e.g. log on, passwords, etc.) handles interrupts spooling memory management multitasking batch processing multiprogramming error reporting and handling loading and running software processor management maintain user accounts utilities (such as copy, save, re-name, etc.)
Computer Memory There are two main types of Memory:-
Computer Science 2210/10th C Notes/By M Shoaib
5
Primary (Volatile) Memory Primary memory is computer memory that a processor or computer accesses first or directly. It allows a processor to access running execution applications and services that are temporarily stored in a specific memory location. Primary memory is also known as primary storage or main memory. For Example RAM, Cache etc… Secondary (Non-volatile) Memory Secondary memory is computer memory that is non-volatile and persistent in nature and is not directly accessed by a computer or processor. It allows a user to store data that may be instantly and easily retrieved, transported and used by applications and services. Secondary memory is also known as secondary storage. For Example USB Flash Device, Hard disk drive etc… The difference between primary and secondary storage, is that primary is considered as the main memory, while secondary is an additional memory. Primary storage is the only memory that is accessed directly by the CPU. It has the ability to store and retrieve information. It uses RAM and ROM. On the other hand, secondary memory is not directly accessed by the CPU. Secondary memory is a storage device like a hard disk. Offline storage includes floppy disks, magnetic tape, punched cards, and USB flash drives. These are easily detachable from the computer system. Data Storage Devices: A data storage device is a device for recording (storing) information (data). CD (Compact Disks) DVD: Essentially, each is a recordable variation of the DVD format. They allow the recording of audio, video, data, etc. on DVD discs. DVD-R is a one-time recordable disc, similar to a CD-R. If used to record video, it should be playable on most DVD players. DVD-RAM, DVD-RW and DVD+RW are competing, rewriteable DVD formats. Floppy disk Memory card/stick Computer Science 2210/10th C Notes/By M Shoaib
6 RAM: Random-access memory (RAM) is a form of computer data storage. A random-access device allows stored data to be accessed directly in any random order. It is a Primary Memory and Volatile Memory device. ROM: Read Only Memory (ROM) is a type of "built-in" memory that is capable of holding data and having that data read from the chip, but not written to. Unlike Random Access Memory (RAM), ROM is non-volatile which means it keeps its contents regardless if it has power or not.
Interrupts In systems programming, an interrupt is a signal to the processor emitted by hardware or software indicating an event that needs immediate attention. An interrupt alerts the processor to a high-priority condition requiring the interruption of the current code the processor is executing, the current thread. Hardware Interrupt: It is an electronic alerting signal sent to the processor from an external device, either a part of the computer itself such as a disk controller or an external peripheral. Software Interrupt:Software is also allowed to issue interrupts to the CPU. For example software has detected that an error has occurred and will issue a software interrupt for the CPU to run some instructions to try to clear the error.
Computer Ethics (Data Protection Act) The Data Protection Act controls how your personal information is used by organizations, businesses or the government. Everyone who is responsible for using data has to follow strict rules called „data protection principles‟. They must make sure the information is:
used fairly and lawfully used for limited, specifically stated purposes accurate kept for no longer than is absolutely necessary handled according to people‟s data protection rights kept safe and secure not transferred outside the country without adequate protection
Computer Security How to keep data safe from physical damages?
Keep doors and windows locked. Don‟t leave a spare house key outside. Be careful about who you let into your home. Keep private paper records such as passports, bank statements and National Insurance number, under lock and key if possible. Fit a burglar alarm. Do not advertise the presence of computer equipment by leaving it on view through windows and glass doors. Consider using a computer locking cable to make it harder to steal. Consult with your insurance company or local crime prevention officer for additional security advice. Make a copy of your data (Backup Copy) Computer Science 2210/10th C Notes/By M Shoaib
7 If Your PC or Laptop is Stolen or Lost If you have either stored passwords in a document on your PC or laptop, or have ever ticked the „remember this password‟ box on a website, change any passwords as soon as possible after the theft or loss. Notify the Police (or if the theft or loss has occurred on a train, the British Transport Police) and obtain a crime or loss reference number for tracking and insurance purposes. Firewall: Software protection A firewall is a program or hardware device that filters the information coming through the Internet connection into your personal computer or into a company's network. It is set up to allow mainly one way access, i.e. you can go out onto the Internet and access pages, but it checks everything coming back against a set of rules. If the data coming back is from an unauthorized source, then it is blocked. Antivirus: Software protection The software tries to detect viruses before they can get access to your computer. If a virus is detected trying to get through the firewall, the software will give an alert and ask how you want to respond. It is also important to run an 'anti-virus' scan regularly, just to make sure that there aren't any viruses lying dormant on your system. Checksum A checksum or hash sum is a small-size data computed from an arbitrary block of digital data for the purpose of detecting errors that may have been introduced during its transmission or storage. Check digits and parity bits are special cases of checksums. Parity-bit A parity bit, or check bit, is a bit added to the end of a string of binary code that indicates whether the number of bits in the string with the value one is even or odd. Parity bits are used as the simplest form of error detecting code. There are two variants of parity bits: even parity bit and odd parity bit. In case of even parity, the parity bit is set to 1 if the count of ones in a given set of bits (not including the parity bit) is odd, making the count of ones in the entire set of bits (including the parity bit) even. 8 bits including parity 7 bits of data
(count of 1 bits) even
odd
0000000
0
00000000
00000001
1010001
3
10100011
10100010
Computer Science 2210/10th C Notes/By M Shoaib
8 1101001
4
11010010
11010011
1111111
7
11111111
11111110
Check digit A check digit is a form of redundancy check used for error detection on identification numbers (e.g. bank account numbers) which have been input manually. It is analogous to a binary parity bit used to check for errors in computer-generated data. It consists of a single digit (sometimes more than one) computed by an algorithm from the other digits (or letters) in the sequence input. Proxy server A 'proxy' is a word meaning substitute or stand-in. A proxy server reduces the bandwidth required for internet access. It does this by keeping a copy of often-used web pages in its local 'cache'.
Secure Socket Layer SSL stands for 'Secure Socket Layer'. It is a web browser security technology. SSL is built into a web browser. SSL allows trusted data to safely pass from your web browser to a distant server via the Internet. The confidential data is 'encrypted' or scrambled so that only the server can read it. Data Encryption Symmetric encryption:A type of encryption where the same key is used to encrypt and decrypt the message. This differs from asymmetric (or public-key) encryption, which uses one key to encrypt a message and another to decrypt the message. Cypher-text
Computer Science 2210/10th C Notes/By M Shoaib
9 In data encryption, cypher-text is known as encrypted or encoded information because it contains a form of the original plaintext that is unreadable by a human or computer without the proper cipher to decrypt it. Advantages and disadvantages of Online Shopping Advantages
It is saves time and energy. Easy to find a product. Variety of things / freedom of choice. High satisfaction percentage (secure shopping). Privacy. Buyer protection. Rare product can be found.
Disadvantages
Waiting time (takes time for delivery). You maybe a victim of online fraud. Your purchase may be mishandled during shipping. You have to spend a lot of time on deal hunting. Advantages and disadvantages of Online Banking
Advantages It is less time taking. You can use it almost anywhere. You do not need to wait in long lines as opposed to when going to the bank. Disadvantages The site is not always completely secure. This gives you more of a chance to be a victim of identity theft. The bank's web site may be poorly designed or very slow to use. Thus making it more difficult than it needs to be. Customers like to see who they are dealing with. If there are problems to sort out, then it is much easier to explain the problem face to face rather than having to use email or telephone. You can't deposit physical items such as cheques or cash online. You will need to visit the branch or send by post. HTTP HTTP stands for Hyper Text Transfer Protocol. HTTP is the set of rules that are used for transmitting files, (text, graphics, sound, video etc) over the World Wide Web. Almost every web page needs to start with http:// This tells the browser that the rules for moving files from the web server will be those defined by the protocol called 'http' Computer Science 2210/10th C Notes/By M Shoaib
10 SSL A network term. It stands for Transmission Control Protocol. It is important because it is one half of the network protocol used to control data on the Internet. The other half is IP. TCP is responsible for checking that data has been delivered correctly from your computer (the client) to another computer (the server). If data is lost, then TCP requests that the data is resent.
Browsing Web Web Browser: A web browser is a software application that provides a way to view and interact with pages on the World Wide Web. Web Server / Remote Server: The term web server can refer to either the hardware (the computer) or the software (the computer application) that helps to deliver web content that can be accessed through the Internet. Network Protocols: An agreed-upon format for transmitting data between two devices. Hypertext Transfer Protocol: HTTP is the set of rules that are used for transmitting files, (text, graphics, sound, video etc) over the World Wide Web. Hypertext Markup Language: It is the language used to create documents on the World Wide Web. IP Address: The IP address is the unique address given to a computer running on a TCP/IP network. It allows one computer to commmunicate with another one by sending data packets containing the destination IP address. Network Packets: It is a formatted unit of data carried by a packet-switched network.
Computer Science 2210/10th C Notes/By M Shoaib
11 Packets Switching: When data e.g. web pages, emails, instant messages etc are sent across the internet, they are not sent as one big file. Instead, the file is broken up into lots of parts called 'packets'. The packets are reassembled when they arrive at their destination.
Packets Switching: Advantages & Disadvantages The main advantages for packet switching are: Errors are localized. If a packet becomes damaged, only that packet must be re-sent. Multiplexing: several users, or several connections for the same user, can share the same line. The main disadvantages for packet switching are: In Packet Switching, it takes more time to transfer the data when it comes to the recipient, In case of real time video transfer. In other cases this problem is insignificant. There are variable delays in receiving packets.
File Formats Video File Formats:
Flash Video Format (.flv) AVI Format (.avi) MP4 Format (.mp4) Mpg Format (.mpg) Windows Media Video Format (.wmv) 3GP File Extension (.3gp) VOB Format (.vob)
Audio File Formats: MP3 Audio Format (.mp3) Computer Science 2210/10th C Notes/By M Shoaib
12 AAC Audio Format (.aac) WAV Audio Format (.wav) FLV: The Flash Video format is a video format defined by Adobe Systems. Flash Video is the standard video format used by nearly all embedded video on the Internet including the videos found on YouTube, Google Video, and many more websites. AVI: It stores data that can be encoded in a number of different codec‟s and can contain both audio and video data. The AVI format usually uses less compression than some similar formats and is a very popular format amongst internet users. MP4: This format is mostly used to store audio and visual streams online, most commonly those defined by MPEG. The MPEG-4 video format uses separate compression for audio and video tracks; video is compressed with MPEG-4 video encoding; audio is compressed using AAC compression, the same type of audio compression used in .AAC files. MPG: Common video format standardized by the Moving Picture Experts Group (MPEG); typically incorporates MPEG-1 or MPEG-2 audio and video compression; often used for creating downloadable movies. They are used in VCDs and can be played on DVD players via USB. WMV: WMV format, short for Windows Media Video was developed by Microsoft. It was originally designed for internet streaming applications, and can now cater to more specialized content. 3GP: The 3gp format is both an audio and video format that was designed as a multimedia format for transmitting audio and video files between 3G cell phones and the internet. It is most commonly used to capture video from your cell phone and place it online. It is commonly used to be played on small screened mobile phone. It has a low size as well as low quality but works perfectly on Mobile Phones. VOB: It is the container format in DVD-Video media. VOB can contain digital video, digital audio, subtitles, DVD menus and navigation contents multiplexed together into a stream form. Files in VOB format may be encrypted. MP3: It is the standard format for compressing a sound sequence into a very small file, up to 12 times smaller. The good thing about MP3 is that there is no or very little loss of sound quality from the original file. AAC: It is a standardized, lossy compression and encoding scheme for digital audio. Designed to be the successor of the MP3 format, AAC generally achieves better sound quality than MP3 at similar bit rates. WAV: WAV files are popular because they are considered a “first generation” format. That is, they are generally kept as the first digital copy of a file completely uncompressed. This means that WAV files are the best possible quality and have not gone through any digital alterations except to be outputted. Image File Formats: JPG/JPEG BMP Computer Science 2210/10th C Notes/By M Shoaib
13 PNG GIF TIF JPG: It is a lossy compression method; JPEG-compressed images are usually stored in the JFIF file format. BMP: The BMP file format is capable of storing 2D digital images of arbitrary width, height, and resolution, both colorless and color, in various color depths, and optionally with data compression, alpha channels, and color profiles. PNG: This file format was created as the free, open-source successor to GIF. It is lossless and may contain animation. GIF: It is suitable for storing graphics with relatively few colors such as simple diagrams, shapes, logos and cartoon style images. The GIF format supports animation and is still widely used to provide image animation effects. It also uses a lossless compression. TIFF: It is a lossless type of format that is used to contain very heavy images, of larger size. It is a format that offers very huge size of images to be printed, such as flexes. Lossy & Lossless Image Files There are two types of compression. 'Lossy' and 'Lossless'. The lossless method compresses the image without effectively losing any detail at all. The TIF file format is a lossless format and is an excellent choice for long term storage of images. A 'lossy' format actually discards some of the image detail in order to get even more compression but it does so very cleverly so that a person hardly notices the loss of quality. A very popular lossy method is the JPEG image format.
Computer Architecture / Von Neumann Model Introduction The new idea was that not only should the data be stored in memory, but that the program processing that data should also be stored in the same memory. This novel idea meant that a computer built with this architecture would be much easier to reprogram. Effectively the program itself is treated as data. This 'stored-program' architecture is now commonly known as the 'Von Neumann' architecture.
Computer Science 2210/10th C Notes/By M Shoaib
14 Its Features Memory The computer will have memory that can hold both data and also the program processing that data. In modern computers this memory is RAM. Control Unit The control unit will manage the process of moving data and program into and out of memory and also deal with carrying out (executing) program instructions - one at a time. This includes the idea of a 'register' to hold intermediate values. The 'one-at-a-time' phrase means that the von neumann architecture is a sequential processing machine. Input - Output This architecture allows for the idea that a person needs to interact with the machine. Whatever values that are passed to and forth are stored once again in some internal registers. Arithmetic Logic Unit This part of the architecture is solely involved with carrying out calculations upon the data. All the usual Add, Multiply, Divide and Subtract calculations will be available but also data comparisons such as 'Greater Than', 'Less Than', 'Equal To' will be available. Bus Notice the arrows between components? This implies that information should flow between various parts of the computer. In a modern computer built to the Von Neumann architecture, information passes back and forth along a 'bus'. There are buses to identify locations in memory - an 'address bus'. And there are buses to allow the flow of data and program instructions - a 'data bus'.
Computer Science 2210/10th C Notes/By M Shoaib
15 Register: A register is a separate memory location within the CPU designed to hold temporary data and instructions. There are many types of registers: Program Counter (PC): This holds the address in memory of the next instruction. Current Instruction Register (CIR): A register, usually in the control unit, that contains the information specifying the instruction that is being (or is about to be) performed. Program Status Word (PSW): The PSW has a number of duties all rolled into one:
The Arithmetic Logic Unit compares two data items together, and it arranges for the result of that comparison to appear in this register i.e. the result of 'greater than' etc. The PSW also indicates if program conditions have been met that would lead to a jump to a different part of the program. In programming terms this means the result of an IF statement. An IF statement is important in any programming language as it allows execution to jump from one set of instructions to another. The PSW also holds error flags that indicate a number of problems that may have happened as a result of an instruction, such as 'overflow' which means a calculation has exceeded it allowed number range.
Memory Address Register (MAR): The memory address register, or MAR, holds the location in memory (address) of the next piece of data or program to be fetched (or stored). Memory Buffer Register (MBR): When data, instruction is fetched from memory, it is temporarily held in MBR. Problems of this Model Problem 1: Every piece of data and instruction has to pass across the data bus in order to move from main memory into the CPU (and back again). This is a problem because the data bus is a lot slower than the rate at which the CPU can carry out instructions. This is called the 'Von Neumann bottleneck'. If nothing were done, the CPU would spend most of its time waiting around for instructions. Problem 2: Both data and programs share the same memory space. This is a problem because it is quite easy for a poorly written or faulty piece of code to write data into an area holding other instructions, so trashing that program. Problem 3: Another issue is that the rate at which data needs to be fetched and the rate at which instructions need to be fetched are often very different. And yet they share the same bottlenecked data bus. Fetch-execute Cycle Step 1: Fetch: The next instruction is fetched from Main Memory. Step 2: Decode: The instruction gets interpreted/decoded, signals produced to control other internal components (ALU for example). Step 3: Execute: The instructions get executed (carried out) Computer Science 2210/10th C Notes/By M Shoaib
16
Programming Languages Machine Code: Another description of Machine code is 'object code'. •
A CPU follows binary instructions like this:
1010010110111010 1001110110000111 0001110010110001 • •
These instructions are stored in memory locations called 'Registers' within the CPU. Different CPUs have a different set of registers. The raw instructions that the CPU carries out is called 'machine code' and each CPU family has a different set of machine code.
Low Level Languages: Low level languages are near to the hardware but away from humans. Low level languages have the advantage of providing very close control of the CPU but the code is still quite difficult to read and follow by other programmers. High Level Languages: High Level Languages are near to humans but away from hardware. They are easy to understand for the programmers but they do not offer such a close control of the hardware as the Low Level Languages do! Converting High Level Language High level languages are fairly close to normal written language. But this means that they are nowhere close to machine language! So an application is needed to convert the fairly abstract high level language into a precise set of machine codes that the CPU can actually run. This application is called the ‘translator’.
A translator converts high level commands into a set of machine codes. One high level command can translate into many individual machine instructions. There are mainly 3 kinds of translators: Interpreter
Compiler
Translates program one statement at a time.
Scans the entire program and translates it as a whole into machine code.
It takes less amount of time to analyze the source code but the overall execution time is slower.
It takes large amount of time to analyze the source code but the overall execution time is comparatively faster.
No intermediate object code is generated, hence are memory efficient.
Generates intermediate object code which further requires linking, hence requires more memory.
Computer Science 2210/10th C Notes/By M Shoaib
17 Continues translating the program until the first error is met, in which case it stops. Hence debugging is easy.
It generates the error message only after scanning the whole program. Hence debugging is comparatively hard.
Assembler: An assembler is sometimes referred to as the compiler of assembly language. It also provides the services of an interpreter. An assembler is a type of computer program that interprets software programs written in assembly language into machine language, code and instructions that can be executed by a computer. IDE - Integrated Development Environment: The IDE brings together the tools you need into one application so that you can efficiently and easily go through this process. An IDE brings together :
Source code editing Debugging / error diagnostics Translating (Complier) Run time environment Auto-documenting
Flowcharts Common flowchart symbols:-
Computer Science 2210/10th C Notes/By M Shoaib
18
Pseudo Code
Computer Science 2210/10th C Notes/By M Shoaib
View more...
Comments