GOVERNMENT OF TAMILNADU HIGHER SECONDARY FIRST YEAR. COMPUTER SCIENCE VOLUME-I. Untouchability is Inhuman and a Crime

Size: px
Start display at page:

Download "GOVERNMENT OF TAMILNADU HIGHER SECONDARY FIRST YEAR. COMPUTER SCIENCE VOLUME-I. Untouchability is Inhuman and a Crime"

Transcription

1 GOVERNMENT OF TAMILNADU HIGHER SECONDARY FIRST YEAR COMPUTER SCIENCE VOLUME-I Untouchability is Inhuman and a Crime A publication under Free Textbook Programme of Government of Tamil Nadu Department of School Education Index.indd :03:33

2 Government of Tamil Nadu First Edition NOT FOR SALE Content Creation The wise possess all State Council of Educational Research and Training SCERT 2018 Printing & Publishing Tamil NaduTextbook and Educational Services Corporation II Index.indd :03:33

3 PREFACE Human civilization achieved the highest peak with the development of computer known as Computer era. Literate are those who have the knowledge in using the computer whereas others are considered illiterate inspite of the other degrees obtained. T h e growth of the nation at present lies in the hands of the youth, hence the content of this book is prepared in such a way so as to attain utmost knowledge considering the future needs of the youth. This book does not require prior knowledge in computer Technology Each unit comprises of simple activities and demonstrations which can be done by the teacher and also students. Technical terminologies are listed in glossary for easy understanding The Do you know? boxes enrich the knowledge of reader with additional information Workshops are introduced to solve the exercises using software applications QR codes are used to link supporting additional materials in digital form HOW TO USE THE BOOK How to get connected to QR Code? o Download the QR code scanner from the google play store/ apple app store into your smartphone o Open the QR code scanner application o Once the scanner button in the application is clicked, camera opens and then bring it closer to the QR code in the textbook. o Once the camera detects the QR code, a URL appears in the screen. Click the URL and go to the content page. III Index.indd :03:33

4 CAREER GUIDANCE AFTER 12 TH B.E / B.Tech COURSES B.Sc (Computer Science) BCA B.Sc ( Maths, Physics, Chemistry, Bio-Chemistry, Geography, journalism, Library Sciences, Political Science, Travel and Tourism) COLLEGES/ UNIVERSITIES All University and their affiliated Colleges and Self financing Colleges in India and Abroad. Science and Humanities All University and their affiliated Colleges and Self financing Colleges in India and Abroad. LAW PROFESSION Software Engineer, Hardware Engineer, Software Development, Healthcare Section, IT & ITEs Government Job and Private Company BPO, Geologist, Journalist LLB B.A+LLB All University and their affiliated Lawyer, Legal Officer, Govt B.Com Colleges and Self financing Colleges in Job BBM+LLB India and Abroad. BBA+LLB The Institute of Chartered Accountant CA CA Private and Govt. of India (ICAI) Diploma B.com-Regular, B.com-Taxation & Tax Procedure, B.com-Travel &Tourism, B.com-Bank Management, B.com-Professional, BBA/BBM-Regular, BFM- Bachelors in Financial Markets, BMS-Bachelors in Management Studies, BAF- Bachelors in Accounting & Finance, Certified Stock Broker & Investment Analysis, Certified Financial Analyst, Certified Financial Planner, Certified Investment Banker Government Polytechnic and Selffinancing colleges Commerce Courses All University and their affiliated Colleges and Self financing Colleges in India and Abroad. Junior Engineer (Government and Private) Private Organization, Government,Banking sectors and prospects for self employment. IV Index.indd :03:33

5 COURSES Business Management Bank Management Event Management Hospital Management Human Resource Management Logistics Management COLLEGES/ UNIVERSITIES Management Courses All University and their affiliated Colleges and Self financing Colleges in India and Abroad. PROFESSION Private Organization, Government,Banking sectors and prospects for self employment. LLB B.A+LLB B.Com BBM+LLB BBA+LLB LAW All University and their affiliated Colleges and Self financing Colleges in India and Abroad. Lawyer, Legal Officer, Private Organization, Government, Banking sectors and prospects for self employment CA-Chartered Accountant CA, Private Organization, CMA-Cost Management The Institute of Chartered Accountant Government,Banking sectors Accountant. of India (ICAI) and prospects for self CS-Company Secretary employment. (Foundation) Science and Humanities B.Sc.Botany B.Sc.Zoology B.Sc.Dietician & Nutritionist B.Sc.Home Science B.Sc.Food Technology B.Sc.Dairy Technology B.Sc. Hotel Management B.Sc. Fashion Design B.Sc. Mass Communication B.Sc. Multimedia B.Sc. -3D Animation LLB B.A+LLB B.Com BBM+LLB BBA+LLB CA Diploma All University and their affiliated Colleges and Self financing Colleges in India and Abroad LAW All University and their affiliated Colleges and Self financing Colleges in India and Abroad. The Institute of Chartered Accountant of India (ICAI) Government Polytechnic and Selffinancing colleges Government Job and Private Company BPO, Geologist, Journalist Lawyer, Legal Officer, Govt Job CA Private and Govt. Junior Engineer (Government and Private) V Index.indd :03:33

6 Table of Contents Chapter No. Title Page UNIT I FUNDAMENTALS OF COMPUTER AND WORKING WITH A TYPICAL OPERATING SYSTEMS (WINDOWS & LINUX) 1 Introduction to Computers 1 2 Number Systems 18 3 Computer Organization 51 4 Theoretical Concepts of Operating System 64 Working with typical Operating System 5 Part-I Working with Windows 78 Part-II Working with Linux 104 UNIT II-ALGORITHMIC PROBLEM SOLVING 6 Specification and Abstraction Composition and Decomposition Iteration and recursion 147 E - book Assessment DIGI links VI Index.indd :03:33

7 Unit I Fundamentals of Computers CHAPTER 1 Introduction to Computers Learning Objectives 1.1 Introduction to Computers After learning the concepts in this chapter, the students will be able To know about Computers To learn about various generations of computer To understand the basic operations of computers Computers are seen everywhere around us, in all spheres of life, in the field of education, research, travel and tourism, weather forecasting, social networking, e-commerce etc. Computers have now become an indispensable part of our lives. Computers have revolutionized our lives with their accuracy and speed of performing a job, it is truly remarkable. Today, no organization can function without a computer. In fact, various organizations have become paperless. Computers have evolved over the years To know the components and their functions. To know about booting of a computer from a simple calculating device to high speed portable computers. Father of Computer Charles Babbage is considered to be the father of computer, for his invention and the concept of Analytical Engine in The Analytical Engine contained an Arithmetic Logic Unit (ALU), basic flow control, and integrated memory; which led to the development of first general-purpose computer concept. 1 The growth of computer industry started with the need for performing fast calculations. The manual method of computing was slow and prone to errors. So, attempts were made to develop fast calculating devices, the journey started from the first known calculating device (Abacus) which has led us today to an extremely high speed calculating devices. 1.2 Generations of Computers Growth in the computer industry is determined by the development in technology. Based on various stages of development, computers can be categroized into different generations. Chapter 1 Page indd :47:52

8 SN Generation Period Main Component used Merits/Demerits 1 First Generation Vacuum tubes Big in size Consumed more power Malfunction due to overheat Machine Language was used First Generation Computers - ENIAC, EDVAC, UNIVAC 1 ENIAC weighed about 27 tons, size 8 feet 100 feet 3 feet and consumed around 150 watts of power Smaller compared to First Generation Generated Less Heat Consumed less power compared to first generation Second Punched cards were used 2 Generation 1964 First operating system was developed - Batch Processing Transistors and Multiprogramming Operating System Machine language as well as Assembly language was used. Second Generation Computers IBM 1401, IBM 1620, UNIVAC Third Generation Integrated Circuits (IC) Computers were smaller, faster and more reliable Consumed less power High Level Languages were used Third Generation Computers IBM 360 series, Honeywell 6000 series 4 Fourth Generation Microprocessor Very Large Scale Integrated Circuits (VLSI) Smaller and Faster Microcomputer series such as IBM and APPLE were developed Portable Computers were introduced. 2 Chapter 1 Page indd :47:54

9 5 Fifth Generation till date Ultra Large Scale Integration (ULSI) Parallel Processing Super conductors Computers size was drastically reduced. Can recognize Images and Graphics Introduction of Artificial Intelligence and Expert Systems Able to solve high complex problems including decision making and logical reasoning Parallel and Distributed computing Computers have become Sixth smarter, faster and smaller 6 In future Generation Development of robotics Natural Language Processing Development of Voice Recognition Software Table1.1 Generations of computers The first digital computer The ENIAC (Electronic Numerical Integrator And Calculator) was invented by J. Presper Eckert and John Mauchly at the University of Pennsylvania and began construction in 1943 and was not completed until It occupied about 1,800 square feet and used about 18,000 vacuum tubes, weighing almost 50 tons. ENIAC was the first digital computer because it was fully functional. 1.3 Sixth Generation Computing In the Sixth Generation, computers could be defined as the era of intelligent computers, based on Artificial Neural Networks. One of the most dramatic changes in the sixth generation will be the explosive growth of Wide Area Networking. Natural Language Processing (NLP) is a component of Artificial Intelligence (AI). It provides the ability to develop the computer program to understand human language. 3 Chapter 1 Page indd :47:55

10 Optical Character Recognition (Optical Grapheme Recognition) engine for the Indus Scripts has been developed using Deep Learning Neural Networks (a sub-field of Artificial Intelligence). and even playing games. Computer - man or machine? Before 19 th century, the term Computer was referred to humans who performed calculations using Abacus and Slide Rule and not to machine. Given photographs, scans, or any image feed of an Indus Valley Civilization The term computer is derived artifact, the system will be able to from the word compute which means recognize the inscriptions (the symbol/ to calculate. The person who performs grapheme sequences) from the image. calculation is called as Computer. This There are totally 417 term was later given to mechanical Symbols/Graphemes/ device as they began replacing the Characters in the Indus human computers. Scripts and just text inscriptions of data Today's computers are electronic devices that accept data as input, process for the machine to learn it, produce output and stores it for future and attain expert-level status. reference. I am a good Computer 1.4. Data and Information We all know what a computer is? It is an electronic device that processes the input according to the set of instructions provided to it and gives the desired output at a very fast rate. Computers are very versatile as they do a lot of different tasks such as storing data, weather forecasting, booking airlines, railway or movie tickets Data: Data is defined as an unprocessed collection of raw facts, suitable for communication, interpretation or processing. For example, 134, 16 Kavitha, C are data. This will not give any meaningful message. Information: Information is a collection of facts from which conclusions may be drawn. In simple words we can say 4 Chapter 1 Page indd :47:55

11 that data is the raw facts that is processed to give meaningful, ordered or structured information. For example Kavitha is 16 years old. This information is about Kavitha and conveys some meaning. This conversion of data into information is called data processing. INPUT PROCESS DATA INFORMATION OUTPUT Figure 1.1 Data and Information Let us first have a look at the functional components of a computer. Every task given to a computer follows an Input- Process- Output Cycle (IPO cycle). It needs certain input, processes that input and produces the desired output. The input unit takes the input, the central processing unit does the processing of data and the output unit produces the output. The memory unit holds the data and instructions during the processing. Control Unit A Computer is an electronic device that ALU Input Unit Output Unit takes raw data (unprocessed) as an input Internal Memory Data Path from the user and processes it under the Control Path control of a set of instructions (called Main Memory program), produces a result (output), and Secondary Storage saves it for future use. Figure 1.3 components of a computer 1.5 Components of a Computer Input Unit The computer is the combination of hardware and software. Hardware is the physical component of a computer like motherboard, memory devices, monitor, keyboard etc., while software is the set of programs or instructions. Both hardware and software together make the computer system to function. Input unit is used to feed any form of data to the computer, which can be stored in the memory unit for further processing. Example: Keyboard, mouse, etc Central Processing Unit CPU is the major component which interprets and executes software instructions. It also control the operation of all other components such as memory, input and output units. It accepts binary data as input, process the data according to the instructions and provide the result as output. Figure 1.2: Computer The CPU has three components 5 Chapter 1 Page indd :47:56

12 which are Control unit, Arithmetic and logic unit (ALU) and Memory unit Arithmetic and Logic Unit The ALU is a part of the CPU where various computing functions are performed on data. The ALU performs arithmetic operations such as addition, subtraction, multiplication, division and logical operations. The result of an operation is stored in internal memory of CPU. The logical operations of ALU promote the decision-making ability of a computer. Access Memory (RAM) is an example of a main memory. The Secondary memory is non volatile, that is, the content is available even after the power supply is switched off. Hard disk, CD-ROM and DVD ROM are examples of secondary memory Input and Output Devices Input Devices: (1) Keyboard: Keyboard (wired / wireless, virtual) is the most common input device used today. The individual keys for letters, numbers and special characters Control Unit are collectively known as character keys. This keyboard layout is derived from the The control unit controls the flow of keyboard of original typewriter. The data data between the CPU, memory and and instructions are given as input to I/O devices. It also controls the entire the computer by typing on the keyboard. operation of a computer. Apart from alphabet and numeric keys, it also has Function keys for performing Output Unit different functions. There are different set of keys available in the keyboard such as An Output Unit is any hardware character keys, modifier keys, system and component that conveys information to GUI keys, enter and editing keys, function users in an understandable form. Example: keys, navigation keys, numeric keypad Monitor, Printer etc. and lock keys Memory Unit The Memory Unit is of two types which are primary memory and secondary memory. The primary memory is used to temporarily store the programs and data when the instructions are ready to execute. The secondary memory is used to store the data permanently. The Primary Memory is volatile, that is, the content is lost when the power supply is switched off. The Random 6 Figure 1.4 Keyboard (2) Mouse: Mouse (wired/wireless) is a pointing device used to control the movement of the cursor on the display screen. It can be used to select icons, menus, command buttons or activate something on a computer. Some mouse Chapter 1 Page indd :47:56

13 actions are move, click, double click, right click, drag and drop. Different types of mouse available are: Mechanical Mouse, Optical, Laser Mouse, Air Mouse, 3D Mouse, Tactile Mouse, Ergonomic Mouse and Gaming Mouse. MOST COMMONLY USED MOUSE SN Type of Mouse Mechanism Developed and Introduced 1 Mechanical Mouse A small ball is kept inside and touches the pad through a hole at the bottom of the mouse. When the mouse is moved, the ball rolls. This movement of the ball is converted into signals and sent to the computer. Telefunken, German Company, 02/10/1968 Optical Mouse Measures the motion and acceleration of pointer. In 1988, Richard Lyon, It uses light source instead of ball to Steve Krish judge the motion of the pointer. independently 2 invented Optical mouse has three buttons. different versions of Optical Mouse. Optical mouse is less sensitive towards surface. Laser Mouse Measures the motion and acceleration of pointer. 3 Laser Mouse uses Laser Light Laser Mouse is highly sensitive and able to work on any hard surface. Table 1.2 Commonly used Mouse 7 Chapter 1 Page indd :47:56

14 Who invented Mouse? The computer mouse as we know it today was invented and developed by Douglas Engelbart, with the assistance of Bill English, during the 1960's and was patented on November 17, Figure 1.6 Fingerprint Scanner (5) Track Ball: Track ball is similar to the upside- down design of the mouse. (3) Scanner: Scanners are used The user moves the ball directly, while to enter the information directly into the device itself remains stationary. The the computer s memory. This device user spins the ball in various directions to works like a Xerox machine. The scanner navigate the screen movements. converts any type of printed or written information including photographs into a digital format, which can be manipulated by the computer. Figure 1.7 Track Ball Figure 1.5 Scanner (4)Fingerprint Scanner: Finger print Scanner is a fingerprint recognition device used for computer security, equipped with the fingerprint recognition feature that uses biometric technology. Fingerprint Reader / Scanner is a very safe and convenient device for security instead of using passwords, which is vulnerable to fraud and is hard to remember. (6) Retinal Scanner: This performs a retinal scan which is a biometric technique that uses unique patterns on a person's retinal blood vessels. Figure 1.8 Retinal Scanner (7) Light Pen: A light pen is a pointing device shaped like a pen and is connected to 8 Chapter 1 Page indd :47:56

15 a monitor. The tip of the light pen contains a light-sensitive element which detects the light from the screen enabling the computer to identify the location of the pen on the screen. Light pens have the advantage of drawing directly onto the screen, but this becomes hard to use, and is also not accurate. scans the information on the bar codes transmits to the Computer for further processing. The system gives fast and error free entry of information into the computer. QR (Quick response) Code: The QR code is the two dimension bar code which can be read by a camera and processed to interpert the image Figure 1.11 Bar code Reader Figure 1.9 Light Pen (10) Voice Input Systems: (8) Optical Character Reader: Microphone serves as a voice Input It is a device which detects characters device. It captures the voice data and send printed or written on a paper with OCR, it to the Computer. Using the microphone a user can scan a page from a book. The along with speech recognition software Computer will recognize the characters in can offer a completely new approach to the page as letters and punctuation marks input information into the Computer. and stores. The Scanned document can be edited using a wordprocessor. Figure 1.12 Voice input System Figure 1.10 Optical Character Reader (9) Bar Code / QR Code Reader: A Bar code is a pattern printed in lines of different thickness. The Bar code reader 9 (11) Digital Camera: It captures images / videos directly in the digital form. It uses a CCD (Charge Coupled Device) electronic chip. When light falls on the chip through the lens, it converts light rays into digital format. Chapter 1 Page indd :47:57

16 one or more switches. Modern keyers have a large number of switches but not as many as a full size keyboard. Typically, this number is between 4 and 50. A keyer differs from a keyboard, which has "no board", but the keys are arranged in a cluster. Figure 1.13 Digital Camera (12) Touch Screen: A touch screen is a display device that allows the user to interact with a computer by using the finger. It can be quite useful as an Figure 1.15 Keyer alternative to a mouse or keyboard for Output Devices: navigating a Graphical User Interface (GUI). Touch screens are used on a wide (1) Monitor: Monitor is the most variety of devices such as computers, commonly used output device to display laptops, monitors, smart phones, tablets, the information. It looks like a TV. cash registers and information kiosks. Pictures on a monitor are formed with Some touch screens use a grid of infrared picture elements called PIXELS. Monitors beams to sense the presence of a finger may either be Monochrome which display instead of utilizing touch-sensitive input. text or images in Black and White or can be color, which display results in multiple colors. There are many types of monitors available such as CRT (Cathode Ray Tube), LCD (Liquid Crystal Display) and LED (Light Emitting Diodes). The monitor works with the VGA (Video Graphics Array) card. The video graphics card helps the keyboard to communicate with the screen. It acts as an interface between the computer and display monitor. Usually the recent motherboards incorporate built-in Figure 1.14 Touch Screen video card. (13) Keyer : A Keyer is a device for signaling by hand, by way of pressing 10 The first computer monitor was part of the Xerox Alto computer system, which was released on March 1, Chapter 1 Page indd :47:57

17 Figure 1.16 Monitor A Dot matrix printer that prints using a fixed number of pins or wires. Each dot is produced by a tiny metal rod, also called a wire or pin, which works by the power of a tiny electromagnet or solenoid, either directly or through a set of small levers. It generally prints one line of text at a time. The printing speed of these printers varies from 30 to 1550 CPS (Character Per Second). (2) Plotter: Plotter is an output device that is used to produce graphical output on papers. It uses single color or multi color pens to draw pictures. Impact Printers Non Impact printers Impact Printers These printers print with striking of hammers or pins on ribbon. These printers can print on multi-part (using carbon papers) by using mechanical pressure. For example, Dot Matrix printers and Line matrix printers are impact printers. 11 Figure 1.18 Impact Printer Line matrix printers use a fixed print head for printing. Basically, it prints a page-wide line of dots. But it builds up a line of text by printing lines of dots. Line printers are capable of printing much more Figure 1.17 Plotter than 1000 Lines Per Minute, resulting in thousands of pages per hour. These (3) Printers: Printers are used to printers also uses mechanical pressure to print the information on papers. Printers print on multi-part (using carbon papers). are divided into two main categories: Non-Impact Printers These printers do not use striking mechanism for printing. They use electrostatic or laser technology. Quality and speed of these printers are better than Impact printers. For example, Laser printers and Inkjet printers are non-impact printers. Laser Printers Laser printers mostly work with similar technology used by photocopiers. It makes a laser beam scan back and Chapter 1 Page indd :47:58

18 forth across a drum inside the printer, building up a pattern. It can produce very good quality of graphic images. One of the chief characteristics of laser printer is their resolution how many Dots per inch(dpi). The available resolution range around 1200 dpi. Approximately it can print 100 pages per minute(ppm) piezoelectricity in which tiny electric currents controlled by electronic circuits are used inside the printer to spread ink in jet speed. An Inkjet printer can spread millions of dots of ink at the paper every single second. Speakers: Speakers produce voice output (audio). Using speaker along with speech synthesize software, the computer can provide voice output. This has become very common in places like airlines, schools, banks, railway stations, etc.. Figure 1.19 Laser Printer Inkjet Printers: Figure 1.21 Speakers Inkjet Printers use colour cartridges which combined Magenta, Yellow and Cyan Multimedia Projectors: inks to create color tones. A black cartridge Multimedia projectors are used to is also used for monochrome output. Inkjet produce computer output on a big screen. printers work by spraying ionised ink at a These are used to display presentations in sheet of paper. The speed of Inkjet printers meeting halls or in classrooms. generaly range from 1-20 PPM (Page Per Minute). Figure 1.20 Inkjet Printer They use the technology of firing ink by heating it so that it explodes towards the paper in bubbles or by using 12 Figure 1.22 Multimedia Projector 1.6 Booting of computer An Operating system (OS) is a basic software that makes the computer Chapter 1 Page indd :47:58

19 to work. When a computer is switched on, there is no information in its RAM.At the same time, in ROM, the pre-written program called POST (Power on Self Test) will be executed first. This program checks if the devices like RAM, keyboard, etc., are connected properly and ready to operate. If these devices are ready, then the BIOS (Basic Input Output System) gets executed. This process is called Booting. Thereafter, a program called Bootstrap Loader transfers OS from hard disk into main memory. Now the OS gets loaded (Windows/Linux, etc.,) and will get executed. Booting process is of two types. 1) Cold Booting 2) Warm Booting Cold Booting: When the system starts from initial state i.e. it is switched on, we call it cold booting or Hard Booting. When the user presses the Power button, the instructions are read from the ROM to initiate the booting process. Warm Booting: When the system restarts or when Reset button is pressed, we call it Warm Booting or Soft Booting. The system does not start from initial state and so all diagnostic tests need not be carried out in this case. There are chances of data loss and system damage as the data might not have been stored properly. Points to Remember: Computers are seen everywhere CPU interprets and executes software around us, in all spheres of life. instructions. It is an electronic device that processes the input according to the set of instructions provided to it and gives the desired output at a very fast rate. Based on various stages of development, computers can be divided into six different generations. The computer is the combination of hardware and software. Hardware is the physical component of a computer. Input unit is used to feed any form of data to the computer. The ALU is a part of the CPU where various computing functions are performed on data. The control unit controls the flow of data between the CPU, memory and I/O devices. An Output Unit is any hardware component that conveys information to one or more people in user understandable form. The Memory Unit is of two kinds which are primary memory and secondary memory. Booting Process is of two types Cold and Warm 13 Chapter 1 Page indd :47:58

20 Activity STUDENT ACTIVITY 1. Explain the classification of computers. 2. Give the details of motherboard names, RAM capacity used in the years 1993, 1995, 2005, 2008, TEACHER ACTIVITY 1. Open a CPU and explain the components of it to students. 2. To connect and disconnect the various components of a computer. 3. Mention two new input and output devices that are not given in this chapter. Evaluation SECTION A Choose the correct answer: 1. First generation computers used (a) Vacuum tubes (c) Integrated circuits (b) Transistors (d) Microprocessors 2. Name the volatile memory (a) ROM (b) PROM (c) RAM (d) EPROM 3. Identify the output device (a) Keyboard (b) Memory (c) Monitor (d) Mouse 4. Identify the input device (a) Printer (b) Mouse (c) Plotter (d) Projector 5. Output device is used for printing building plan, flex board, etc. (a) Thermal printer (c) Dot matrix (b) Plotter (d) inkjet printer 14 Chapter 1 Page indd :47:58

21 6. In ATM machines, which one of the following is used to (a) Touch Screen (c) Monitor (b) speaker (d) Printer 7. When a system restarts.. which type of booting is used. (a) Warm booting (c) Touch boot (b) Cold booting (d) Real boot. 8. Expand POST (a) Post on self Test (b) Power on Software Test c) Power on Self Test (d) Power on Self Text 9. Which one of the following is the main memory? (a) ROM (c) Flash drive (b) RAM (d) Hard disk 10. Which generation of computer used IC s? (a) First (b) Second (c) Third (d) Fourth SECTION-B Short Answers 1. What is a computer? 2. Distinguish between data and information. 3. What are the components of a CPU? 4. What is the function of an ALU? 5. Write the functions of control unit. 6. What is the function of memory? 7. Differentiate Input and output unit. 8. Distinguish Primary and Secondary memory. 15 Chapter 1 Page indd :47:58

22 SECTION-C Explain in Brief 1. What are the characteristics of a computer? 2. Write the applications of computer. 3. What is an input device? Give two examples. 4. Name any three output devices. 5. Differentiate optical and Laser mouse 6. Write shortnote on impact printer 7. Write the characteristics of sixth generation. 8. Write the significant features of monitor. SECTION - D Explain in detail 1. Explain the basic components of a computer with a neat diagram. 2. Discuss the various generations of computers. 3. Explain the following a. Inkjet Printer b. Multimedia projector c. Bar code / QR code Reader References (1) Fundamentals of Computers V. Rajaraman PHI Publications (2) Computer Science text book NCERT, New Delhi (1) Internet Resources (2) Prepare a comparative study of various computers of past and present with respect to speed, memory, size, power consumption and other features 16 Chapter 1 Page indd :47:58

23 Computer Vacuum tube Transistors Punched cards Machine Language It is an electronic device that processes the input according to the set of instructions provided to it and gives the desired output at a very fast rate. Vacuum tubes contain electrodes for controlling electron flow and were used in early computers as a switch or an amplifier. The transistor ("transfer resistance") is made up of semiconductors. It is a component used to control the amount of current or voltage used for amplification/modulation of an electronic signal. Punch cards also known as Hollerith cards are paper cards containing several punched or perforated holes that were punched by hand or machine to represent data. Machine language is a collection of binary digits or bits that the computer reads and interprets. Assembly language An assembly language is a low-level programming language. The IC is a package containing many circuits, pathways, Integrated Circuits transistors, and other electronic components all working together to perform a particular function or a series of functions. Micro computer is used to describe a standard personal Microcomputer computer. High-level languages Natural Language Processing (NLP) Robotics Nanotechnology Bioengineering A high-level language is a computer programming language that isn't limited by the computer, designed for a specific job, and is easier to understand. Natural Language Processing is a method used in artificial intelligence to process and derive meaning from the human language. Robot is a term coined by Karel Capek in the 1921 to play RUR (Rossum's Universal Robots). It is used to describe a computerized machine designed to respond to input received manually or from its surroundings. Nanotechnology is an engineering, science, and technology that develops machines or works with one atom or one molecule that is 100 nanometers or smaller. A discipline that applies engineering principles of design and analysis to biological systems and biomedical technologies 17 Chapter 1 Page indd :47:58

24 Unit I Fundamentals of Computers CHAPTER 2 Number Systems Learining Objectives To know how the computer interprets and stores data in the memory. To learn various data representations and binary arithmetic. are called data. When the above data is processed, we get an information Rajesh is 16 years old, studying in Class XI, has scored 65 marks in Computer Science subject. 2.2 Data Representations To learn conversion between various Computer handles data in the form Number Systems. of 0 (Zero) and 1 (One). Any kind of data like number, alphabet, special character 2.1 Introduction should be converted to 0 or 1 which can be understood by the Computer. 0 and The term data comes from the 1 that the Computer can understand is word datum, which means a raw fact. The called Machine language. 0 or 1 are data is a fact about people, places or some called Binary Digits (BIT). Therefore, objects. the study of data representation in the Example: computer is important. Let Name, Age, Class, Marks and Subject be some defined variables. Now, let us assign a value to each of these variables. A bit is the short form of Binary digit which can be 0 or 1. It is the basic unit of data in computers. A nibble is a collection of 4 bits (Binary digits). Name = Rajesh Age = 16 Class = XI Mark = 65 Subject = Computer Science Figure 2.1 Example for Data In the above example, the values assigned to the five different variables A collection of 8 bits is called Byte. A byte is considered as the basic unit of measuring the memory size in the computer. Word length refers to the number of bits processed by a Computer s CPU. For example, a word length can have 8 bits, 16 bits, 32 bits and 64 bits (Present day Computers use 32 bits or 64 bits) 18 Chapter 2 Page indd :59:41

25 Bit (0 or 1) Nibble (4 bits) Byte (8 bits) KiloByte (1024 bytes) MegaByte (1024 KB) GigaByte (1024 MB) TeraByte (1024 GB) Figure 2.2 Data Representation Computer memory (Main Memory and Secondary Storage)is normally represented in terms of KiloByte (KB) or MegaByte (MB). In decimal system, 1 Kilo represents 1000, that is, In binary system, 1 KiloByte represents 1024 bytes that is The following table represents the various memory sizes: Table 2.1 Memory Size (Read 2^10 as 2 power 10) Name Abbr. Size Kilo K 2^10 = 1,024 Mega M 2^20 = 1,048,576 Giga G 2^30 = 1,073,741,824 Tera T 2^40 = 1,099,511,627,776 Peta P 2^50 = 1,125,899,906,842,624 Exa E 2^60 = 1,152,921,504,606,846,976 Zetta Z 2^70 = 1,180,591,620,717,411,303,424 Yotta Y 2^80 = 1,208,925,819,614,629,174,706,173 Bytes are used to represent characters in a text. Different types of coding schemes are used to represent the character set and numbers. The most commonly used coding scheme is the American Standard Code for Information Interchange (ASCII). Each 19 Chapter 2 Page indd :59:41

26 binary value between 0 and 127 is used to represent a specific character. The ASCII value for (blank space) is 32 and the ASCII value of numeric 0 is 48. The range of ASCII values for lower case alphabets is from 97 to 122 and the range of ASCII values for the upper case alphabets is 65 to 90. The speed of a computer depends on the number of bits it can process at once. For example, a 64- bit computer can process 64-bit numbers in one operation, while a 32-bit computer break 64-bit numbers down into smaller pieces, making it slower. 2.3 Different Types of Number Systems Number Systems Decimal Binary Octal Hexadecimal Base value Base value 10 8 (0,1,2,3,4,5,6,7,8,9) Base value (0,1,2,3,4,5,6,7) 2 (0,1) Base value 16 (0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F) Figure 2.3. Number Systems A numbering system is a way of representing numbers. The most commonly used numbering system in real life is Decimal number system. Other number systems are Binary, Octal, Hexadecimal number system. Each number system is uniquely identified by its base value or radix. Radix or base is the count of number of digits in each number system. Radix or base is the general idea behind positional numbering system Decimal Number System It consists of 0,1,2,3,4,5,6,7,8,9(10 digits). It is the oldest and most popular number system used in our day to day life. In the positional number system, each decimal digit is weighted relative to its position in the number. This means that each digit in the number is multiplied by 10 raised to a power corresponding to that digit s position. 20 Chapter 2 Page indd :59:41

27 Example (123) 10 = 1x x x10 0 = = (123) Binary Number System The binary sequence (1101) 2 has the decimal equivalent: (547) 8 = = = = (359) 10 There are only two digits in the Hexadecimal Number System Binary system, namely, 0 and 1. The A hexadecimal number is numbers in the binary system are represented using base 16. Hexadecimal represented to the base 2 and the positional multipliers are the powers of 2. The left most bit in the binary number is called as the Most Significant Bit (MSB) and it has the largest positional weight. The right most bit is the Least Significant Bit (LSB) and has the smallest positional weight. or Hex numbers are used as a shorthand form of binary sequence. This system is used to represent data in a more compact manner. Since 16 symbols are used, 0 to F, the notation is called hexadecimal. The first 10 symbols are the same as in the decimal system, 0 to 9 and the remaining 6 symbols are taken from the first 6 letters of the alphabet sequence, A to F, where A represents 10, B is 11, C is 12, D is 13, E is MSB LSB 14 and F is 15. Example (1101) 2 = = = (13) Octal Number System Octal number system uses digits 0,1,2,3,4,5,6 and 7 (8 digits). Each octal digit has its own positional value or weight as a power of 8. Example The Octal sequence (547) 8 has the decimal equivalent: 21 Chapter 2 Page indd :59:41

28 Table 2.2 Binary, Octal, Hexadecimal equivalent of Decimal Numbers Decimal Binary Octal Hexadecimal A B C D E F Example Workshop The hexadecimal sequence (25) 1. Identify the number system for the 16 has the decimal equivalent: following numbers (25) 16 = = 32+5 = (37) 10 S. No. Number Number system 1 (1010) 10 Decimal Number system 2 (1010) 2 3 (989) 16 4 (750) 8 5 (926) State whether the following numbers are valid or not. If invalid, give reason. S.No. Statement Yes / No Reason (If invalid) is an Octal number is a Binary number 3. Radix of Octal number is 7 22 Chapter 2 Page indd :59:42

29 2.4 Number System Conversions Method 2 : Sum of Powers of Decimal to Binary Conversion Generally two methods followed. Method 1: To convert Decimal to Binary Repeated Division by 2 method can be a) Find the largest power of 2 that is used. Any Decimal number divided by 2 smaller than or equal to 65. will leave a remainder of 0 or 1. Repeated division by 2 will leave a sequence of 0s > and 1s that become the binary equivalent of the decimal number. Suppose it is b) Set the 64 s bit to 1 and subtract 64 required to convert the decimal number from the original number N into binary form, dividing N by 2 in the decimal system, we will obtain a quotient 65-64=1 N1 and a remainder R1, where R1 can c) 32 is greater than the remaining total. have a value of either 0 or 1. The process Therefore, set the 32 s bit to 0. is repeated until the quotient becomes 0 or 1. When the quotient is 0 or 1, it d) 16 is greater than the remaining total. is the final remainder value. Write the Therefore, set the 16 s bit to 0. final answer starting from final remainder e) 8 is greater than the remaining total. value obtained to the first remainder value Therefore, set the 8 s bit to 0. obtained. Example A decimal number can be converted into a binary number by adding up the powers of 2 and then adding bits as needed to obtain the total value of the number. f) 4 is greater than the remaining total. Therefore, set the 4 s bit to 0. Convert (65) 10 into its equivalent binary number MSB LSB Remainder Note : 65/2 = /2 = /2 = /2 = /2 = /2 = (65) 10 = ( ) 2 g) 2 is greater than the remaining total. Therefore, set the 2 s bit to 0. h) As the remaining value is equivalent to 1 s bit, set it to =0 Conversion is complete = ( ) 2 Example The conversion steps can be given as follows: Given Number : Chapter 2 Page indd :59:42

30 Equivalent or value less than power of 2 is : 64 (1) = 1 Example Convert (31) 10 hexadecimal number. into its equivalent (2) 1-1= 0 Power s of Binary Number LSB 1-15 MSB (16) 10 = (1F) 16 (Refer Table 2.2 F=15) = ( ) Decimal to Octal Conversion Conversion of fractional Decimal to Binary To convert Decimal to Octal, The method of repeated Repeated Division by 8 method can be multiplication by 2 has to be used to used. The method is the same we have convert such kind of decimal fractions. learnt in 2.4.1, but in this method, we have to divide the given number by 8. The steps involved in the method of repeated multiplication by 2: Example Step 1: Multiply the decimal fraction by Convert (65) 10 into its equivalent 2 and note the integer part. The Octal number integer part is either 0 or MSB LSB (65) 10 = (1 0 1) Decimal to Hexadecimal Conversion To convert Decimal to Hexadecimal, Repeated division by 16 method can be used. The method is the same as we have learnt in 2.4.1, but in this method, we have to divide the given number by 16. Step 2: Step 3: Step 4: Discard the integer part of the previous product. Multiply the fractional part of the previous product by 2. Repeat Step 1 until the same fraction repeats or terminates (0). The resulting integer part forms a sequence of 0s and 1s that become the binary equivalent of decimal fraction. The final answer is to be written from first integer part obtained till the last integer part obtained. 24 Chapter 2 Page indd :59:42

31 Integer part Table 2.3 Positional Notation and Weight = (first integer part obtained) = = = = (last integer part obtained) Note: Fraction repeats, the product is the same as in the first step. Write the integer parts from top to bottom to obtain the equivalent fractional binary number. Hence (0.2) 10 =( ) 2 = ( ) 2 Weight Workshop Positional 3. Convert the following Decimal 2 Notation numbers to its equivalent Binary, Octal, Given Hexadecimal number 1) ) 255 3)126 Positional Notation Example Weight Positional Notation Weight Convert (111011) 2 into its equivalent decimal number = (59) 10 (111011) 2 = (59) Binary to Decimal Conversion To convert Binary to Decimal we can use positional notation method. Step 1: Write down the Binary digits and list the powers of 2 from right to left(positional Notation) Step 2: For each positional notation written for the digit, now write the equivalent weight. Step 3: Multiply each digit with its corresponding weight Binary to Octal Conversion Step 1: Group the given binary number into 3 bits from right to left. Step 2: You can add preceding 0 to make a group of 3 bits if the left most group has less than 3 bits. Step 3: Convert equivalent octal value using "2's power positional weight method" Step 4: Add all the values. 25 Chapter 2 Page indd :59:42

32 Table 2.4 Octal numbers and their Binary equivalent Example Octal Binary Equivalent Step 2: You can add preceding 0 s to make a group of 4 bits if the left most group has less than 4 bits. Step 3: Convert equivalent Hexadecimal value using "2's power positional weight method" Example Convert ( ) 2 into Hexadecimal number Step 1: Group the given number into 4 bits from right to left Convert ( ) 2 into octal equivalent number Note: 0 s are added to the left most group to make it a group of 4 bits Step 1: Group the given number into bits from right to left. 3 D ( ) 2 = (3D6) 16 { { { Note: The left most groups have less than 3 bits, so 0 is added to its left to make a group of 3 bits. Step-2: Find Octal equivalent of each group { { ( ) 2 = (326) 8 { Binary to Hexadecimal Conversion Step 1: Group the given number into 4 bits from right to left Conversion of fractional Binary to Decimal equivalent Follow the steps to convert fractional Binary number to its Decimal equivalent. Step 1: Convert integral part of Binary to Decimal equivalent using positional notation method (Procedure is same as discussed in 2.4.5) Step 2: To convert the fractional part of binary to its decimal equivalent. Step 2.1: Write down the Binary digits in the fractional part Chapter 2 Page indd :59:42

33 Step 2.2: For all the digits write powers of 2 from left to right starting from 2-1, 2-2, n, now write the equivalent weight. Step 2.3: Multiply each digit with its corresponding weight Step 2.4: Add all the values which you obtained in Step 2.3 Workshop 4. Convert the given Binary number into its equivalent Decimal, Octal and Hexadecimal number. 1) ) ) Octal to Decimal Conversion Table 2.5 Positional notation and weight To convert Octal to Decimal, we can use positional notation method. Positional Weight notation 1. Write down the Octal digits and 2-1 (1/2) 0.5 list the powers of 8 from right to 2-2 (1/4) 0.25 left(positional Notation) 2-3 (1/8) For each positional notation of the 2-4 (1/16) digit write the equivalent weight. 2-5 (1/32) (1/64) Multiply each digit with its 2-7 (1/128) corresponding weight Step 3: To get final answer write the integral part (after conversion), followed by a decimal point(.) and the answer arrived at Step 2.4 Example Convert the given Binary number (11.011) 2 into its decimal equivalent Integer part (11) 2 = 3 (Refer table 2.2) ( ) = (11.011) 2 = (3.375) Add all the values Example Convert (1265) 8 to equivalent Decimal number Weight Positional Notation Given number (1265) 8 = = (1265) 8 = (693) Chapter 2 Page indd :59:42

34 Octal to Binary Conversion For each Octal digit in the given number write its 3 digits binary equivalent using positional notation. Example Convert (6213) 8 to equivalent Binary number 4. Add all the values to get one final value. Example Convert (25F) 16 into its equivalent Decimal number (6213) 8 =( ) 2 Weight Positional Notation Given number F(15) (25F) 16 = Workshop = (25F) 16 = (607) Convert the following Octal numbers into Binary numbers Hexadecimal to Binary Conversion (A) 472 (B) 145 (C) 347 (D) 6247 (E) 645 Write 4 bits Binary equivalent for each Hexadecimal digit for the given number using positional notation method Hexadecimal to Decimal Conversion Example To convert Hexadecimal to Decimal we can use positional notation method. 1. Write down the Hexadecimal digits and list the powers of 16 from right to left(positional Notation) 2. For each positional notation written for the digit, now write the equivalent weight. Convert (8BC) 16 into equivalent Binary number 8 B C (8BC) 16 = ( ) 2 3. Multiply each digit with its corresponding weight 28 Chapter 2 Page indd :59:42

35 Workshop 6. Convert the following Hexadecimal numbers to Binary numbers (A) A6 (B) BE (C) 9BC8 (D) BC9 2.5 Binary Representation for Signed Numbers Computers can handle both positive (unsigned) and negative (signed) numbers. The simplest method to represent negative binary numbers is called Signed Magnitude. In signed magnitude method, the left most bit is Most Significant Bit (MSB), is called sign bit or parity bit. If this bit is 0, it is a positive number and if it 1, it is a negative number. Therefore a signed binary number has 8 bits, only 7 bits used for storing values (magnitude) and the 1 bit is used for sign. +43 is represented in memory as follows: Sign bit Magnitude (Value) Most Significant Bit (MSB ) ( 0 represent that the number is positive) Least Significant Bit (LSB) -43 can be represented in memory as follows. Sign bit Magnitude (Value) The numbers are represented in computers in different ways: Least Significant Bit (LSB) Signed Magnitude representation Most Significant Bit (MSB ) ( 1 represent that the number is negative) 1 s Complement 2 s Complement s Complement representation Signed Magnitude representation The value of the whole numbers can be determined by the sign used before it. If the number has + sign or no sign it will be considered as positive. If the number has sign it will be considered as negative. Example: +43 or 43 is a positive number 43 is a negative number In signed binary representation, the left most bit is considered as sign bit. 29 This is an easier approach to represent signed numbers. This is for negative numbers only i.e. the number whose MSB is 1. The steps to be followed to find 1 s complement of a number: Step 1: Step 2: Convert given Decimal number into Binary Check if the binary number contains 8 bits, if less add 0 at the left most bit, to make it as 8 bits. Step 3: Invert all bits (i.e. Change 1 as 0 and 0 as 1) Chapter 2 Page indd :59:42

36 Example Given Number Find 1 s complement for ( 24) 10 Binary Number 1 s Compliment (-24) s Complement representation Binary Addition The following table is useful when adding two binary numbers. A B SUM (A + B) Carry The 2 s-complement method for negative number is as follows: a. Invert all the bits in the binary sequence (i.e., change every 0 to1 and every 1 to 0 ie.,1 s complement) Example Add: b. Add 1 to the result to the Least (Carry Bit) 1 1 Significant Bit (LSB) } Example s Complement represent of (-24) Binary equivalent of +24: bit format: = s complement: Add 1 to LSB: +1 2 s complement of -24: In = 10, is considered as sum 0 and the 1 as carry bit. This carry bit is added with the previous position of the bit pattern. Example Perform Binary addition for the following: Step 1: Convert 23 and 12 into binary form Workshop 7. Write the 1 s complement number and 2 s complement number for the following decimal numbers: (A) 22 (B) -13 (C) -65 (D) Binary Arithmetic As decimal numbers, the binary numbers also permit computations like addition, subtraction, multiplication and division. The following session deals only with binary addition and subtraction s power Binary Number = s power Binary Number = Step 2: Binary addition of 23 and 12: Chapter 2 Page indd :59:42

37 Carry Bit = = = Binary Subtraction Step 2: s power Binary Number = The table for Binary Subtraction is as follows: A B Difference Borrow (A-B) s Compliment s Compliment Step 3: Binary Addition of 21 and 5 : Carry bit When subtracting 1 from 0, borrow from the next Most Significant Bit, when 10 (Result) borrowing from the next Most Significant Bit, if it is 1, replace it with 0. If the next Most Workshop Significant Bit is 0, you must borrow from a 8. Perform the following binary more significant bit that contains 1 and replace it with 0 and 0s upto that point become 1s. Example Subtract computations: (A) (C) (B) (D) ( 2 10 ) ( 6 10 ) (-) Example Perform binary addition for the following: ( 21) 10 + (5) 10 Step 1: Change -21 and 5 into binary form s power Binary Number = Representing Characters in Memory As represented in introduction, all the input data given to the computer should be in understandable format. In general, 26 uppercase letters, 26 lowercase letters, 0 to 9 digits and special characters are used in a computer, which is called character set. All these character set are denoted through numbers only. All Characters in the character set needs a common encoding system. There are several encoding systems used for computer. They are 31 Chapter 2 Page indd :59:42

38 BCD Binary Coded Decimal EBCDIC Extended Binary Coded Decimal Interchange Code ASCII American Standard Code for Information Interchange Unicode ISCII - Indian Standard Code for Information Interchange Binary Coded Decimal (BCD) This encoding system is not in the practice right now. This is 2 6 bit encoding system. This can handle 2 6 = 64 characters only American Standard Code for Information Interchange (ASCII) Unicode This is the most popular encoding This coding system is used in system recognized by United States. most of the modern computers. The Most of the computers use this system. Remember this encoding system can handle English characters only. This can handle 2 7 bit which means 128 characters. In this system, each character has individual number (Refer Appendix). The new edition (version) ASCII -8, has 2 8 bits and can handle 256 characters are represented from 0 to 255 unique numbers. The ASCII code equivalent to the uppercase letter A is 65. The binary representation of ASCII (7 bit) value is Also in ASCII-8 bit Extended Binary Coded Decimal Interchange Code (EBCDIC) This is similar to ASCII Code with 8 bit representation. This coding system 32 is formulated by International Business Machine(IBM). The coding system can handle 256 characters. The input code in ASCII can be converted to EBCDIC system and vice - versa Indian Standard Code for Information Interchange (ISCII) ISCII is the system of handling the character of Indian local languages. This as a 8-bit coding system. Therefore it can handle 256 (2 8 ) characters. This system is formulated by the department of Electronics in India in the year and recognized by Bureau of Indian Standards (BIS). Now this coding system is integrated with Unicode. popular coding scheme after ASCII is Unicode. ASCII can represent only 256 characters. Therefore English and European Languages alone can be handled by ASCII. Particularly there was a situation, when the languages like Tamil, Malayalam, Kannada and Telugu could not be represented by ASCII. Hence, the Unicode was generated to handle all the coding system of Universal languages. This is 16 bit code and can handle characters. Unicode scheme is denoted by hexadecimal numbers. The Unicode table of Tamil, Malayalam, Telugu and Kannada is shown Table 2.6 Chapter 2 Page indd :59:42

39 33 Table 2.6 Unicode Table of Tamil Unicode Table of Malayalam 0B8 0B9 0BA 0BB 0BC 0BD 0BE 0BF $ ஃ அ ஆ இ ஈ உ ஊ எ ஏ ஐ ஒ ஓ ஔ க ங ச ஜ ஞ ட ண த ந ன ப ம ய ர ற ல ள ழ வ ஶ ஷ ஸ ஹ $ $ $ $ $ $ $ $ $ $ $ $ ௐ $ ௦ ௧ ௨ ௩ ௪ ௫ ௬ ௭ ௮ ௯ ௰ ௱ ௲ 0B82 0B83 0B85 0B86 0B87 0B88 0B89 0B8A 0B8E 0B8F 0B90 0B92 0B93 0B94 0B95 0B99 0B9A 0B9C 0B9E 0B9F 0BA3 0BA4 0BA8 0BA9 0BAA 0BAE 0BAF 0BB0 0BB1 0BB2 0BB3 0BB4 0BB5 0BB6 0BB7 0BB8 0BB9 0BBE 0BBF 0BC0 0BC1 0BC2 0BC6 0BC7 0BC8 0BCA 0BCB 0BCC 0BCD 0BD0 0BD7 0BE6 0BE7 0BE8 0BE9 0BEA 0BEB 0BEC 0BED 0BEE 0BEF 0BF0 0BF1 0BF2 0BF3 0BF4 0BF5 0BF6 0BF7 0BF8 0BF9 0BFA A B C D E F 0D0 0D1 0D2 0D3 0D4 0D5 0D6 0D7 $ $ $ $ അ ആ ഇ ഈ ഉ ഊ ഋ ഌ എ ഏ ഐ ഒ ഓ ഔ ക ഖ ഗ ഘ ങ ച ഛ ജ ഝ ഞ ട ഠ ഡ ഢ ണ ത ഥ ദ ധ ന ഩ പ ഫ ബ ഭ മ യ ര റ ല ള ഴ വ ശ ഷ സ ഹ ഺ $ $ ഽ $ $ $ $ $ $ $ $ $ $ $ $ $ $ ൎ $ ൠ ൡ $ $ ൦ ൧ ൨ ൩ ൪ ൫ ൬ ൭ ൮ ൯ ൰ ൱ ൲ ൳ ൴ ൵ ൺ ൻ ർ ൽ ൾ ൿ 0D00 0D01 0D02 0D03 0D05 0D06 0D07 0D08 0D09 0D0A 0D0B 0D0C 0D0E 0D0F 0D10 0D12 0D13 0D14 0D15 0D16 0D17 0D18 0D19 0D1A 0D1B 0D1C 0D1D 0D1E 0D1F 0D20 0D21 0D22 0D23 0D24 0D25 0D26 0D27 0D28 0D29 0D2A 0D2B 0D2C 0D2D 0D2E 0D2F 0D30 0D31 0D32 0D33 0D34 0D35 0D36 0D37 0D38 0D39 0D3A 0D3B 0D3C 0D3D 0D3E 0D3F 0D40 0D41 0D42 0D43 0D44 0D46 0D47 0D48 0D4A 0D4B 0D4C 0D4D 0D4E 0D4F 0D54 0D55 0D56 0D57 0D58 0D59 0D5A 0D5B 0D5C 0D5D 0D5E 0D5F 0D60 0D61 0D62 0D63 0D66 0D67 0D68 0D69 0D6A 0D6B 0D6C 0D6D 0D6E 0D6F 0D70 0D71 0D72 0D73 0D74 0D75 0D76 0D77 0D78 0D79 0D7A 0D7B 0D7C 0D7D 0D7E 0D7F A B C D E F Chapter 2 Page indd :59:42

40 34 Table 2.6 Unicode Table of Telugu Unicode Table of Kannada 0C0 0C1 0C2 0C3 0C4 0C5 0C6 0C7 $ $ $ $ అ ఆ ఇ ఈ ఉ ఊ ఋ ఌ ఎ ఏ ఐ ఒ ఓ ఔ క ఖ గ ఘ ఙ చ ఛ జ ఝ ఞ ట ఠ డ ఢ ణ త థ ద ధ న ప ఫ బ భ మ య ర ఱ ల ళ వ శ ష స హ ఽ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ ౘ ౙ ౠ ౡ $ $ ౦ ౧ ౨ ౩ ౪ ౫ ౬ ౭ ౮ ౯ ౸ ౹ ౺ ౻ ౼ ౽ ౾ 0C00 0C01 0C02 0C03 0C05 0C06 0C07 0C08 0C09 0C0A 0C0B 0C0C 0C0E 0C0F 0C10 0C12 0C13 0C14 0C15 0C16 0C17 0C18 0C19 0C1A 0C1B 0C1C 0C1D 0C1E 0C1F 0C20 0C21 0C22 0C23 0C24 0C25 0C26 0C27 0C28 0C2A 0C2B 0C2C 0C2D 0C2E 0C2F 0C30 0C31 0C32 0C33 0C34 0C35 0C36 0C37 0C38 0C39 0C3D 0C3E 0C3F 0C40 0C41 0C42 0C43 0C44 0C46 0C47 0C48 0C4A 0C4B 0C4C 0C4D 0C55 0C56 0C58 0C59 0C5A 0C60 0C61 0C62 0C63 0C66 0C67 0C68 0C69 0C6A 0C6B 0C6C 0C6D 0C6E 0C6F 0C78 0C79 0C7A 0C7B 0C7C 0C7D 0C7E 0C7F A B C D E F 0C8 0C9 0CA 0CB 0CC 0CD 0CE 0CF $ $ $ ಅ ಆ ಇ ಈ ಉ ಊ ಋ ಌ ಎ ಏ ಐ ಒ ಓ ಔ ಕ ಖ ಗ ಘ ಙ ಚ ಛ ಜ ಝ ಞ ಟ ಠ ಡ ಢ ಣ ತ ಥ ದ ಧ ನ ಪ ಫ ಬ ಭ ಮ ಯ ರ ಱ ಲ ಳ ವ ಶ ಷ ಸ ಹ $ ಽ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ ೞ ೠ ೡ $ $ ೦ ೧ ೨ ೩ ೪ ೫ ೬ ೭ ೮ ೯ ೱ ೲ 0C80 0C81 0C82 0C83 0C85 0C86 0C87 0C88 0C89 0C8A 0C8B 0C8C 0C8E 0C8F 0C90 0C92 0C93 0C94 0C95 0C96 0C97 0C98 0C99 0C9A 0C9B 0C9C 0C9D 0C9E 0C9F 0CA0 0CA1 0CA2 0CA3 0CA4 0CA5 0CA6 0CA7 0CA8 0CAA 0CAB 0CAC 0CAD 0CAE 0CAF 0CB0 0CB1 0CB2 0CB3 0CB5 0CB6 0CB7 0CB8 0CB9 0CBC 0CBD 0CBE 0CBF 0CC0 0CC1 0CC2 0CC3 0CC4 0CC6 0CC7 0CC8 0CCA 0CCB 0CCC 0CCD 0CD5 0CD6 0CDE 0CE0 0CE1 0CE2 0CE3 0CE6 0CE7 0CE8 0CE9 0CEA 0CEB 0CEC 0CED 0CEE 0CEF 0CF1 0CF A B C D E F Chapter 2 Page indd :59:42

41 Alphabets Appendix American Standard Code for Information Interchange (ASCII) (Few specific characters only) Alphabets Decimal number Binary number (8 bit) 35 Octal number Hexadecimal number A B C D E F G H I J A K B L C M D N E O F P Q R S T U V W X Y Z A a b c d e Chapter 2 Page indd :59:43

42 f g h i j A k B l C m D n E o F p q r s t u v w x y z A Numerals Alphabets Decimal number Binary number (8 bit) Octal number Hexadecimal number Chapter 2 Page indd :59:43

43 Special Characters Special symbols Decimal number Binary number (8 bit) Octal number Hexadecimal number Blank ! " # $ % & ' ( ) * A B, C D E / F : A ; B < C = D > E? [ B \ C ] D ^ E _ F ` { B C } D ~ E 37 Chapter 2 Page indd :59:43

44 Evaluation Part I I Choose the best answer 1. Which refers to the number of bits processed by a computer s CPU? A) Byte B) Nibble C) Word length D) Bit 2. How many bytes does 1 KiloByte contain? A) 1000 B) 8 C) 4 D) Expansion for ASCII A) American School Code for Information Interchange B) American Standard Code for Information Interchange C) All Standard Code for Information Interchange D) American Society Code for Information Interchange 4. 2^50 is referred as A) Kilo B) Tera C) Peta D) Zetta 5. How many characters can be handled in Binary Coded Decimal System? A) 64 B) 255 C) 256 D) For what is the Hexadecimal equivalent? A) F B) E C) D D) B 7. What is the 1 s complement of ? A) B) C) D) Which amongst this is not an Octal number? A) 645 B) 234 C) 876 D) Chapter 2 Page indd :59:43

45 II Very Short Answers 1. What is data? 2. Write the 1 s complement procedure. 3. Convert (46) 10 into Binary number 4. We cannot find 1 s complement for (28) 10. State reason. 5. List the encoding systems for characters in memory. III Short Answers 1. What is radix of a number system? Give example 2. Write note on binary number system. 3. Convert (150) 10 into Binary, then convert that Binary number to Octal 4. Write short note on ISCII 5. Add a) b) IV Detail Answers 1. a) Write the procedure to convert fractional Decimal to Binary b) Convert (98.46) 10 to Binary 2. Find 1 s Complement and 2 s Complement for the following Decimal number a) -98 b) a) Add b) Subtract Chapter 2 Page indd :59:43

46 2.8 Introduction Boolean algebra is a mathematical discipline that is used for designing digital circuits in a digital computer. It describes the relation between inputs and outputs of a digital circuit. The name Boolean algebra has been given in honor of an English mathematician George Boole who proposed the basic principles of this algebra. George Boole ( ) was born to a low c l a s s family and only received an elementary school education. Despite that, he taught himself Variables as these can store one highly advanced mathematics and of the two values of True or False. different languages as a teenager without any assistance. He started teaching at Logical Operations: age sixteen, and started his own school at age nineteen. By his mid-twenties, he had mastered most of the important mathematical principles in his day Binary valued quantities: Every day we have to make logical decisions: 1. Should I carry Computer Science book every day? Yes / No = 10 is this answer correct? Yes / No Part - II - Boolean Algebra Chennai is capital of India? Yes / No 4. What did I say yesterday? The first three questions thrown above, the answer may be True (Yes) or False (No). But the fourth one, we cannot be answer as True or False. Thus, sentences which can be determined to be True or False are called Logical Statement or Truth Functions. The results True or False are called Truth Values. The truth values depicted by logical constant 1 and 0; 1 means True and 0 means False. The variable which can store these truth values are called Logical variable or Binary valued variables or Boolean Boolean algebra makes use of variables and operations (functions). The basic logical operations are AND, OR and NOT, which are symbolically represented by dot (. ), plus ( + ), and by over bar / single apostrophe respectively. These symbols are also called as Logical Operators Truth Table: A truth table represents all the possible values of logical variable or statements along with all the possible results of given combination of truth values. Chapter 2 Page indd :59:43

47 2.8.4 AND operator The AND operator is defined in Boolean algebra by the use of the dot (.) operator. It is similar to multiplication in ordinary algebra. The AND operator combines two or more input variables so that the output is true only if all the inputs are true. The truth table for a 2-input AND operator is shown as follows: A B Y The above 2-input AND operation is expressed as: Y = A. B table for a NOT operator where A is the input variable and Y is the output is shown below: A Y The NOT operator is represented algebraically by the Boolean expression: Y = A Example: Consider the Boolean equation: D = A + ( B. C ) D is equal to 1 (true) if A is 1 or if ( B. C ) is 1, that is, B = 0 and C = 1. Otherwise D is equal to 0 (false) OR operator The basic logic functions AND, OR, and NOT can also be combined to make The plus sign is used to indicate the OR other logic operators such as NAND and operator. The OR operator combines two or NOR more input variables so that the output is true if at least one input is true. The truth table for a 2-input OR operator is shown as follows: NAND operator The NAND is the combination of A 0 0 B 0 1 Y 0 1 NOT and AND. The NAND is generated by inverting the output of an AND operator. The algebraic expression of the NAND function is: Y = A. B The above 2-input OR operation is expressed as: Y = A + B NOT operator The NOT operator has one input and one output. The input is either true or false, and the output is always the opposite, that is, the NOT operator inverts the input. The truth 41 The NAND function truth table is shown below: A B Y A NAND B = NOT (A AND B) Chapter 2 Page indd :59:43

48 2.8.8 NOR operator The NOR is the combination of NOT and OR. The NOR is generated by inverting the output of an OR operator. The algebraic expression of the NOR function is: Y = A + B The NOR function truth table is shown below: A B Y A gate is a basic electronic circuit which operates on one or more signals to produce an output signal. There are three fundamental gates namely AND, OR and NOT. The other logic gates like NAND, NOR, XOR and XNOR are derived gates which are derived from the fundamental gates. NAND and NOR gates are called Universal gates, because the fundamental logic gates can be realized through them. The output is "true" only when both inputs are "true", otherwise, the output is "false". In other words the output will be 1 if and only if both inputs are 1; otherwise the output is 0. The output of the AND gate is represented by avariable say C, where A and B are two and if input boolean variables. In boolean algebra, a variable can take either of the values '0' or '1'. The logical symobl of the AND gate is A B C=AB Fig. 2.4 Logic symbol of AND Gate One way to symbolize the action of an AND gate is by writing the boolean function. A NOR B = NOT (A OR B) C = A AND B 2.9 Basic Logic Gates: In boolean algebra the multiplication sign stands for the AND operation. Therefore, the output of the AND gate is simply C = A. B or C = AB Read this as "C equals A AND B". Since there are two input variables here, the truth table has four entries, because there are four possible inputs : 00, 01, 10 and AND Gate The AND gate can have two or more input signals and produce an output signal. For instance if both inputs are 0, C = A. B = 0. 0 = 0 42 Chapter 2 Page indd :59:43

49 The truth table for AND Gate is Input Output A B C Table 2.7 Truth Table for AND Gate Input Output A B C Table 2.8 Truth Table for OR Gate NOT Gate OR Gate The NOT gate, called a logical inverter, has only one input. It reverses the The OR gate gets its name from its logical state. In other words the output C behaviour like the logical inclusive "OR". is always the complement of the input. The The output is "true" if either or both of the logical symbol of the NOT gate is inputs are "true". If both inputs are "false" then the output is "false". In otherwords the output will be 1 if and only if one or both inputs are 1; otherwise, the output is 0. The A C = A logical symbol of the OR gate is Fig. 2.6 Logic symbol of NOT Gate A The boolean function of NOT gate is C=A+B B C = NOT A Fig. 2.5 Logic symbol of OR Gate The OR gate output is C = A OR B We use the + sign to denote the OR function. Therefore, C = A + B Read this as "C equals A OR B". For instance, if both the inputs are 1 C = A + B = = 1 The truth table for OR gate is In boolean algerbra, the overbar stands for NOT operation. Therefore, C = A Read this as "C equals NOT A" or "C equals the complement of A". If A is 0, C = 0 = 1 On the otherhand, if A is 1, C = 1 = 0 The truth table for NOT gate is 43 Chapter 2 Page indd :59:43

50 Input Output A C Table 2.9 Truth Table for NOT Gate NOR Gate Input Output A B C Table 2.10 Truth Table for NOR Gate The NOR gate circuit is an OR gate followed by an an inverter. Its output is "true" if both inputs are "false" Otherwise, the output is "false". In other words, the only way to get '1' as output is to have both inputs '0'. Otherwise the output is 0. The logic circuit of the NOR gateis A A+B C=A+B B B B Fig. 2.7 Logic Circuit of NOR Gate Fig. 2.9 Logic circuit of Bubbled AND Gate A B Fig. 2.8 Logic symbol of NOR Gate The output of NOR gate is C = ( A + B) C Bubbled AND Gate Gate A The Logic Circuit of Bubbled AND A C=A.B In the above circuit, invertors on the input lines of the AND gate gives the output as C = ( A. B) This circuit can be redrawn as the bubbles on the inputs, where the bubbles represent inversion. Read this as "C equals NOT of A OR B" or "C equals the complement of A OR B". A B C For example if both the inputs are 0, C = ( 0 + 0) = 0 = 1 The truth table for NOR gate is Fig Logic Symbol of Bubbled AND Gate We refer this as bubbled AND gate. Let us analyse this logic circuit for all input possiblities. 44 Chapter 2 Page indd :59:43

51 If A = 0 and B = 0 C=(0.0) = 1.1 = 1 If A = 0 and B = 1 C=(0.1) = 1.0 = 0 If A = 1 and B = 0 C=(1.0) = 0.1 = 0 If A = 1 and B = 1 C=(1.1) = 0.0 = 0 Here the truth table is A A.B C=A.B B Fig Logic Circuit of NAND Gate The logical symbol of NAND gate is A C B Input Output A B C The output of the NAND gate is C = (A. B) Read this as "C" equals NOT of A AND B" or "C" equals the complement of A You can see that, a bubbled AND gate AND B". produces the same output as a NOR gate. So, For example if both the inputs are 1 You can replace each NOR gate by a bubbled AN D gate. In other words the circuits are C = (1. 1)= 1 = 0 interchangeable. The truth table for NAND gate is Therefore Input Output (A + B) = A. B Which establishes the De Morgan's first theorem NAND Gate The NAND gate operates an AND gate followed by a NOT gate. It acts in the manner of the logical operation "AND" followed by inversion. The output is "false" if both inputs are "true", otherwise, the output is "true". In otherwords the output of the NAND gate is 0 if and only if both the inputs are 1, otherwise the output is 1. The logice circuit of NAND gate is Fig Logic Symbol of NAND Gate A B C Table 2.11 Truth Table for NAND Gate Bubbled OR Gate is A B The logic circuit of bubbled OR gate A B C=A + B Fig Logic Circuit of Bubbled OR Gate 45 Chapter 2 Page indd :59:43

52 The output of this circuit can be written as C = A + B are different, but 0 if the inputs are the same. The logic circuit of XOR gate is The above circuit can be redrawn as the bubbles on the input, where the bubbles represents the inversion. A B Fig Logic Symbol of Bubbled OR Gate C Fig Logic Circuit of XOR Gate The output of the XOR gate is We refer this as bubbled OR gate. The truth table for the bubbled OR is The truth table for XOR gate is Input Output Input Output A B C A B C Table 2.13 Truth Table for XOR Gate Table 2.12 Truth Table for Bubbled OR Gate In boolean algebra. exclusive - OR operator If we compare the truth tables of the or "encircled plus". bubbled OR gate with NAND gate, they are identical. So the circuits are interchangeable. Hence C = A B The logical symbol of XOR gate is Therefore, A (A. B) = A + B B C A B A B B A A.B A.B C = A.B+ A.B Which establishes the De Morgan's second theorem XOR Gate The XOR (exclusive - OR) gate acts in the same way as the logical "either/or." The output is "true" if either, but not both, of the inputs are "true". The output is "false" if both inputs are "false" or if both inputs are "true." Another way of looking at this circuit is to observe that the output is 1 if the inputs Fig Logic Symbol of XOR Gate XNOR Gate The XNOR (exclusive - NOR) gate is a combination XOR gate followed by an inverter. Its output is "true" if the inputs are the same, and "false" if the inputs are different. In simple words, the output is 1 if the input are the same, otherwise the output is 0. The logic circuit of XNOR gate is 46 Chapter 2 Page indd :59:43

53 A B A B C = A B Fig Logic Circuit of XNOR Gate The output of the XNOR is NOT of XOR C = A B = A. B + A. B = AB + A B (Using De Morgan's Theorem) In boolean algebra, or "included dot" stands for the XNOR. Therefore, C = A B The logical symbol is A C=A B B The truth table for XNOR Gate is Input Fig Logic Symbol of XNOR Gate Output A B C Table 2.14 Truth Table for XNOR Gate Using combination of logic gates, complex operations can be performed. In theory, there is no limit to the number of gates that can be arranged together in a single device. But in practice, there is a limit to the number of gates that can be packed into a given physical space. Arrays of logic gates are found in digital integrated circuits. 47 Chapter 2 Page indd :59:43

54 Theorems of Boolean Algebra Identity A + 0 = A A. 1 = A Complement A + A = 1 A. A = 0 Commutative A + B = B + A A. B = B. A Associative A + (B + C) = (A + B) + C A. (B. C) = (A. B). C De Morgan s A + B = A. B Distributive (A. B) = A + B A. (B + C) = A. B + A. C A + (B. C) = (A + B). (A + C) Null Element A + 1 = 1 A. 0 = 0 Involution (A) = A Indempotence A + A = A A. A = A Absorption A + (A. B) = A A. (A + B) = A 3rd Distributive A + A. B = A + B 48 Chapter 2 Page indd :59:43

55 Table Logic Gates and their corresponding Truth Tables Logical Gates Symbol Truth Table AND OR NOT A B AB A B A + B A A A B A B NAND NOR XOR XNOR A B A + B A B A B A B A B Chapter 2 Page indd :59:43

56 Evaluation Part I 1. Which is a basic electronic circuit which operates on one or more signals? (A) Boolean algebra (B) Gate (C) Fundamental gates (D) Derived gates 2. Which gate is called as the logical inverter? (A) AND (B) OR ( C) NOT (D) XNOR 3. A + A =? (A) A (B) O (C ) 1 (D) A 4. NOR is a combination of? (A) NOT(OR) (B)NOT(AND) (C ) NOT(NOT) (D) NOT(NOR) 5. NAND is called as Gate (A) Fundamental Gate (B) Derived Gate (C ) Logical Gate (D) Electronic gate PART II 1. What is Boolean Algebra? 2. Write a short note on NAND Gate. 3. Draw the truth table for XOR gate. 4. Write the associative laws? 5. What are derived gates? Part III 1. Write the truth table of fundamental gates. 2. Write a short note on XNOR gate. 3. Reason out why the NAND an NOR are called universal gates? 4. Give the truth table of XOR gate. 5. Write the De Morgan s law. PART IV 1. Explain the fundamental gates with expression and truth table. 2. How AND and OR can be realized using NAND and NOR gate. 3. Explain the Derived gates with expression and truth table. 50 Chapter 2 Page indd :59:43

57 Unit I Fundamentals of Computers CHAPTER 3 Computer Organization Learning Objectives 3.1 Introduction To know the organization of the computer components and their interconnections. To know the processors and their characteristics. To know the importance of memory devices and their roles in a computer. To explore RAM, ROM and differentiate each of them. engineering considerations involved in To know about cache memory and how it improves the performance of a computer To know the secondary devices and their usage Computer organization deals with the hardware components of a computer system. It includes Input / Output devices, the Central Processing Unit, storage devices and primary memory. It is concerned with how the various components of computer hardware operate. It also deals with how they are interconnected to implement an architectural specification. The term computer organization looks similar to the term computer architecture. But, computer architecture deals with the designing a computer. On the other hand, Computer Organization deals with the hardware components that are transparent to the programmer Basics of Microprocessors To know about the ports and interfaces so that external devices can be connected The CPU is the major component of a computer, which performs all tasks. This is realized by the microprocessor which is an Integrated Circuit. Microprocessors were first introduced in early 1970s. The first general purpose microprocessor, 4004 was developed by Intel Inc. The microprocessor is a programmable multipurpose silicon chip. It is driven by clock pulses. It accepts input as a binary data and after processing, it provides the output data as per the 51 Chapter 3 Page indd :06:13

58 instructions stored in the memory. A block diagram of a microprocessor based system is shown in Figure 3.1. Input Microprocessor Output Characteristics of Microprocessors A Microprocessor s performance depends on the following characteristics: a) Clock speed b) Instruction set Memory c) Word size Figure 3.1 A Microprocessor - Based System The microprocessor is made up of 3 main units. They are: Arithmetic and Logic unit (ALU): To perform arithmetic and logical instructions based on computer instructions. Control unit: To control the overall operations of the computer through signals. Registers (Internal Memory): They and 20,000 Hz. Sound waves close to 20 are used to hold the instruction and data for the execution of the processor. The microprocessor is able to communicate with the memory units and the Input / Output devices as in Figure 3.2. The system bus is a bunch of wires which is the collection of address bus, data bus and control bus that serves as communication channels between the Microprocessor and other devices. ALU Register Control Unit Micro Processor System Input / Output Memory ROM RAM Figure 3.2 Interconnecting the Microprocessor with Other Devices 52 Speed Measurement Hertz abbreviated as Hz is the standard unit of measurement used for measuring frequency. Since frequency is measured in cycles per second, one hertz equals one cycle per second. Hertz is commonly used to measure wave frequencies, such as sound waves, light waves, and radio waves. For example, the average human ear can detect sound waves between 20 Hz have a low pitch and are called "bass" frequencies. Sound waves above 5,000 Hz have a high pitch and are called "treble" frequencies. While hertz can be used to measure wave frequencies, it is also used to measure the speed of computer processors. For example, each CPU is rated at a specific clock speed. This number indicates how many instruction cycles the processor can perform in every second. Since modern processors can perform millions or even billions of instructions per second, clock speeds are typically measured in megahertz or gigahertz. Chapter 3 Page indd :06:13

59 a) Clock Speed Every microprocessor has an internal clock that regulates the speed at which it executes instructions. The speed at which the microprocessor executes instructions is called the clock speed. Clock speed is measured in MHz (Mega Hertz) or in GHz (Giga Hertz). b) Instruction Set The first commercial microprocessor, Intel 4004 is a 4 bit processor. It has 4 input pins and 4 output pins. Number of output pins is always equal to the number of input pins. It can process 4 bits at a time. So it is called as a 4 bit processor. Intel 4004 A command which is given to a computer to perform an operation on data is called an instruction. Basic set of machine level instructions that a microprocessor is designed to execute is called as an instruction set. This Produced From late 1971 to instruction set carries out the following 1981 types of operations: Manufacturer Intel Inc. Clock Speed 740 khz Data transfer Size 10 Micrometer (µm) Transistors 2300 Arithmetic operations Data width 4 bits Package 16 pin Logical operations Control flow Input/output c) Word Size Intel Inc. released many microprocessors like Intel 8085 which is an 8 bit processor, Intel 8086 which is a 16 bit processor and so on. Currently most of the microprocessors use 32 bit or 64 bit architecture. The number of bits that can be processed by a processor in a single instruction is called its word size. Word size determines the amount of RAM that can be accessed by a microprocessor at one time and the total number of pins on the microprocessor. Total number of input and output pins in turn determines the architecture of the microprocessor. 3.3 Data communication between CPU and memory The Central Processing Unit(CPU) has a Memory Data Register (MDR) and a Memory Address Register (MAR). The Memory Data Register (MDR) keeps the data which is transferred between the Memory and the CPU. The Program 53 Chapter 3 Page indd :06:13

60 Counter (PC) is a special register in the CPU which always keeps the address of the next instruction to be executed. The Arithmetic and Logic unit of CPU places the address of the memory to be fetched, into the Memory Address Register. A bus is a collection of wires used for communication between the internal components of a computer. The address bus is used to point a memory location. A decoder, a digital circuit is used to point to the specific memory location where the word can be located. The address register is connected with the address bus, which provides the address of the instruction. A data bus is used to transfer data between the memory and the CPU. The data bus is bidirectional and the address bus is unidirectional. The control bus controls both read and write operations. The read operation fetches data from memory and Register (MDR). If the processor is an 8-bit processor like Intel 8085, its MDR and the word in the RAM both have 8 bits. If the size of the MDR is eight bits, which can be connected with a word in the memory which is also eight bits size. The data bus has eight parallel wires to transfer data either from MDR to word or word to MDR based on the control(read or write). This control line is labeled as R/W, which becomes 1 means READ operation and 0 means WRITE operation. Figure 3.4 shows the content of MDR and the word before the READ operation.also, Figure 3.5 shows the content of MDR and the word after the READ operation. MDR Memory Word transfers to MDR. A single control line performs two operations like Read/Write using 1or 0. Also, the write operation transfers data from the MDR to memory. This organization is shown in Figure 3.3. Address Bus Figure 3.4 Before the read operation MDR Memory Word When R/W=1 MAR CPU MDR Control Unit R / W Word Memory (RAM) Data Bus Figure 3.3 Bus connectivity between CPU and Memory The word in the RAM has the same size (no. of bits) as the Memory Data Figure 3.5 After the read operation The read operation transfers the data(bits) from word to Memory Data Register. The write operation transfers the data(bits) from Memory Data Register to word. 54 Chapter 3 Page indd :06:14

61 If 5V is applied at one end of a wire, the other end also can receive 5V. In the same way, the buses are wires, and the binary data are voltages (5V as 1 and 0V as 0), and these buses can simply pass the data as voltages from one end to other. 3.4 Types of Microprocessors hardware was expensive as well as difficult to build. As technology had developed to overcome these issues, more and more complex instructions were added to increase the functionality of microprocessors. Let us learn more about the two types of microprocessors based on their instruction sets Reduced Instruction Set Computers (RISC) Microprocessors can be classified based on the following criteria: The width of data that can be processed The instruction set Classification of Microprocessors based on the Data Width 55 RISC stands for Reduced Instruction Set Computers. They have a small set of highly optimized instructions. Complex instructions are also implemented using simple instructions, thus reducing the size of the instruction set. Examples of RISC processors are Pentium IV, Intel P6, AMD K6 and K7. Depending on the data width, Complex Instruction Set Computers (CISC) microprocessors can process instructions. The microprocessors can be classified as follows: 8-bit microprocessor 16-bit microprocessor 32-bit microprocessor 64-bit microprocessor Classification of Microprocessors based on Instruction Set The size of the instruction set is another important consideration while categorizing microprocessors. Initially, microprocessors had very small instruction sets because complex CISC stands for Complex Instruction Set Computers. They support hundreds of instructions. Computers supporting CISC can accomplish a wide variety of tasks, making them ideal for personal computers. Examples of CISC processors are Intel 386 & 486, Pentium, Pentium II and III, and Motorola Memory Devices A memory is just like a human brain. It is used to store data and instructions. Computer memory is the storage space in the computer, where data Chapter 3 Page indd :06:14

62 and instructions are stored. There are two types of accessing methods to access (read or write) the memory. They are sequential access and random access. In sequential access, the memory is accessed in an orderly manner from starting to end. But, in random access, any byte of memory can be accessed directly without navigating through previous bytes. Different memory devices are arranged according to the capacity, speed and cost as shown in Figure 3.6. RAM is a volatile memory, which means that the information stored in it is not permanent. As soon as the power is turned off, whatever data that resides in RAM is lost. It allows both read and write operations Types of RAM There are two basic types of RAM Dynamic RAM (DRAM) Static RAM (SRAM) These two types differ in the technology they use to hold data. Dynamic RAM being a common type needs to be Cache refreshed frequently. Static RAM needs Memory to be refreshed less often, which makes Main Memory it faster. Hence, Static RAM is more expensive than Dynamic RAM. Hard Disk Read Only Memory (ROM) Figure 3.6 Memory Hierarchy Read Only Memory refers to special Random-Access Memory (RAM) Smaller capacity, faster access time and higher cost larger capacity,slower access time and Lower cost The main memory is otherwise called as Random Access Memory. This is available in computers in the form of Integrated Circuits (ICs). It is the place in a computer where the Operating System, Application Programs and the data in current use are kept temporarily so that they can be accessed by the computer s processor. The smallest unit of information that can be stored in the memory is called as a bit. The memory can be accessed by a collection of 8 bits which is called as a byte. The bytes are referred by B. If a computer has 1 megabyte of memory, then it can store 10,48,576 bytes (or characters) of information. [Hence 1MB is 1024KB and 1 KB is 1024 Bytes, So 1024X1024 =10,48,576 Bytes] 56 memory in a computer with pre-recorded data at manufacturing time which cannot be modified. The stored programs that start the computer and perform diagnostics are available in ROMs. ROM stores critical programs such as the program that boots the computer. Once the data has been written onto a ROM chip, it cannot be modified or removed and can only be read. ROM retains its contents even when the computer is turned off. So, ROM is called as a non-volatile memory Programmable Read Only Memory (PROM) Programmable read only memory is also a non-volatile memory on which data can be written only once. Once a Chapter 3 Page indd :06:14

63 program has been written onto a PROM, it remains there forever. Unlike the main memory, PROMs retain their contents even when the computer is turned off. The PROM differs from ROM. PROM is manufactured as a blank memory, whereas a ROM is programmed during the manufacturing process itself. PROM programmer or a PROM burner is used to write data to a PROM chip. The process of programming a PROM is called burning the PROM Erasable Programmable Read Only Memory (EPROM) Erasable Programmable Read Only Memory is a special type of memory which serves as a PROM, but the content can be erased using ultraviolet rays. EPROM retains its contents until it is exposed Cache Memory to ultraviolet light. The ultraviolet light clears its contents, making it possible to The cache memory is a very high reprogram the memory. An EPROM differs from a PROM, PROM can be written only once and cannot be erased. EPROMs are used widely in personal computers because they enable the manufacturer to change the contents of the PROM to replace with updated versions or erase the contents before the computer is delivered. Figure 3.7 Erasable Programmable Read Only Memory 57 Most of the EPROM chips have a transparent area at the top surface which is covered by stickers. If it gets removed, the ultraviolet light in the sunlight may erase the contents Electrically Erasable Programmable Read Only Memory (EEPROM) Electrically Erasable Programmable Read Only Memory is a special type of PROM that can be erased by exposing it to an electrical charge. Like other types of PROM, EEPROM retains its contents even when the power is turned off. Comparing with all other types of ROM, EEPROM is slower in performance. speed and expensive memory, which is used to speed up the memory retrieval process. Due to its higher cost, the CPU comes with a smaller size of cache memory compared with the size of the main memory. Without cache memory, every time the CPU requests the data, it has to be fetched from the main memory which will consume more time. The idea of introducing a cache is that, this extremely fast memory would store data that is frequently accessed and if possible, the data that is closer to it. This helps to achieve the fast response time, Where response Time, (Access Time) refers to how quickly the memory can respond to a read / write request. Figure 3.8 shows the arrangement of cache memory between the CPU and the main memory. Chapter 3 Page indd :06:14

64 CPU Fast Cache Slow Main Memory Figure 3.8 Cache Memory Arrangement 3.6 Secondary Storage Devices Fig 3.9 Compact Disc A computer generally has limited amount of main memory which is expensive and volatile. To store data and programs permanently, secondary storage devices are used. Secondary storage devices serve as a supportive storage to main memory and they are non-volatile in nature, secondary storage is also called as Backup storage Compact Disc (CD) A CD or CD-ROM is made from 1.2 millimeters thick, polycarbonate plastic material. A thin layer of aluminum or gold is applied to the surface. CD data is represented as tiny indentations known as "pits", encoded in a spiral track moulded into the top of the polycarbonate layer. The areas between pits are known as "lands". A motor within the CD player rotates the disk. The capacity of an ordinary CD- ROM is 700MB Digital Versatile Disc (DVD) A DVD (Digital Versatile Disc or Digital Video Disc) is an optical disc capable of storing up to 4.7 GB of data, more than six times what a CD can hold. DVDs are often used to store movies at a better quality. Like CDs, DVDs are read with a laser. The disc can have one or two sides, and one or two layers of data per side; the number of sides and layers determines Hard Disks how much it can hold. A 12 cm diameter Hard disk is a magnetic disk on disc with single sided, single layer has 4.7 which you can store data. The hard disk GB capacity, whereas the single sided, has the stacked arrangement of disks accessed by a pair of heads for each of the disks. The hard disks come with a single or double sided disk. double layer has 8.5 GB capacity. The 8 cm DVD has 1.5 GB capacity. The capacity of a DVD-ROM can be visually determined by noting the number of data sides of the disc. Double-layered sides are usually gold-coloured, while single-layered sides are usually silver-coloured, like a CD. Fig 3.10 Digital Versatile Disc Flash Memory Devices Flash memory is an electronic (solid-state) non-volatile computer Chapter 3 Page indd :06:14

65 storage medium that can be electrically erased and reprogrammed. They are either EEPROM or EPROM. Examples for Flash memories are pendrives, memory cards etc. Flash memories can be used in personal computers, Personal Digital Assistants (PDA), digital audio players, digital cameras and mobile phones. Flash memory offers fast access times. The Fig 3.12 Blu- Ray Disc time taken to read or write a character in memory is called access time. The 3.7 Ports and Interfaces capacity of the flash memories vary from 1 Gigabytes (GB) to 2 Terabytes (TB). A The Motherboard of a computer sample of flash memory is shown in Figure has many I/O sockets that are connected to the ports and interfaces found on the rear side of a computer (Figure 3.13). The external devices can be connected to the ports and interfaces. The various types of ports are given below: Figure 3.11 Flash Memory Serial Port: To connect the external Blu-Ray Disc devices, found in old computers. Blu-Ray Disc is a high-density Parallel Port: To connect the printers, optical disc similar to DVD. Blu-ray is the found in old computers. type of disc used for PlayStation games and for playing High-Definition (HD) movies. USB Ports: To connect external devices A double-layer Blu-Ray disc can store up like cameras, scanners, mobile phones, to 50GB (gigabytes) of data. This is more external hard disks and printers to the than 5 times the capacity of a DVD, and computer. above 70 times of a CD. The format was developed to enable recording, rewriting USB 3.0 is the third major version of the and playback of high-definition video, as Universal Serial Bus (USB) standard to well as storing large amount of data. DVD connect computers with other electronic uses a red laser to read and write data. But, gadgets as shown in Figure USB 3.0 Blu-ray uses a blue-violet laser to write. can transfer data up to 5 Giga byte/second. Hence, it is called as Blu-Ray. USB3.1 and USB 3.2 are also released. 59 Chapter 3 Page indd :06:14

66 Mouse Port USB Port Network Port Figure 3.13 USB 3.0 Ports VGA Connector: To connect a monitor or any display device like LCD projector. Audio Plugs: To connect sound speakers, microphone and headphones. PS/2 Port: To connect mouse and keyboard to PC. VGA Port Keyboard Port HDMI Port Serial Port Power Supply Fig 3.14 Ports and Interfaces High Definition Multimedia Interface (HDMI) High-Definition Multimedia Interface is an audio/video interface which transfers the uncompressed video and audio data from a video controller, to a compatible computer monitor, LCD projector, digital television etc. SCSI Port: To connect the hard disk drives and network connectors. Micro HDMI HDMI Figure 3.15 HDMI Ports Activity Student Activity Identify the components of a computer Connecting external devices like printer/lcd projector. Teacher Activity Show the components of a computer Display different ROM ICs Display the flash memory Demonstrate various ports and their usage 60 Chapter 3 Page indd :06:14

67 Evaluation Part I Choose the correct answer 1. Which of the following is sadi to be the brain of a computer? (a) Input devices (c) Memory device (b) Output devices (d) Microprocessor 2. Which of the following is not the part of a microprocessor unit? (a) ALU (c) Cache memory (b) Control unit (d) register 3. How many bits constitute a word? (a) 8 (b) 16 (c) 32 (d) determined by the processor used. 4. Which of the following device identifies the location when address is placed in the memory address register? (a) Locator (b) encoder (c) decoder (d) multiplexer 5. Which of the following is a CISC processor? (a) Intel P6 (b) AMD K6 (c) Pentium III (d) Pentium IV 6. Which is the fastest memory? (a) Hard disk (b) Main memory (c) Cache memory (d) Blue-Ray dist 7. How many memory locations are identified by a processor with 8 bits address bus at a time? (a) 28 (b) 1024 (c) 256 (d) What is the capacity of 12cm diameter DVD with single sided and single layer? (a) 4.7 GB (b) 5.5 GB (c) 7.8GB (d) 2.2 GB 61 Chapter 3 Page indd :06:14

68 9. What is the smallest size of data represented in a CD? (a) blocks (b) sectors (c) pits (d) tracks 10. Display devices are connected to the computer through. (a) USB port (b) Ps/2 port (c) SCSI port (d) VGA connector Part II (1) What are the parameters which influence the characteristics of a microprocessor? (2) What is an instruction? (3) What is a program counter? (4) What is HDMI? (5) Which source is used to erase the content of a EPROM? Part III (1) Differentiate Computer Organization from Computer Architecture. (2) Classify the microprocessor based on the size of the data. (3) Write down the classifications of microprocessors based on the instruction set. (4) Differentiate PROM and EPROM. (5) Write down the interfaces and ports available in a computer. (6) Differentiate CD and DVD (7) How will you differentiate a flash memory and an EEPROM? Part IV (1) Explain the characteristics of a microprocessor. (2) How the read and write operations are performed by a processor? Explain. (3) Arrange the memory devices in ascending order based on the access time. (4) Explain the types of ROM. 62 Chapter 3 Page indd :06:14

69 Computer hardware Intel Silicon chip Multipurpose Address bus The physical parts or components of a computer, such as the CPU, mother board, monitor, keyboard, etc. Intel Corporation is an American multinational corporation and technology company involving in hardware manufacturing, especially mother board and processors Silicon chip is an integrated, set of electronic circuits on one small flat piece of semiconductor material, silicon. Multipurposeis several purpose Address bus is a collection of wires that carry the address as bits Data bus Data bus is a collection of wires to carry data in bits Control bus is a control line/collection of wires to control Control bus the operations/functions Arithmetic operations Data Transfer Logical operations Bidirectional Unidirectional Access time Arithmetic operations are the mathematical operations on data like add, subtract etc Data Transfer means moving data from one component to another Logical operations are the operations on binary/boolean data like AND, OR, NOT Bidirectional means both the directions/ways Unidirectional means only one direction Access time is the time delay or latency between a request to an electronic system, and the access being completed or the requested data returned 63 Chapter 3 Page indd :06:14

70 Unit I Fundamentals of Computers CHAPTER 4 Theoretical concepts of Operating System Learning objectives To know the concept of Operating Systems and their types. To acquire the basic Knowledge of Operating Systems and its functions. 4.1 Introduction to Software A software is set of instructions that perform specific task. It interacts basically with the hardware to generate the desired output Types of Software 4.2 Introduction to Operating System (OS): An Operating System (OS) is a system software which serves as an interface between a user and a computer. This controls input, output and other peripheral devices such as disk drives, printers and electronic gadgets. The functions of an Operating System include file management, memory management, process management and device management and many more. Software is classified into two types: 1) Application Software 2) System Software Hard drive APPS Monitor Application Software: Application software is a set of programs to perform specific task. For example MS-word is an application software to create text document and VLC player is familiar application software to play audio, video files and many more. Printer Operating System Mouse Keyboard System Software: System software is a type of computer program that is designed to run the computer s hardware and application programs. For example Operating System and Language Processor 64 Figure: 4.1 Operating System Without an Operating System, a computer cannot effectively manage all the resources. When a computer is switched on, the operating system is loaded in to Chapter 4 Page indd :54:24

71 the memory automatically. A user cannot communicate directly with the computer hardware, unless an operating system is loaded. Some of the popular Operating Systems used in personal computers and laptops are Windows, UNIX and Linux. The mobile devices mostly use Android and ios as mobile OS Need for Operating System request into machine language(binary language), processes it and then sends it back to Operating System. Operating System converts processed information into user readable form Uses of Operating Systems The following are few uses of Operating System The main use of Operating System is Operating System has become essential to enable the users to design applications without the knowledge of the Easy interaction between the users computer s internal structure of hardware. and computers. Operating System manages all the Software and Hardware. Most of the time there are Starting computer operation many different computer programmes automatically when power is turned running at the same time, they all need to on (Booting). access the Computers, CPU, Memory and Storage. The need of Operating System is Controlling Input and Output Devices basically - an interface between the user and hardware. to ensure that a computer can be used to extract what the user wants it do. Manage the utilization of main memory. Application Software Providing security to user programs. 4.3 Types of Operating System Operating System User Operating System are classified into the following types depending on their processing capabilities.. Hardware Figure: 4.2 Interaction of Operating system and user Operating System works as translator, while it translates the user Single User Operating Systems An operating system allows only a single user to perform a task at a time. It is called as a Single user and single Task operating system. For a user, a task is a function such as printing a document, writing a file to disk, editing a file or 65 Chapter 4 Page indd :54:24

72 downloading a file etc. MS-DOS is an example for a single user and single task Operating System Multi-user Operating Systems It is used in computers and laptops that allow same data and applications to be accessed by multiple users at the same time. The users can also communicate with each other. Windows, Linux and UNIX are examples for multi-user Operating System. Build a cheap computer with raspbion OS and a Raspberry Pi. raspbion OS is a platform that's designed to teach how to build a computer, what every part of a circuit board does, and finally how to code apps or games. The platform is Now Linux distribution is also available in pre-designed kits available as GUI based Operating System. The following points are considered 4.4 Key features of the Operating System The various key features are given below Security Management Process Management User Interface Key Features of Operating System File Management Memory Management User Interface (UI) User interface is one of the significant feature in Operating System. The only way that user can make interaction with a computer. If the computer interface is not user-friendly, the user slowly reduces the computer usage from their normal life. This is the main reason for the key success of GUI (Graphical User Interface) based Operating System. The GUI is a window based system with a pointing device to direct I/O, choose from menus, make selections and a keyboard to enter text.its vibrant colours attract the user very easily. Beginners are impressed by the help and pop up window message boxes. Icons are playing vital role of the particular application. when User Interface is designed for an application. 1. The user interface should enable the user to retain this expertise for a longer time. 2. The user interface should also satisfy the customer based on their needs. 3.The user interface should save user s precious time. Create graphical elements like Menus,Window,Tabs, Icons and reduce typing work will be an added advantage of the Operating System. Figure: 4.3 Key Features of the Operating System Fault Tolerance 4. The ultimate aim of any product is to satisfy the customer. The User Interface is also to satisfy the customer. 66 Chapter 4 Page indd :54:25

73 5. The user interface should reduce number of errors committed by the user with a little practice the user should be in a position to avoid errors (Error Log File) Memory Management Memory Management is the process of controlling and coordinating computer s main memory and assigning memory block (space) to various running programs to optimize overall computer performance. The Memory management involves the allocation of specific memory blocks to individual programs based on user demands. At the application level, memory management ensures the availability of adequate memory for each A process is the unit of work (program) in a computer. A wordprocessing program being run by an individual user on a computer is a process. A system task, such as sending output to a printer or screen, can also be called as a Process. running program at all times. A computer consists of a collection The objective of Memory of processes, they are classified as two categories: Management process is to improve both the utilization of the CPU and the speed of the computer s response to its users via main memory. For these reasons the computers must keep several programs in main memory that associates with many different Memory Management schemes. The Operating System is responsible for the following activities in connection with memory management: Keeping track of which portion of memory are currently being used and who is using them. Determining which processes (or parts of processes) and data to move in and out of memory. 67 Allocation and de-allocation of memory blocks as needed by the program in main memory. (Garbage Collection) Process management Process management is function that includes creating and deleting processes and providing mechanisms for processes to communicate and synchronize with each other. Operating System processes which is executed by system code User Processes which is execute by user code All these processes can potentially execute concurrently on a single CPU. A process needs certain resources including CPU time, memory, files and I/O devices to finish its task. The Operating System is responsible for the following activities associated with the process management: Scheduling processes and threads on the CPUs Chapter 4 Page indd :54:25

74 Creating and deleting both user and system processes Suspending and resuming processes 1) A = 6 kilo bytes 2) B = 9 kilo bytes First the job A will be assigned and then job B gets its turn. Providing mechanisms for process synchronization Providing mechanisms for process communication The following algorithms are mainly used to allocate the job (process) to the processor. 1. FIFO 2. SJF 3. Round Robin 4. Based on Priority The given job (process) is assigned FIFO (First In First Out)Scheduling: based on a Priority. The job which has higher priority is more important than This algorithm is based on queuing other jobs. Take two jobs A and B. Let the technique. Assume that a student is priority of A be 5 and priority B be 7. standing in a queue to get grade sheet from his/her teacher. The other student Job B is assigned to the processor who stands first in the queue gets his/ before job A. her grade sheet first and leaves from the queue. Followed by the next student in the Security Management queue gets it collected and so on. This is the basic logic of the FIFO algorithm. Technically, the process that enters the queue first is executed first by the CPU, followed by the next and so on. The processes are executed in the order of the queue. Round RobinScheduling The Round Robin (RR) scheduling algorithm is designed especially for time sharing systems. Jobs (processes) are assigned and processor time in a circular method. For example take three jobs A, B, C. First the job A is assigned to CPU then job B and job C and then again A, B and C and so on. Based On Priority The major challenge in computer and software industry is to protect user s legitimate data from hackers. The Operating System provides three levels of securities to the user end. They are (1) File access level SJF (Shortest Job First)Scheduling: (2) System level This algorithm works based on the size of the job being executed by the CPU. Consider two jobs A and B. 68 (3) Network level In order to access the files created by other people, you should have the access permission. Permissions can either Chapter 4 Page indd :54:25

75 be granted by the creator of the file or bythe administrator of the system. System level security is offered by the password in a multi-user environment. Both windows and Linux offer the password facility. updates the FAT. The OS also takes care of the files that are opened with proper access rights to read or edit them. There are few other file management techniques available like Next Generation File System (NTFS) and ext2(linux) Multi-Processing Network security is an indefinable one. So people from all over the world try to provide such a security. All the above levels of security features are provided only by the Operating System Fault Tolerance The Operating Systems should be robust. When there is a fault, the Operating System should not crash, instead the Operating System have fault tolerance Time-sharing capabilities and retain the existing state of system File Management File management is an important function of OS which handles the data storage techniques. The operating System manages the files, folders and directory systems on a computer. Any type of data in a computer is stored in the form of files and directories/folders through File Allocation Table (FAT). The FAT stores general information about files like filename, type (text or binary), size, starting address and access mode (sequential/indexed / indexed-sequential/ direct/relative). The file manager of the operating system helps to create, edit, copy, allocate memory to the files and also 69 This is a one of the features of Operating System. It has two or more processors for a single running process (job). Processing takes place in parallel is known as parallel processing. Each processor works on different parts of the same task or on two or more different tasks. Since the execution takes place in parallel, this feature is used for high speed execution which increases the power of computing. This is a one of the features of Operating Systems. It allows execution of multiple tasks or processes concurrently. For each task a fixed time is allocated. This division of time is called Time- sharing. The processor switches rapidly between various processes after a time is elapsed or the process is completed. For example assume that there are three processes called P1, P2, P3 and time allocated for each process 30, 40, 50 minutes respectively. If the process P1 completes within 20 minutes then processor takes the next process P2 for the execution. If the process P2 could not complete within 40 minutes, then the current process P2 will be paused and switch over to the next process P3. Chapter 4 Page indd :54:25

76 4.4.9 Distributed Operating Systems 4.5 Prominent Operating Systems This feature takes care ofthe Prominent OS are as follows: data and application that are stored and processed on multiple physical locations across the world over the digital network UNIX Microsoft Windows (internet/intranet). The Distributed Operating System is used to access shared data and files that reside in any machine Linux ios around the world. The user can handle the data from different locations. The users can access as if it is available on their own computer. Android Modern operating systems use a Graphical User Interface(GUI). A GUI lets you use your mouse to click icons, buttons, The advantages of distributed menus and everything is clearly displayed Operating System are as follows: on the screen using a combination of A user at one location can make use of graphics and text elements. all the resources available at another OS can be either proprietary with a location over the network. commercial license or can be open source. Many computer resources can be added easily in the network Each Operating System's GUI has a different look and feel, so if you switch to Improves the interaction with the a different Operating System, it may seem customers and clients. unfamiliar at first. However, modern Reduces the load on the host computer. Operating Systems are designed to be ease of use and most of the basic principles are the same. Linux Red hat Windows Mac OS Sun Cobalt Free BSD Solaris Figure: 4.4 Distributed Operating Systems Figure: 4.5 Various Operating Systems 70 Chapter 4 Page indd :54:25

77 4.5.1 UNIX Proprietary Licence Microsoft windows Apple Mac OS Apple ios [Mobile Device] Operating System Open source Free licence UNIX LINUX Google's Android [Mobile Device] Figure: 4.6 Classification of Operating Systems according to availability UNIX is a family of multitasking, multi-user operating systems that derive originally from AT&T Bell Labs, where the development began in the 1970s by Ken Thompson and Dennis Ritchie Linux Linux is a family of open-source operating systems. It can be modified and distributed by anyone around the world. This is different from proprietary software like Windows, which can only be modified by the company that owns it. The main advantage of Linux operating system is that it is open source. There are many versions and their updates. Most of the servers run on Linux because it is easy to customize. Figure: 4.7 LINUX Ubuntu Operating System 71 Chapter 4 Page indd :54:25

78 There are a few different distributions of Linux, like Ubuntu, Mint, Fedora, RedHat, Debian, Google's Android, Chrome OS, and Chromium OS which are popular among users. The Linux operating system was originated in 1991, as a project of Linus Torvalds from a university student of Finland. He posted information about his project on a news group for computer students and programmers. He received support and assistance from a large pool of volunteers who succeeded in creating a complete and functional Operating System. Linux is similar to the UNIX operating system. Unix and the C programming language were developed by AT&T and distributed to government and academic institutions, which led to both being ported to a wider variety of machine families than any other operating system Microsoft Windows Microsoft Windows is a family of proprietary operating systems designed by Microsoft Corporation and primarily targeted to Intel and AMD architecture based computers. ReactOS is a Windows- ubuntu BOSS alternative open source Fedora operating system, which is being developed on the principles Linux Linux Redhat of Windows - without using any of Mint Distributions Figure: 4.8 Linux Distributions Microsoft's code. Figure: 4.9 Microsoft WindowsFolder Screen 72 Chapter 4 Page indd :54:26

79 Figure: 4.10 Microsoft Windows Home Screen Operating systems for mobile devices Mobile devices such as phones, tablets and MP3 players are different from desktop and laptop computers and hence they need special Operating Systems. Examples of mobile Operating Systems are Apple ios and Google Android. The ios running on an ipad is shown in Figure Figure: 4.11 Various Mobile Devices Operating systems for mobile devices generally are not as fully featured as those made for desktop and laptop computers and they are not able to run all software. 73 Chapter 4 Page indd :54:26

80 4.5.5 Android Android is a mobile operating system developed by Google, based on Linux and designed primarily for touch screen mobile devices such as smart phones and tablets. Google has further developed Android TV for televisions, Android Auto for cars and Android Wear for wrist watches, each with a specialized user interface. Variants of Android are also used on game consoles, digital cameras, PCs and other electronic gadgets. Alpha A Beta B Cupcake C Donut D Eclair E Froyo F Gingerbread G Ice Cream Honeycomb Sandwich Jelly Bean Kitkat Lollipop Marshmallow Nougat H I J K L M Figure: 4.12 Android Mobile Open Source versions N ios - iphone OS ios (formerly iphone OS) is a mobile Operating System created and developed by Apple Inc., exclusively for its hardware. It is the Operating System that presently powers many of the company's mobile devices, including the iphone, ipad and ipod Touch. It is the second most popular mobile Operating System globally after Android. Messages CalendarPhotos Camera Youtube Stocks Maps Weather Clock Contacts Calculator Voice memos itunes App Store SettingsCompass Phone Mail Safari ipod Figure: 4.13 ios - iphone Home Screen 74 Chapter 4 Page indd :54:26

81 Activity Student Activity Activity 1: Draw a line between the operating system logo and the correct description. A command-line operating system is an example of Open Source software development and Free Operating System Is an Operating System that is very popular in universities, companies, bigenterprises etc A popular Operating System for mobile phone technology which is not linked with Apple products. Used with Apple computers and works well with cloud computing. Designed to be used for the Apple iphone The most popular GUI Operating System for personal computers. Activity 2: Discuss and provide the suitable answers for the questions below. One of the functions of an Operating System is multi-tasking 1) Explain one reason why multi-tasking is needed in an operating system 2) State two other function of an Operating System Teacher Activity: 1. Install two different Operating Systems in a single computer. 2. Create a virtual Operating System using virtualization software. 75 Chapter 4 Page indd :54:27

82 Evaluation Part I 1) Operating system is a A)Application Software B) Hardware C)System Software D)Component 2) Identify the usage of Operating Systems A)Easy interaction between the human and computer B)Controlling input & output Devices C)Managing use of main memory D)All the above 3) Which of the following is not a function of an Operating System? A)Process Management B)Memory Management C)Security management D)Complier Environment 4) Which of the following OS is a Commercially licensed Operating system? A)Windows B)UBUNTU C)FEDORA D)REDHAT 5) Which of the following Operating systems support Mobile Devices? A)Windows 7 B)Linux C)BOSS D)iOS 6) File Management manages A)Files B)Folders C)Directory systems D)All the Above 7) Interactive Operating System provides A)Graphics User Interface (GUI) C)Security Management B)Data Distribution D)Real Time Processing 8) Android is a A)Mobile Operating system C)Developed by Google 76 BOpen Source D)All the above Chapter 4 Page indd :54:27

83 9) Which of the following refers to Android operating system s version? Part II A)JELLY BEAN B)UBUNTU C)OS/2 D)MITTIKA 1) What are the advantages of memory management in Operating System? 2) What is the multi-user Operating system? 3) What is a GUI? 4) List out different distributions of Linux operating system. 5) What are the security management features available in Operating System? 6) What is multi-processing? 7) What are the different Operating Systems used in computer? Part III 8) What are the advantages and disadvantages of Time-sharing features? 9) Explain and List out examples of mobile operating system. 10) What are the differences between Windows and Linux Operating system? 11) Explain the process manangement algorithms in Operating System. Part IV 12) Explain the concept of a Distributed Operating System. 13) Explain the main purpose of an operating system. 14) Explain advantages and disadvantages of open source operating systems. References 1) Silberschatz, galvin gagne, Operating System concepts john wiley&sons,inc 2) Andrew s. Tanenbaum, modern Operating Systems pearson publication 3) Andrew s. Tanenbaum, Operating Systems design and implementation, prentice hall publication 4) Tom anderson, Operating Systems: principles and practice, recursive books 5) Thomas w. Doeppner, Operating Systems in depth: design and programming, john wiley & sons, inc 77 Chapter 4 Page indd :54:27

84 Unit I 5 Fundamentals of Computers CHAPTER Working with typical operating systems Part - I : Working with Windows Learning Objectives After learning the concepts in this chapter, the students will be able To know the concepts of Operating System. To know the versions of the windows operating system. To know the concepts like desktop and the elements of window Introduction to Operating System An Operating System (OS) is a system software (Figure 5.1) that enables the hardware to communicate and operate with other software. It also acts as an interface between the user and the hardware and controls the overall execution of the computer. User 1 User 2 User n To explore the document window. System Application To compare the different types of Softwares Softwares icons. Software To explore the windows directory structure. To practice creating files and folders in specific drives. To manage the files and folders. To know the procedure to start and shutdown the computer. Operating System Hardware CPU RAM I/O Figure 5.1. Overview of an Operating System Following are some of the important functions of an Operating System as discussed in the previous chapter: Memory Management Process Management Device Management File Management 78 Chapter 5 Page indd :53:58

85 Security Management Control overall system performance Error detecting aids Coordination between other software and users The most popular Operating System are as follows: Windows Series - for desktop and laptop computers. Android - for smart phones. ios - for Apple phones, i-pad and i-pod. Linux - Open source Operating System for desktop and server. Windows Operating System uses both Keyboard and mouse as input devices. Mouse is used to interact with Windows by clicking its icons. Keyboard is used to enter alphabets, numerals and special characters. Some of the functions of Windows Operating System are: Access applications (programs) on the computer (word processing, games, spread sheets, calculators and so on). Load any new program on the computer. Manage hardware such as printers, scanners, mouse, digital cameras etc., File management activities (For 5.2. Introduction to Windows Operating example creating, modifying, saving, System deleting files and folders). Every computer needs an Operating System to function. Microsoft Windows is Change computer settings such as one of the most popular Graphical User colour scheme, screen savers of your Interface (GUI). Multiple applications can monitor, etc. execute simultaneously in Windows, and With reference to the Table 5.1, let us see the this is known as Multitasking. versions of Windows Operating System Various versions of Windows Versions Logo Year Specific features Windows 1.x Windows 2.x Windows 3.x Introduction of GUI in 16 - bit. processor Mouse was introduced as an input device. Supports to minimize or maximize windows. Control panel feature was introduced with various system settings and customising options. Introduced the concept of multitasking. Supported 256 colours which brought a more modern, colourful look to the interface. Chapter 5 Page indd :53:58

86 Windows 95 Windows Introduced Start button, the taskbar, Windows Explorer and Start menu. Introduced 32 - bit processor and focused more on multitasking. Integration of the Web browser (Internet Explorer) with the Operating System. DOS gaming began to disappear as Windows based games improved. Plug and play feature was introduced. Windows NT Designed to act as servers in network. Windows Me 2000 It introduced automated system diagnostics and recovery tools. Served as an Operating System for business desktop and laptop systems. Four versions of Windows 2000 were released: Professional (for business Windows 2000 desktop and laptop systems), Server 2000 (both a Web server and an office server), Advanced Server (for line-of-business applications) and Data Centre Server (for high-traffic computer networks). Windows XP 2001 Introduced 64-bit Processor. Improved Windows appearance with themes and offered a stable version. Windows Vista 2006 Updated the look and feel of Windows. 80 Chapter 5 Page indd :53:59

87 Windows Booting time was improved, introduced new user interfaces like Aero Peek, pinning programs to taskbar, handwriting recognition etc. and Internet Explorer 8. Windows 8 is faster than previous versions of Windows. Start button was removed. Windows 8 takes better advantage of multi-core processing, solid state drives (SSD), touch screens and other alternate input methods. Served as common platform for mobile and computer. Start Button was added again. Multiple desktop Central Notification Center for App notification and quick actions. Cortana voice activated personal assistant. Table 5.1 Versions of Windows Operating System. Windows Windows Handling the mouse The following are the mouse actions: Before learning Window Operating System, you should know more about mouse and its actions. Left Click Right Click Figure 5.2.Mouse actions Action Point to an item Click Right click Double-click Drag and drop Reaction Move the mouse pointer over the item. Point to the item on the screen, press and release the left mouse button. Point to the item on the screen, press and release the right mouse button. Clicking the right mouse button displays a pop up menu with various options. Point to the item on the screen, quickly press twice the left mouse button. Point to an item then hold the left mouse button as you move the pointer press and you have reached the desired position, release the mouse button. 81 Chapter 5 Page indd :54:00

88 5.5. Windows Desktop The opening screen of Windows is called Desktop. The desktop of your computer may look different from what is seen in Figure 5.3. This is because Windows allows you to change the appearance of the desktop. In Figure 5.3, the desktop shows the Start button, Taskbar, Notification Area and date and time The Icons Icon is a graphic symbol representing the window elements like files, folders, shortcuts etc., Icons play a vital role in GUI based applications Standard Icons The icons which are available on desktop by default while installing Windows OS are called standard icons. The standard icons available in all Windows OS are My Computer, Documents and Recycle Bin. You can move to the Desktop any time by pressing the Winkey + D or using Aero Peek while working in any application. You can see Figure 5.4 to know where Aero peek lies in the Taskbar. Gadgets Icons Task bar Start Button Notification Area Figure 5.3. Microsoft Windows 7 Desktop Aero peek button Figure 5.4. Aero peek button 82 Chapter 5 Page indd :54:00

89 Shortcut Icons: Shortcut icons can be created for any application or file or folder. By double clicking the icon, the related application or file or folder will open. This represents the shortcut to open a particular application. (Figure5.5) Disk drive icons: Application Icon Folder Icon The disk drive icons graphically represent five disk drive options. (i) Hard disk (ii) CD-ROM/DVD Drive (iii) Pen drive (iv) Other removable storage such as mobile, smart phone, tablet etc., (v) Network drives if your system is connected with other system. (Figure 5.6) Figure 5.5.The types of Icons Various Disk drive icons Hard disk drives with total and remaining space available Removable Storage (pen drive) 5.6. The Window Figure 5.6.Disk drive Icons Window is a typical rectangular area in an application or a document. It is an area on the screen that displays information for a specific program. 83 Chapter 5 Page indd :54:01

90 5.7. Application Window It is an area on a computer screen with defined boundaries, and within which information is displayed. Such windows can be resized, maximized, minimized, placed side by side, overlap, and so on. An Application Window contains an open application i.e. current application such as Word or Paint. When two or more windows are open, only one of them is active and the rest are inactive. Figures 5.7 and 5.8 display the Application Window of OpenOffice Writer and the appearance of the Multiple Windows opened (overlapped) in the Desktop Document Window A document window is a section of the screen used to display the contents of a document. Figure 5.9 is an example of a document window. Note When you open any application, such as OpenOffice Writer, OpenOffice Impress or OpenOffice Calc etc., you will find two Windows on the screen. The larger Window is called the Application Window. This Window helps the user to communicate with the Application program. The smaller window, which is inside the Application Window, is called the Document window. This Window is used for typing, editing, drawing, and formatting the text and graphics. Title bar with title of the document Menu bar Tools bar Window Control buttons Application work area Scroll bars Figure 5.7. Application Window 84 Chapter 5 Page indd :54:01

91 Figure 5.8. Multiple Windows opened in Desktop Application Window Document window Ruler Document Area Figure 5.9.Document Window 85 Chapter 5 Page indd :54:01

92 5.9. Elements of a window Figure 5.10 helps to understand the elements of a window Title Bar The title bar will display the name of the application and the name of the document opened. It will also contain minimize, maximize and close button. Title Bar Corners Borders Corners Menu Bar Scroll Bar Borders Workspace Corners Borders Figure 5.10 The elements of a window. Corners Menu Bar The menu bar is seen under the title bar. Menus in the menu bar can be accessed by pressing Alt key and the letter that appears underlined in the menu title. Additionally, pressing Alt or F10 brings the focus on the first menu of the menu bar. In Windows 7, in the absence of the menu bar, click Organize and from the drop down menu, click the Layout option and select the desired item from that list. Figure To display Menu Bar Figure 5.11 helps to understand how to make menu bar visible in its absence. 86 Chapter 5 Page indd :54:01

93 The Workspace The workspace is the area in the document window to enter or type the text of your document. Figure 5.10 Shows the workspace area in the document window Scroll bars - The scroll bars are used to scroll the workspace horizontally or vertically. Figure 5.10 shows the Scroll bars Corners and borders The corners and borders of the window helps to drag and resize the windows. The mouse pointer changes to a double headed arrow when positioned over a border or a corner. Drag the border or corner in the direction indicated by the double headed arrow to the desired size as shown in Figure The window canbe resized by dragging the corners diagonally across the screen Explore the Computer Start Menu In the lower left-hand corner of the windows screen is the Start button. When you click on the button, the Start menu will appear. Using the start menu, you can start any application. This symbol indicates Sub menu is attached to this option Modify system Settings View a list of installed Programs Add / Modify devices and Printer settings Search Box Start Button Get Help Log off / Restart / Shutdown Figure Start Menu Taskbar At the bottom of the screen is a horizontal bar called the taskbar. This bar contains (from left to right) the Start button, shortcuts to various programs, minimized programs and in the extreme right corner you can see the system tray which consist of volume 87 Chapter 5 Page indd :54:01

94 control, network, date and time etc. Next to the Start button is the quick Launch Toolbar which contains task for frequently used applications. Start Button Minimized program / Folders show hidden icons Default Language Network icon Figure 5.13.Taskbar Volume Adjustment Time and Date Aero peek button Computer Icon By clicking this icon, the user can see the disk drivers mounted in the system. In windows XP, Vista, this icon is called "My computer" in Windows 8 and 10, it is called "This PC". The functionality of computer icon reamins the same in all versions of windows as shown in Figure Starting and Closing Applications Most of the applications installed on your computer are available through the start menu. Depending on the system setup, the applications in the Start menu varies. To start an application: 1. Click the Start button and then point to All Programs. The Program menu appears. (Figure 5.15) 2. Point to the group that contains the application you want to start, and then click the application name. Figure Computer icon in versions of Windows OS 88 Chapter 5 Page indd :54:01

95 Figure Starting a applicatioin using Start menu 3. You can also open an application by clicking Run on the Start menu, and the name of the application. (Figure 5.16) Figure 5.16.Starting a program using Run option 4. To quit a application, click the Close button in the upper right corner of the application window. (Figure 5.17) 89 Chapter 5 Page indd :54:01

96 Close button Exit Option Figure 5.17.Closing the application using Close button and Exit option 5. You can also quit an application by clicking on File Exit and File Close option in Windows 7. (Figure 5.17) 1. Start the application Wordpad using Start menu and Run option. Close the Wordpad application using File menu. Workshop Managing Files and Folders In Windows 7, you can organize your documents and programs in the form of files and folders. You can move, copy, rename, delete and search the files and folders Creating files and Folders Creating Folders You can store your files in many locations on the hard disk or in other devices. To better organise your files, you can store them in folders. 90 Chapter 5 Page indd :54:01

97 There are two ways in which you can create a new folder: Method I: Step 1: Open Computer Icon. Step 2: Open any drive where you want to create a new folder. (For example select D:) Step 3: Click on File New Folder. Step 4: A new folder is created with the default name New folder. (Figure 5.19) Step 5: Type in the folder name and press Enter key. (Figure 5.20 shows the newly created Folder named Test Folder "). Figure Creating a Folder using File menu Figure New Folder created with the default name v Figure Renaming the new Folder 91 Chapter 5 Page indd :54:02

98 Method II: In order to create a folder in the desktop: Step 1: In the Desktop, right click New Folder. (Figure 5.21 Shown the procedure) Step 2: A Folder appears with the default name New folder and it will be highlighted as shown in the Figure Step 3: Type the name you want and press Enter Key. Step 4: The name of the folder will change. Workshop 2. Create a Folder in My Documents with your name using any one of the methods discussed Creating Files (Wordpad) Wordpad is an in-built word processor application in Windows OS to create and manipulate text documents. In order to create files in wordpad you need to follow the steps given below. Figure Creating a folder in the desktop 92 Chapter 5 Page indd :54:02

99 1. Click Start All Programs Accessories Wordpad or Run type Wordpad, click OK. Wordpad window will be opened as shown in Figure Type the contents in the workspace and save the file using File Save or Ctrl + S. 3. Save As dialog box will be opened. 4. In the dialog box, select the location where you want to save the file by using look in drop down list box. 5. Type the name of the file in the file name text box. 6. Click save button. Workshop 3. Open the Wordpad application and Figure 5.22 New folder icon on the dektop save it under a folder created with your name in My Documents Finding Files and Folders You can use the search box on the Start menu to quickly search a particular folder or file in the computer or in a specific drive. To find a file or folder: 1. Click the Start button, the search box appears at the bottom of the start menu. 2. Type the name of the file or the folder you want to search. Even if you give the part of the file or folder name, it will display the list of files or folders starting with the specified name. (Figure 5.24) 3. The files or the folders with the specified names will appear, if you click that file, it will directly open that file or the folder. 93 Chapter 5 Page indd :54:02

100 Figure Wordpad - Word Processor application 4. There is another option called See more results which appears above the search box. 5. If you click it, it will lead you to a Search Results dialog box where you can click and open that file or the folder. Searching Files or folders using Computer icon 1. Click Computer Icon from desktop or from Start menu. 2. The Computer disk drive screen will appear and at the top right corner of that screen, there is a search box option. (Figure 5.25) 3. Type the name of the file or the folder you want to search. Even if you give the part of the file or folder name, it will display the list of files or folders starting with the specified name. Figure Finding a File/Folder using Start button 94 Chapter 5 Page indd :54:02

101 Figure Finding a File/Folder in the Computer icon screen 4. Just click and open that file or the folder. Workshop 4. Find the file created in Workshop-3 using the above procedure Opening existing Files or Folders The most common way of opening a file or a Folder is to double click on it Renaming Files or Folders There are number of ways to rename files or folders. You can rename using the File menu, left mouse button or right mouse button. Method 1 Using the FILE Menu 1. Select the File or Folder you wish to Rename. 2. Click File Rename. 3. Type in the new name. 4. To finalise the renaming operation, press Enter as in Figure Chapter 5 Page indd :54:02

102 Figure Renaming File/Folders using the File menu Figure 5.27.Folder renamed Figure 5.27, you can see that the folder is renamed as SCERT-DPI from SCERT. 96 Chapter 5 Page indd :54:02

103 Method 2 Using the Right Mouse Button 1. Select the file or folder you wish to rename. 2. Click the right mouse button over the file or folder. (Figure 5.28) 3. Select Rename from the pop-up menu. 4. Type in the new name. 5. To finalise the renaming operation, press Enter. 6. Figure Shows that the folder "New Folder" is renamed as C++. Figure New Folder is renamed as C++ Method 3 Using the Left Mouse Button 1. Select the file or folder you wish to rename. 2. Press F2 or click over the file or folder. A surrounding rectangle will appear around the name. 3. Type in the new name. 4. To finalise the renaming operation, press Enter. Workshop 5. Rename the file created by you using the File menu, left mouse button or right mouse button Moving/Copying Files and Folders Figure Renaming File/Folders using the Right Mouse Button You can move your files or folders to other areas using variety of methods. 97 Chapter 5 Page indd :54:02

104 Moving Files and Folders Method I-CUT and PASTE to move files or folders using drag and drop method. To move a file or folder, first select the file or folder and then choose one of the following: Click on the Edit Cut or Ctrl + X Or right click cut from the pop-up menu. To move the file(s) or folder(s) in the new location, navigate to the new location and paste it using Click Edit Paste from edit menu or Ctrl + V using keyboard. Or Right click Paste from the popup menu. The file will be pasted in the new location. Figure 5.30.Moving the File/Folder using drag and drop Method II Drag and Drop Copying Files and Folders In the disk drive window, we have two panes called left and right panes. In the left pane, the files or folders are displayed like a tree structure. In the right pane, the files inside the specific folders in the left pane are displayed with various options. In the right pane of the Disk drive window, select the file or folder you want to move. Click and drag the selected file or folder from the right pane, to the folder list on the left pane. Release the mouse button when the target folder is highlighted (active). There are variety of ways to copy files and folders: Method I - COPY and PASTE To copy a file or folder, first select the file or folder and then choose one of the following: Click Edit Copy or Ctrl + C or right click Copy from the pop-up menu. To paste the file(s) or folder(s) in the new location, navigate to the target location then do one of the following: Click Edit Paste or Ctrl + V. Your file or folder will now appear in the new area. Figrue 5.30 shows how Or Right click Paste from the pop-up menu. 98 Chapter 5 Page indd :54:02

105 Method II Drag and Drop In the RIGHT pane, select the file or folder you want to copy. Click and drag the selected file and/or folder to the folder list on the left, and drop it where you want to copy the file and/or folder. Your file(s) and folder(s) will now appear in the new area. Note If you want to select multiple files or folders, use Ctrl + Click. Figure Selecting Computer option Copying Files and Folders to from Start menu removable disk Double-click on the Removable Disk There are several methods of associated with the USB flash drive. (Figure 5.32) transferring files to or from a removable disk. Copy and Paste Send To METHOD I - Copy and Paste Plug the USB flash drive directly into an available USB port. If the USB flash drive or external drive folder does NOT open automatically, follow these steps: Click Start Computer. (Figure 5.31) Figure Double Clicking Removable Disk 99 Chapter 5 Page indd :54:03

106 Navigate to the folders in your computer containing files you want to transfer. Right-click on the file you want to copy, then select Copy. (Figure 5.33) METHOD II - Send To Plug the USB flash drive directly into an available USB port. Navigate to the folders in your computer containing files you want to transfer. Right-click on the file you want to transfer to your removable disk. Click Send To and select the Removable Disk associated with the USB flash drive. (Figure 5.35) Figure Copying File using right click Workshop Return to the Removable Disk window, 6. Move the file created by you in My right-click within the window, then Documents to Drive D:. select Paste. (Figure 5.34) Copy the file created by you from drive D: to a removable disk Deleting Files and Folders When you delete a file or folder, it will move into the Recycle Bin. To delete a file or folder: Figure Pasting File using right click Select the file or folder you wish to delete. 100 Chapter 5 Page indd :54:03

107 Removable disk Figure Copying File using Send to option 1. Right- click the file or folder, select Recycle Bin Delete option from the po-pup menu or Recycle bin is a special folder to Click File Delete or press Delete key keep the files or folders deleted by the user, from the keyboard. which means you still have an opportunity to recover them. The user cannot access the 2. The file will be deleted and moved to the files or folders available in the Recycle bin Recycle bin. without restoring it. To restore file or folder from the Recycle Bin Workshop 7. Delete the file created by you after duplicating the same under My Documents. Note To permanently delete a file or folder (i.e. to avoid sending a file or folder to the Recycle Bin), hold down the SHIFT key, and press delete on the keyboard. 101 Open Recycle bin. Right click on a file or folder to be restored and select Restore option from the pop-up menu. To restore multiple files or folders, select Restore all items. To delete all files in the Recycle bin, select Empty the Recycle Bin. Chapter 5 Page indd :54:03

108 5.12. Creating Shortcuts on the Desktop Shortcuts to your most often used folders and files may be created and placed on the Desktop to help automate your work. Select the file or folder that you wish to have as a shortcut on the Desktop. Right click on the file or folder. Select Send to from the shortcut menu, then select Desktop (create shortcut) from the submenu. A shortcut for the file or folder will now appear on your desktop and you can open it from the desktop in the same way as any other icon. Figure Figure 5.36 Creating Shortcut Shutting down or Logging off a Computer Once you have closed all open applications, you can either log off your computer or shut down the computer. 102 Chapter 5 Page indd :54:03

109 Log Off To Log off/shut down the computer: Figure Log off option Click start log off (click the arrow next to Shut down) or Start Shutdown. (Figure 5.37.) If you have any open programs, then you will be asked to close them or windows will Force shut down, you will lose any un-saved information if you do this. Switch User: Switch to another user account on the computer without closing your open programs and Windows processes. Log Off: Switch to another user account on the computer after closing all your open programs and Windows processes. Lock: Lock the computer while you're away from it. Restart: Reboot the computer. (This option is often required as part of installing new software or Windows update.) Sleep: Puts the computer into a low-power mode that retains all running programs and open Windows in computer memory for a super-quick restart. Hibernate (found only on laptop computers): Puts the computer into a low-power mode after saving all running programs and open Wwindows on the machine's hard drive for a quick restart. 103 Chapter 5 Page indd :54:03

110 Unit I Fundamentals of Computers CHAPTER 5 Part - II : Working with Linux (Ubuntu) Learning Objectives Linux To compare Windows Operating System with Ubuntu. To differentiate the Window elements or icons from Ubuntu Launcher. To explore how to copy, delete and rename files or folders in Ubuntu. To explore the differences in Windows Linux Mint 7, Windows 8 and Windows 10. Arch Linux To compare the Windows elements between Windows 7, Windows 8 and Deepin Windows 10. To format Files and folders in Windows 7, Windows 8 and Windows 10. Linux is one of the popular Open Source versions of the UNIX Operating System. It is Open Source as its source code is freely available. The most popular Linux server distributors are: Ubuntu Linux Fedora Debian Open Source Operating System CentOS Open Source refers to a program or software in which the source code is available in the web to the general public free of cost. Open Source code is typically created as a collaborative effort in which programmers continuously improve upon the source code in the web and share the changes within the community Ubuntu Ubuntu is a Linux-based operating system. It is designed for computers, smartphones, and network servers. The system is developed by a UK based company called Canonical Ltd. Ubuntu was conceived in 2004 by Mark Shuttleworth, a successful South African entrepreneur, and his company Canonical Ltd. Chapter 5 Page indd :54:03

111 Significant features of Ubuntu The desktop version of Ubuntu supports all normal software like Windows such as Firefox, Chrome, VLC, etc. It supports the office suite called LibreOffice. Ubuntu has in-built software called Thunderbird, which gives the user access to such as Exchange, Gmail, Hotmail, etc. There are free applications for users to view and edit photos, to manage and share videos. The best feature is, it is a free operating system and is backed by a huge open source community Ubuntu desktop There are many similarities between Ubuntu and other operating systems, such as Microsoft Windows, Apple. This is because they are all based on the concept of a Graphical User Interface (GUI). The following are the names of the icons in the Ubuntu OS. Search your Computer Files It is easy to find content on Ubuntu Firefox Webbrowser with the smart searching facility. Icons Menu bar Indicator area / Notification area Desktop Tha Lanucher = Task Bar in Dindows Figure 5.38.The Ubuntu default desktop. 105 Chapter 5 Page indd :54:03

112 LibreOffice Writer LibreOfficeCalc LibreOffice Impress Messaging indicator- This incorporates your social applications. From here, you can access instant messenger and clients. Ubuntu Software Amazon System Settings Trash Figure 5.40 explains the icons in the Ubuntu operating system and their equivalent ones in the Windows operating system. Menu bar The menu bar is located and session options (like locking your at the top of the screen. The menu bar computer, user/guest session, logging out incorporates common functions used of a session, restarting the computer, or in Ubuntu. The frequently used icons in shutting down completely). the menu bar are found on the right. The most common indicators in the Menu bar Title bar - The title bar shows the are located in the indicator or notification name of the currently selected directory. area (Figure 5.39) It also contains the Close, Minimize, and Maximize buttons. Figure 5.39 Indicators in the Menu bar Network indicator - This manages network connections, allowing you to connect to a wired or wireless network. Text entry settings - This shows the current keyboard layout (such as En, Fr,Ku, and so on). If more than one keyboard layout is shown, it allows you to select a keyboard layout out of those choices. The keyboard indicator menu contains the following menu items: Character Map, Keyboard Layout Chart, and Text Entry Settings. 106 Sound indicator - This provides an easy way to adjust the volume as well as access your music player. Clock - This displays the current time and provides a link to your calendar and time and date settings. Session indicator - This is a link to the system settings, Ubuntu Help, Toolbar - The toolbar displays your directory browsing history (using two arrow buttons), your location in the file system, a search button, and options for your current directory view The desktop background Below the menu bar at the top of the screen is an image covering the entire desktop. This is the default desktop background, or wallpaper, belonging to the default Ubuntu theme known as Ambiance. (Figure 5.38) Chapter 5 Page indd :54:03

113 Search your computer = Search option in window Files = My Computer icon Firefox Web Browser LibreOffice writer - MS word LibreOffice Calc = MS Excel LibreOffice Impress = MS Powerpoint Ubuntu Software Amazon Online shopping app (customize) System Settings = Control Panel VBox_GAs_5.22 Trash - Recycle bin Figure 5.40 Ubuntu Desktop elements The Launcher (Equivalent to Task bar) The vertical bar of icons on the left side of the desktop is called the Launcher. The Launcher provides easy access to applications, mounted devices, and the Trash. All current applications on your system will place an icon in the Launcher. (Figure 5.40) Search your Computer Icon Elements of Ubuntu This icon is equal to search button in Windows OS. Here, you have to give the name of the File or Folder for searching them. (Figure 5.40) Files This icon is equivalent to My Computer icon. From here, you can directly go to Desktop, Documents and so on. (Figure 5.40) 107 Chapter 5 Page indd :54:03

114 Firefox Web Browser By clicking this icon, you can directly browse the internet. This is equivalent to clicking the Web Browser in Task bar in Windows. (Figure 5.40) LibreOffice Writer This icon will directly take you to document preparation application like MS Word in Windows. (Figure 5.41) Libre Office Calc This icon will open LibreOffice Calc application. It is similar to MS Excel in Windows. (Figure 5.42) Figure 5.41 LibreOffice Writer Window Figure 5.42 LibreOffice Calc Window 108 Chapter 5 Page indd :54:03

115 LibreOffice Impress By clicking this icon, you can open LibreOffice Impress to prepare any presentations in Ubuntu like MS PowerPoint. (Figure5.43) Ubuntu Software Icon This icon will let you add any additional applications you want. This can be done by clicking the Update option at the top right corner of that screen. (Figure 5.40) Online Shopping icon Using this icon user can buy and sell any products online. (Figure 5.40) System Settings Icons Figure 5.43 LibreOffice Impress Window Figure 5.44 System Settings Icons 109 Chapter 5 Page indd :54:04

116 This icon is similar to the Control panel in the Windows Operating System. But here, you need to authenticate the changes by giving your password. You cannot simply change as you do in Windows. (Figure 5.44) Trash This icon is the equivalent of Recycle bin of windows OS. All the deleted Files and Folders are moved here. (Figure 5.40) 5.21 Creating, Deleting Files/Folders Similar to Windows OS, you can create, delete the files and folders with the same procedure by clicking Files icon. Figure 5.46 shows the method of creating File or Folder by right clicking in the Desktop. A new File or new Folder can also be created by using File menu (Figure 5.47) Figure 5.45 VBox_GAs_5.2.2 Icons Figure 5.46 Creating a File or Folder by right clicking 110 Chapter 5 Page indd :54:04

117 Deleting a File/Folder Figure 5.47 Creating a File or Folder by using File Menu A file / folder created by you can be moved to trash by using right click or by using menu. (Figure 5.48 & Figure 5.49) Figure 5.48 Deleting a File or Folder by right clicking Figure 5.49 Deleting a File or Folder by using Edit menu 111 Chapter 5 Page indd :54:04

118 5.22 Shutting down Ubuntu using Session options When you have finished working on your computer, you can choose to Log Out, Suspend or Shut down through the Session Indicator on the far right side of the top panel. Figure 5.50 Session Options Activity Student Activity 1. Create files and folders using Windows and Ubuntu and compare them. 2. Prepare an Assignment on the topic Popular Linux distributions. 3. Customise few applications using Ubuntu. Write the procedure. 4. Create a File/Folder in Windows 7, Windows 8 and Windows 10. Prepare a report on the differences you face while creating the same. 5. Prepare a table on the difference in views of Windows 7, Windows 8 and Windows 10 operating system. 112 Chapter 5 Page indd :54:04

119 Teacher Activity The teacher can adopt the following methodologies to incorporate inside the classroom. 1. Laboratory method the teacher can take the entire class to the computer lab and demonstrate the concept using projector. 2. Demonstration using laptop and projector The teacher can demonstrate the same inside the classroom using a laptop and projector. PART I Choose the Best Answer Evaluation 1. From the options given below, choose the operations managed by the operating system. a. Memory b. Processor c. I/O devices d. all of the above 2. Which is the default folder for many Windows Applications to save your file? a. My Document b. My Pictures c. Documents and Settings d. My Computer 3. Under which of the following OS, the option Shift + Delete permanently deletes a file or folder? a. Windows 7 b.windows 8 c.windows10 d. None of the OS 4. What is the meaning of "Hibernate" in Windows XP/Windows 7? a. Restart the Computer in safe mode b. Restart the Computer in hibernate mode c. Shutdown the Computer terminating all the running applications d. Shutdown the Computer without closing the running applications 5. Which of the following OS is not based on Linux? a. Ubuntu b. Redhat c.centos d.bsd 113 Chapter 5 Page indd :54:04

120 6. Which of the following in Ubuntu OS is used to view the options for the devices installed? a. Settings b. Files c. Dash d. VBox_GAs_ Identify the default client in Ubuntu. a. Thunderbird b. Firefox c.internet Explorer d. Chrome 8. Which is the default application for spreadsheets in Ubuntu? This is available in the software launcher. a. LibreOffice Writer b. LibreOffice Calc c. LibreOffice Impress d. LibreOffice Spreadsheet 9. Which is the default browser for Ubuntu? a. Firefox b. Internet Explorer c. Chrome d. Thunderbird 10. Where will you select the option to log out, suspend, restart, or shut down from the desktop of Ubuntu OS? a. Session Indicator b. Launcher c. Files d. Search PART II 1. Differentiate cut and copy options. 2. What is the use of a file extension? 3. Differentiate Files and Folders. 4. Differentiate Save and save As option. 5. What is Open Source? 6. What are the advantages of open source? 7. Mention the different server distributions in Linux OS. 8. How will you log off from Ubuntu OS? PART III 1. Analyse: Why the drives are segregated? 2. If you are working on multiple files at a time, sometimes the system may hang. What is the reason behind it. How can you reduce it? 3. Are drives such as hard drive and floppy drives represented with drive letters? If so why, if not why? 4. Write the specific use of Cortana. 5. List out the major differences between Windows and Ubuntu OS. 6. Are there any difficulties you face while using Ubuntu? If so, mention it with reasons. 7. Differentiate Thunderbird and Firefox in Ubuntu OS. 8. Differentiate Save, Save As and Save a Copy in Ubuntu OS. 114 Chapter 5 Page indd :54:04

121 PART IV 1. Explain the versions of Windows Operating System. 2. Draw and compare the icon equivalence in Windows and Ubuntu. 3. Complete the following matrix Navigational method Located on Ideally suited for Start button Task bar Desktop Exploring your disk drives and using system tools Windows Explorer Seeing hierarchy of all computer contents and resources in one window. Quick Launch 4. Observe the figure and mark all the window elements. Identify the version of the Windows OS. 5. Write the procedure to create, rename, delete and save a file in Ubuntu OS. Compare it with Windows OS. System software that enables the harware to communicate Operating System (OS) and operate with other software. Mouse Windows Handheld hardware input device that control a cursor in a GUI and can move and slect text, icons, files, and folders. Familer operating system developed by Microsoft corpn. Desktop Icon Folder Linux Ubuntu Firefox LibreOffice Trash Opening screen of windows operating system. Tiny image represent a command. Container of files An operating system. A flavour of Linux operating System. One of the familiar web browser. Office automation tool available with Ubuntu by default. A special folder contains deleted files. 115 Chapter 5 Page indd :54:04

122 Unit II Algorithmic Problem Solving CHAPTER 6 Learning Objectives After learning the concepts in this chapter, the students will be able To understand the concept of algorithmic problem solving. To apply the knowledge of algorithmic technique in problem solving. Specification and Abstraction A number of processes performed in our daily life follow the step-by-step execution of a sequence of instructions. Getting ready to school in the morning, drawing "kolams", cooking a dish, adding G Polya was a Hungarian two numbers are examples of processes. Processes are generated by executing algorithms. fundamental contributions to mathematician. He made In this chapter, we will see how algorithms are specified and how elements of a process are abstracted in algorithms. 6.1 Algorithms An algorithm is a sequence of instructions to accomplish a task or solve a problem. An instruction describes an action. When the instructions are executed, a process evolves, which accomplishes the intended task or solves the given problem. We can compare an algorithm to a recipe, and the resulting process to cooking. We are interested in executing ouralgorithms in a computer. A computer can only execute instructions in a programming language. Instructions of a computer are also known as statements. Therefore, ultimately, algorithms must 116 be expressed using statements of a programming language. A problem is specified by given in put data, desired output data and a relation between the input and the output data. An algorithm starts execution with the input data, executes the statements, and finishes execution with the output data. When it finishes execution, the specified relation between the input data and the output data should be satisfied. Only then has the algorithm solved the given problem. combinatorics, number theory, numerical analysis and probability theory. He is also noted for his work in heuristics and mathematics education, identifying systematic methods of problem solving to further discovery and invention in mathematics for students and teachers. In "How to Solve It", he suggests the following steps when solving a mathematical problem: 1. Understand the problem. 2. Devise a plan. 3. Carry out the plan. 4. Review your work. An algorithm is a step by step sequence of statements intended to solve a problem. When executed with input data, it generates a computational process, and ends Chapter 6 Page indd :53:32

123 with output data, satisfying the specified relation between the input data and the output data. Example 6.1. Add two numbers: To add two numbers, we proceed by adding the right most digits of the two numbers, then the next right most digits together with carry that resulted from the previous (right) position, and so on. The computational process for adding 2586 and 9237 is illustrated in Table 6.1. can the farmer achieve the task? Initially, we assume that all the four are at the same side of the river, and finally, all the four must be in the opposite side. The farmer must be in the boat when crossing the river. A solution consists of a sequence of instructions indicating who or what should cross. Therefore, this is an algorithmic problem. Instructions may be like Let the farmer cross with the wolf. Step Carry Number There are some principles and techniques for constructing algorithms. We usually say that a problem is algorithmic in nature when its solution involves the construction of an algorithm. Some types of problems can be immediately recognized as algorithmic. Example 6.2. Consider the well-known Goat, grass and wolf problem: A farmer wishes to take a goat, a grass bundle and a wolf across a river. However, his boat can take only one of them at a time. So several trips are necessary across the river. Moreover, the goat should not be left alone with the grass (otherwise, the goat would eat the grass), and the wolf should not be left alone with the goat (otherwise, the wolf would eat the goat). How 117 or Let the farmer cross alone. However, some algorithmic problems Number do not require us to construct algorithms. Sum Instead, an algorithm is provided and we are required to prove some of its properties. Table 6.1: The process for adding two numbers Example 6.3. Consider The Chameleons of Chromeland problem: On the island 6.2 Algorithmic Problems of Chromeland there are three different types of chameleons: red chameleons, green chameleons, and blue chameleons. Whenever two chameleons of different colors meet, they both change color to the third color. For which number of red, green and blue chameleons is it possible to arrange a series of meetings that results in all the chameleons displaying the same color? This is an algorithmic problem, because there is an algorithm to arrange meetings between chameleons. Using some properties of the algorithm, we can find out for which initial number of chameleons, the goal is possible. 6.3 Building Blocks of Algorithms We construct algorithms using basic building blocks such as Chapter 6 Page indd :53:32

124 Data Variables Control flow Functions Data Algorithms take input data, process the data, and produce output data. Computers provide instructions to perform operations on data. For example, there are instructions for doing arithmetic operations on numbers, such as add, subtract, multiply and divide. There are different kinds of data such as numbers and text. represented by a single variable signal which can have one of the three values: green, amber, or red Control flow An algorithm is a sequence of statements. However, after executing a statement, the next statement executed need not be the next statement in the algorithm. The statement to be executed next may depend on the state of the process. Thus, the order in which the statements are executed may differ from the order in which they are written in the algorithm. This order of execution of statements is known as the control flow Variables Variables are named boxes for storing data. When we do operations on data, we need to store the results in In sequential control flow, a sequence variables. The data stored in a variable is of statements are executed one after also known as the value of the variable. We another in the same order as they are can store a value in a variable or change written. the value of variable, using an assignment statement. Computational processes in the real-world have state. As a process evolves, the state changes. How do we represent the state of a process and the change of state, in an algorithm? The state of a process can be represented by a set of variables in an algorithm. The state at any point of execution is simply the values of the variables at that point. As the values of the variables are changed, the state changes. There are three important control flow statements to alter the control flow depending on the state. In alternative control flow, a condition of the state is tested, and if the condition is true, one statement is executed; if the condition is false, an alternative statement is executed. In iterative control flow, a condition of the state is tested, and if the condition is true, a statement is executed. The two steps of testing the condition and executing the statement are repeated until the condition becomes false. Example 6.4. State: A traffic signal may be in one of the three states: green, amber, or red. The state is changed to allow a smooth flow of traffic. The state may be Functions Algorithms can become very complex. The variables of an algorithm 118 Chapter 6 Page indd :53:32

125 and dependencies among the variables may be too many. Then, it is difficult to build algorithms correctly. In such situations, we break an algorithm into parts, construct each part separately, and then integrate the parts to the complete algorithm. The parts of an algorithm are known as functions. A function is like a sub algorithm. It takes an input, and produces an output, satisfying a desired input output relation. Example 6.5. Suppose we want to calculate the surface area of a cylinder of radius r and height h. A = 2πr 2 + 2πrh 2. Abstraction: A problem can involve a lot of details. Several of these details are unnecessary for solving the problem. Only a few details are essential. Ignoring or hiding unnecessary details and modeling an entity only by its essential properties is known as abstraction. For example, when we represent the state of a process, we select only the variables essential to the problem and ignore inessential details. 3. Composition: An algorithm is composed of assignment and control flow statements. A control flow statement tests a condition of the state and, depending on the value of the condition, decides the next statement to be executed. We can identify two functions, one 4. Decomposition: We divide the main for calculating the area of a circle and the algorithm into functions. We construct other for the circumference of the circle. each function independently of the If we abstract the two functions as circle_ main algorithm and other functions. area(r) and circle_circumference(r), then Finally, we construct the main cylinder_area(r, h) can be solved as algorithm using the functions. When we use the functions, it is enough to cylinder_area (r,h) = 2 X circle_area (r) + circle_circumference (r) X h know the specification of the function. It is not necessary to know how the function is implemented. 6.4 Algorithm Design Techniques There are a few basic principles and techniques for designing algorithms. 1. Specification: The first step in problem solving is to state the problem precisely. A problem is specified in terms of the input given and the output desired. The specification must also state the properties of the given input, and the relation between the input and the output Specification To solve a problem, first we must state the problem clearly and precisely. A problem is specified by the given input and the desired output. To design an algorithm for solving a problem, we should know the properties of the given input and the properties of the desired output. The goal of the algorithm is to establish the relation between the input and the desired output. Chapter 6 Page indd :53:32

126 Inputs Algorithm Outputs Figure 6.1: Input-output relation An algorithm is specified by the properties of the given input and the relation between the input and the desired output. In simple words, specification of an algorithm is the desired input-output relation. our algorithmic notation, we use double dashes ( ) to start a comment line. (In C++, a double slash // indicates that the rest of the line is a comment). Example 6.6. Write the specification of an algorithm to compute the quotient and remainder after dividing an integer A by another integer B. For example, divide (22, 5) = 4, 2 divide (15, 3) = 5, 0 The inputs and outputs are passed Let A and B be the input variables. between an algorithm and the user through We will store the quotient in a variable q and variables. The values of the variables when the remainder in a variable r. So q and r are the algorithm starts is known as the initial the output variables. state, and the values of the variables when the algorithm finishes is known as the final What are the properties of the inputs state. A and B? Let P be the required property of the 1. A should be an integer. Remainder is inputs and Q the property of the desired meaningful only for integer division, and outputs. Then the algorithm S is specified as 1. algorithm_name (inputs) 2. B should not be 0, since division by 0 is not allowed inputs : P outputs: Q This specification means that if the algorithm starts with inputs satisfying P, then it will finish with the outputs satisfying Q. A double dash -- indicates that the rest of the line is a comment. Comments are statements which are used to annotate a program for the human readers and not executed by the computer. Comments at crucial points of flow are useful, and even necessary, to understand the algorithm. In We will specify the properties of the inputs as inputs: A is an integer and B 0 What is the desired relation between the inputs A and B, and the outputs q and r? 1. The two outputs q (quotient) and r (remainder) should satisfy the property A = q X B + r, and 2. The remainder r should be less than the divisor B, 120 Chapter 6 Page indd :53:32

127 0 r < B Combining these requirements, we will specify the desired input-output relation as outputs: A = q X B + r and 0 < r < B. The comment that starts with inputs: actually is the property of the given inputs. The comment that starts with outputs: is the desired relation between the inputs and the outputs. The specification of the algorithm is 1. divide (A, B) inputs: A is an integer and B 0 Example 6.7. Write the specification of an algorithm for computing the square root of a number. 1. Let us name the algorithm square_root. 2. It takes the number as the input. Let us name the input n. n should not be negative. 3. It produces the square root of n as the output. Let us name the output y. Then n should be the square of y. Now the specification of the algorithm is square_root(n) outputs : A = q X B + r and 0 r < B -- inputs: n is a real number, n 0. Specification format: We can write the -- outputs: y is a real number such that specification in a standard three part format: y 2 = n. The name of the algorithm and the inputs. Input: the property of the inputs. Output: the desired input-output relation. The first part is the name of the algorithm and the inputs. The second part is the property of the inputs. It is written as a comment which starts with inputs: The third part is the desired input-output relation. It is written as a comment which starts with outputs:. The input and output can be written using English and mathematical notation Specification as contract Specification of an algorithm serves as a contract between the designer of the algorithm and the users of the algorithm, because it defines the rights and responsibilities of the designer and the user. Ensuring that the inputs satisfy the required properties is the responsibility of the user, but the right of the designer. The desired input-output relation is the responsibility of the designer and the right of the user. Importantly, if the user fails to satisfy the properties of the inputs, the designer is free from his obligation to satisfy the desired input-output relation. 121 Chapter 6 Page indd :53:32

128 Responsibility User Right Property of inputs Input - output relationship Right Algorithm (designer) Responsibility Figure 6.2: Input property and the inputoutput relation as rights and responsibilities Example 6.8. Consider the specification of the algorithm square_root. square_root(n) rider can ignore. Those details are irrelevant for the purpose of riding a bicycles. A problem can involve a lot of details. Several of these details are irrelevant for solving the problem. Only a few details are essential. Abstraction is the process of ignoring or hiding irrelevant details and modeling a problem only by its essential features. In our everyday life, we use abstractions unconsciously to handle complexity. Abstraction is the most effective mental tool used for managing complexity. If we do not abstract a problem adequately, we may deal with unnecessary details and complicate the solution. -- inputs: n is a real number, n outputs : y is a real number such that y 2 = n. The algorithm designer can assume for different purposes and so use different that the given number is non-negative, and construct the algorithm. The user can expect the output to be the square root of the given number. The output could be the negative square root of the given number. The specification did not commit that the output is the positive square root. If the user passes a negative number as the input, then the output need not be the square root of the number. 6.6 Abstraction To ride a bicycle, it is sufficient to understand the functioning of the pedal, handlebar, brakes and bell. As a rider, we model a bicycle by these four features. A bicycle has a lot more details, which the 122 Example 6.9. A map is an abstraction of the things we find on the ground. We do not represent every detail on the ground. The map-maker picks out the details that we need to know. Different maps are drawn abstractions, i.e., they hide or represent different features. A road map is designed for drivers. They do not usually worry about hills so most hills are ignored on a road map. A walker's map is not interested in whether a road is a one-way street, so such details are ignored. Example In medicine, different specialists work with different abstractions of human body. An orthopaedician works with the abstraction of skeletal system, while a gastroenterologist works with digestive system. A physiotherapist abstracts the human body by its muscular system. We use abstraction in a variety of ways while constructing algorithms in the specification of problems, representing state Chapter 6 Page indd :53:33

129 by variables, and decomposing an algorithm to functions. An algorithm designer has to be trained to recognize which features are essential to solve the problem, and which details are unnecessary. If we include unnecessary details, it makes the problem and its solution over-complicated. Specification abstracts a problem by the properties of the inputs and the desired input-output relation. We recognize the properties essential for solving the problem, and ignore the unnecessary details. State: In algorithms, the state of a computation is abstracted by a set of variables. choosing a piece and breaking it along one of its grooves. Thus a cut divides a piece into two pieces. How many cuts are needed to break the bar into its individual squares? In this example, we will abstract the essential variables of the problem. We solve the problem in Example 8.6. Essential variables: The number of pieces and the number of cuts are the essential variables of the problem. We will represent them by two variables, p and c, respectively. Thus, the state of the process is abstracted by two variables p and c. Irrelevant details: Functions: When an algorithm is very 1. The problem could be cutting a chocolate complex, we can decompose it into bar into individual pieces or cutting a functions and abstract each function by its sheet of postage stamps into individual specification. stamps. It is irrelevant. The problem is simply cutting a grid of squares into State individual squares. State is a basic and important abstraction. Computational processes have state. A computational process starts with an initial state. As actions are performed, its state changes. It ends with a final state. State of a process is abstracted by a set of variables in the algorithm. The state at any point of execution is simply the values of the variables at that point. Example Chocolate Bars: A rectangular chocolate bar is divided into squares by horizontal and vertical grooves. We wish to break the bar into individual squares. To start with, we have the whole of the bar as a single piece. A cut is made by 2. The sequence of cuts that have been made and the shapes and sizes of the resulting pieces are irrelevant too. From p and c, we cannot reconstruct the sizes of the individual pieces. But, that is irrelevant to solving the problem. Example Consider Example 1.2, Goat, grass and wolf problem. In this example, we will write a specification of the problem. We will solve it in Example 2.1. The problem involves four individuals, and each is at one of the two sides of the river. This means that 123 Chapter 6 Page indd :53:33

130 we can represent the state by four variables, and each of them has one of the two values. Let us name the variables farmer, goat, grass and wolf, and their possible values L and R. A value of L means "at the left side". A value of R means "at the right side". Since the boat is always with the farmer, it is important to not introduce a variable to represent its position. value in a variable. It is written with the variable on the left side of the assignment operator and a value on the right side. variable := value When this assignment is executed, the value on the right side is stored in the variable on the left side. The assignment In the initial state, all four variables farmer, goat, grass, wolf have the value L. farmer, goat, grass, wolf = L, L, L, L -- outputs: farmer, goat, grass, wolf = R, R, R, R subject to the two constraints that 1. the goat cannot be left alone with the grass: if goat = grass then farmer = goat m := 2 stores value 2 in variable m. m 2 In the final state, all four variables should have the value R. If the variable already has a value farmer, goat, grass, wolf = R, R, R, R stored in it, assignment changes its value to the value on the right side. The old value of The specification of the problem is the variable is lost. cross_river The right side of an assignment can -- inputs: farmer, goat, grass, wolf = L, L, be an expression. L, L variable := expression In this case, the expression is evaluated and the value of the expression is stored in the variable. If the variable occurs in the expression, the current value of the variable is used in evaluating the expression, and then the variable is updated. For example, the assignment 2. the goat cannot be left alone with the wolf: if goat = wolf then farmer = goat Assignment statement Variables are named boxes to store values. Assignment statement is used to store a m := m + 3 evaluates the expression m + 3 using the current value of m. m + 3 = Chapter 6 Page indd :53:33

131 = 5 and stores the value 5 in the variable m. m 5 The two sides of an assignment statement are separated by the symbol :=, known as assignment operator, and read as "becomes" or "is assigned". The assignment statement v := e an assignment statement, first evaluate all the expressions on the right side using the current values of the variables, and then store them in the corresponding variables on the left side. Example What are the values of variables m and n after the assignments in line (1) and line (3)? 1. m, n := 2, m, n =?,? is read as v "becomes" e. Note that assignment 3. m,n:=m+3,n-1 operator is not equality operator 1. The meanings of v := e and v = e are different m, n =?,? Assignment does not state a mathematical equality of a variable, but changes the value The assignment in line (1) stores 2 in variable of a variable. The assignment m := m + m, and 5 in variable n. 3 does not state that m is equal to m + 3. Rather, it changes the value of the variable m to the value of the expression m + 3. An assignment statement can change the values of multiple variables simultaneously. In that case, the number of variables on the left side should match the number of expressions on the right side. For example, if we wish to assign to three variables v1, v2 and v3, we need 3 expressions, say, el, e2, e3. vl, v2, v3 := el, e2, e3 The left side is a comma-separated list of variables. The right side is a commaseparated list of expressions. To execute m n 2 5 The assignment in line (3) evaluates the expressions m + 3 and n - 1 using the current values of m and n as m + 3, n - 1 =2+3,5-1 = 5,4 and stores the values 5 and 4 in the variables m and n, respectively. ^Unfortunately, several programming languages, including C++, use the symbol = as assignment operator, and therefore, another symbol, == as 1. m, n := 2,5 equality operator. 125 m n 5 4 Chapter 6 Page indd :53:33

132 2. -- m, n = 2, 5 3. m, n := m + 3, n m, n = 2 + 3, 5-1 = 5, 4 Values of the variables after the two assignments are shown in in line (2) and line(4). Example In Example 6.11, we abstracted the state of the process by two variables p and c. The next step is to model the process of cutting the chocolate bar. When we make a single cut of a piece, the number of pieces (p) and the number of cuts (c) both increase by 1. We can model it by an assignment statement. p, c := p + 1, c+1 which is read as p and c "become" p + 1 and c + 1, respectively. Points to Remember: A programming language provides basic Specification of an algorithm is a contract statements and a notation for composing between the designer and users of the compound statements. algorithm. An algorithm is a step-by-step sequence Abstraction is the process of hiding or of statements to solve a problem. ignoring the details irrelevant to the As an algorithm is executed, a process evolves which solves the problem. Algorithmic problem solving involves construction of algorithms as well as proving properties of algorithms. The specification of an algorithm consists of the name of the algorithm (together with its inputs), the input property, and the desired input-output relation. task so as to model a problem only by its essential features. Specification abstracts a problem by the essential variables of the problem. The values of the variables in an algorithm define the state of the process. Assignment statement changes the values of variables, and hence the state. 126 Chapter 6 Page indd :53:33

133 Evaluation Part I Choose the Best Answer 1. Which of the following activities is algorithmic in nature? (a) Assemble a bicycle. (c) Label the parts of a bicycle. (b) Describe a bicycle. (d) Explain how a bicycle works. 2. Which of the following activities is not algorithmic in nature? (a) Multiply two numbers. (c) Walk in the park. (b) Draw a kolam. (d) Braid the hair. 3. Omitting details inessential to the task and representing only the essential features of the task is known as (a) specification (b) abstraction (c) composition (d) decomposition 4. Stating the input property and the as :-output relation a problem is known (a) specification (b) statement (c) algorithm (d) definition 5. Ensuring the input-output relation is (a) the responsibility of the algorithm and the right of the user. (b) the responsibility of the user and the right of the algorithm. (c) the responsibility of the algorithm but not the right of the user. (d) the responsibility of both the user and the algorithm. 6. If i = 5 before the assignment i := i-1 after the assignment, the value of i is (a) 5 (b) 4 (c) 3 (d) 2 7. If 0 < i before the assignment i := i-1 after the assignment, we can conclude that (a) 0 < i (b) 0 i (c) i = 0 (d) 0 i Part II Very Short Answers 1. Define an algorithm. 2. Distinguish between an algorithm and a process. 3. Initially, farmer, goat, grass, wolf = L, L, L, L 127 Chapter 6 Page indd :53:33

134 and the farmer crosses the river with goat. Model the action with an assignment statement. 4. Specify a function to find the minimum of two numbers. 5. If 2 = 1.414, and the square_root() function returns , does it violate the following specification? -- square_root (x) -- inputs: x is a real number, x 0 -- outputs: y is a real number such that y 2 =x Part III Short Answers 1. When do you say that a problem is algorithmic in nature? 2. What is the format of the specification of an algorithm? 3. What is abstraction? 4. How is state represented in algorithms? 5. What is the form and meaning of assignment statement? 6. What is the difference between assignment operator and equality operator? Part IV Explain 1. Write the specification of an algorithm hypotenuse whose inputs are the lengths of the two shorter sides of a right angled triangle, and the output is the length of the third side. 2. Suppose you want to solve the quadratic equation ax2 + bx + c = 0 by an algorithm. quadratic_solve (a, b, c) -- inputs :? -- outputs:? You intend to use the formula and you are prepared to handle only real number roots. Write a suitable specification. x = b ± b 2 4ac a 128 Chapter 6 Page indd :53:33

135 3. Exchange the contents: Given two glasses marked A and B. Glass A is full of apple drink and glass B is full of grape drink. For exchanging the contents of glasses A and B, represent the state by suitable variables, and write the specification of the algorithm. Books 1. Roland Backhouse, Algorithmic Problem Solving, John Wiley & Sons Ltd, Krysia Broda, Susan Eisenbach, Hessam Khoshnevisan, Steve Vickers, Reasoned Programming, Prentice Hall, Chapter 6 Page indd :53:33

136 Unit II Algorithmic Problem Solving CHAPTER 7 Learning Objectives After learning the concepts in this chapter, the students will be able To know the notations used in algorithmic techniques. To understand Composition and Decomposition in algorithmic techniques. Composition and Decomposition In Chapter 1, we saw that algorithms are composed of statements. Statements can be grouped into compound statements, giving rise to a hierarchical structure of algorithms. Decomposition is one of the elementary problem-solving techniques.an algorithm Even punctuation symbols must be exact. may be broken into parts, expressing only high level details. Then, each part may be refined into smaller parts, expressing finer details, or each partmay be abstracted as a function. 7.1 Notations for Algorithms We need a notation to represent algorithms. There are mainly three different notations for representing algorithms. A programming language is a notation for expressing algorithms to be executed by computers. Pseudo code is a notation similar to programming languages. Algorithms expressed in pseudo code are not intended to be executed by computers, but for communication among people. 130 Flowchart is a diagrammatic notation for representing algorithms. They give a visual intuition of the flow of control, when the algorithm is executed Programming language A programming language is a notation for expressing algorithms so that a computer can execute the algorithm. An algorithm expressed in a programming language is called a program. C, C++ and Python are examples of programming languages. Programming language is formal. Programs must obey the grammar of the programming language exactly. They do not allow the informal style of natural languages such as English or Tamil. There is a translator which translates the program into instructions executable by the computer. If our program has grammatical errors, this translator will not be able to do the translation Pseudo-code Pseudo code is a mix of programminglanguage-like constructs and plain English. This notation is not formal nor exact. It uses the same building blocks as programs, such as variables and control flow. But, it allows the use of natural English for statements and conditions. An algorithm expressed as pseudo code is not for computers to execute directly, but for human readers Chapter 7 Page indd :53:00

137 to understand. Therefore, there is no need to follow the rules of the grammar of a programming language. However, even pseudo code must be rigorous and correct. Pseudo code is the most widely used notation to represent algorithms. 3. Parallelogram boxes represent inputs given and outputs produced. Inputs Outputs Flowcharts Flowchart is a diagrammatic notation 4. Special boxes marked Start and the End are used to indicate the start and the end of an for representing algorithms. They show the execution: control flow of algorithms using diagrams in a visual manner. In flowcharts, rectangular boxes represent simple statements, diamond-shaped boxes represent conditions, and arrows describe how the control flows during the execution of Start End the algorithm. A flowchart is a collection of boxes containing statements and conditions which are connected by arrows showing the order in which the boxes are to be executed. The flowchart of an algorithm to compute the quotient and remainder after dividing an integer A by another integer B is shown in Figure 7.1, illustrating the different boxes such as input, output, condition, and 1. A statement is contained in a rectangular assignment, and the control flow between the box with a single outgoing arrow,which boxes. The algorithm is explained in Example points to the box to be executed next S 2. A condition is contained in a diamondshaped box with two outgoing arrows, labeled true and false. The true arrow points to the box to be executed next if the condition is true, and the false arrow points to the box to be executed next if the condition is false. Enter A,B q,r:=0,a true r > B false r,q Exit q,r:=q+1,r-b C false true 131 Figure 7.1: Flowchart for integer division Flowcharts also have disadvantages. (1) Flowcharts are less compact than representation of algorithms in Chapter 7 Page indd :53:00

138 programming language or pseudo code. (2) They obscure the basic hierarchical structure of the algorithms. (3) Alternative statements and loops are disciplined control flow structures. Flowcharts do not restrict us to disciplined control flow structures. 7.2 Composition of a sequence of statements. The statements in the sequence are executed one after another, in the same order as they are written in the algorithm, and the control flow is said to be sequential. Let S1 and S2 be statements. A sequential statement composed of S1 and S2 is written as S1 S2 A statement is a phrase that commands the computer to do an action. In order to execute the sequential We have already seen assignment statement. statement, first do S1 and then do S2. It is a simple statement, used to change the values of variables. Statements may The sequential statement given be composed of other statements, leading above can be represented in a flowchart as to ahierarchical structure of algorithms. shown in in Figure 7.2. The arrow from Statements composed of other statements S1 to S2 indicates that S1 is executed, and are known as compound statements. after that, S2 is executed. Control flow statements are S1 compound statements. They are used to alter the control flow of the process depending on the state of the process. S2 There are three important control flow statements: Figure 7.2: Sequential control flow Sequential Alternative Iterative Let the input property be P, and the input-output relation be Q, for a problem. If statement S solves the problem, it is written as When a control flow statement is executed, the state of the process is tested, and depending on the result, a statement is selected for execution Sequential statement A sequential statement is composed P 2. S Q If we decompose the problem into two components, we need to compose S as a 132 Chapter 7 Page indd :53:00

139 sequence of two statements S1 and S2 such that the input-output relation of S1, say R, is the input property of S P 2. S R 4. S2 to construct a statement S so as to move from the initial state to the final state farmer, goat, grass, wolf = L, L, L, L Q We have to compose S as a sequence of assignment statements such that in Example 7.1. Let us solve the Farmer, none of the intermediate states Goat, Grass, and Wolf problem of Example We decided to represent the state of the process by four variables farmer, 1. goat and wolf have the same value but farmer has the opposite value, or goat, grass, and wolf, representing the 2. goat and grass have the same value but sides of the farmer, goat, grass and wolf, farmer has the opposite value.subject respectively. In the initial state, all four to these constraints, a sequence of variables have the value L (Left side). In assignments and the state after each the final state, all four variables should assignment are shown in Figure 7.3. have the value R (Right side). The goal is farmer, goat, grass, wolf = L, L, L, L 2. farmer, goat := R, R 2. S farmer, goat, grass, wolf = R, R, L, L 4. farmer := L 5. farmer, goat, grass, wolf = L, R, L, L 6. farmer, grass := R, R farmer, goat, grass, wolf = R, R, R, L 8. farmer, goat := L, L farmer, goat, grass, wolf = L, L, R, L 10. farmer, wolf := R, R farmer, goat, grass, wolf = R, L, R, R 12. farmer : = L farmer, goat, grass, wolf = L, L, R, R 14. farmer, goat : = R, R farmer, goat, grass, wolf = R, R, R, R farmer, goat, grass, wolf = R, R, R, R Figure 7.3: Sequence of assignments for goat, grass and wolf problem 133 Chapter 7 Page indd :53:00

140 Other than lines (1) and (15), in line (7), goat and grass have the same value, but farmer also has the same value as they. In line (9), goat and wolf have the same value, but farmer also has the same value as they. Thus, the sequence has achieved the goal state, without violating the constraints. C S2 false true S Alternative statement Figure 7.4: Alternative control flow A condition is a phrase that Conditional statement: Sometimes we describes a test of the state. If C is a need to execute a statement only if a condition and both condition is true and do nothing if the condition is false. This is equivalent to the S1 and S2 are statements, then alternative statement in which the elseclause is empty. This variant of alternative if C statement is called a conditional statement. If C is a condition and S is a statement, S1 then else if C S2 S is a statement, called an alternative statement, that describes the following action: 1. Test whether C is true or false. 2. If C is true, then do S1; otherwise do S2. is a statement, called a conditional statement, that describes the following action: 1. Test whether C is true or false. 2. If C is true then do S; otherwise do nothing. In pseudo code, the two alternatives S1 and S2 are indicated by indenting them from the keywords if and else, respectively. Alternative control flow is depicted in the flowchart of Figure 2.4. Condition C has two outgoing arrows, labeled true and false. The true arrow points to the S1 box. The false arrow points to the S2 box. Arrows out of S1 and S2 point to the same box, the box after the alternative statement. 134 The conditional control flow is depicted in the flowchart of Figure 2.5. false C true Figure 7.5: Conditional control flow S Chapter 7 Page indd :53:00

141 Example 7.2. Minimum of two numbers: Given two numbers a and b, we want to find the minimum of the two using the alternative statement. Let us store the minimum in a variable named result. Let a b denote the minimum of a and b (for instance, 4 2 = 2, 5 6 = -5). Then, the specification of algorithm minimum is minimum(a, b) -- input s : a, b -- outputs: result = a b 2. S1 3. case C2 4. S2 5. case C3 6. S3 7. else 8. S4 Algorithm minimum can be defined as The conditions C1, C2, and C3 are evaluated in turn. For the first condition 1. minimum(a, b) that evaluates to true, the corresponding statement is executed, and the case analysis a, b statement ends. If none of the conditions evaluates to true, then the default case S4 3. if a < b is executed. 4. result : = a 1. The cases are exhaustive: at least one 5. else of the cases is true. If all conditions are false, the default case is true. 6. result = b result = a b Case analysis Alternative statement analyses the problem into two cases. Case analysis statement generalizes it to multiple cases. Case analysis splits the problem into an exhaustive set of disjoint cases. For each case, the problem is solved independently. If C1, C2, and C3 are conditions, and S1, S2, S3 and S4 are statements, a 4-case analysis statement has the form, 1. case C The cases are disjoint: only one of the cases is true. Though it is possible for more than one condition to be true, the case analysis always executes only one case, the first one that is true. If the three conditions are disjoint, then the four cases are (1) C1, (2) C2, (3) C3, (4) (not C1) and (not C2) and (not C3). Example 7.3. We want an algorithm that compares two numbers and produces the result as Chapter 7 Page indd :53:00

142 { compare (a, b) = if a < b if a = b if a > b We can split the state into an exhaustive set of 3 disjoint cases: a < b, a = b, and a> b. Then we can define compare() using a case analysis. 1. compare(a, b) C and executing S, are repeated until C becomes false. When C becomes false, the loop ends, and the control flows to the statement next to the iterative statement. The condition C and the statement S are called the loop condition and the loop body, respectively. Testing the loop condition and executing the loop body once is called an iteration. not C is known as the termination condition. 2. case a < b Iterative control flow is depicted in the flowchart of Figure 7.6. Condition C 3. result := -1 has two outgoing arrows, true and false. The true arrow points to S box. If C is true, 4. case a = b S box is executed and control flows back 5. result := 0 to C box. The false arrow points to the box after the iterative statement (dotted box). 6. else -- a > b If C is false, the loop ends and the control flows to the next box after the loop. 7. result : = Iterative statement An iterative process executes the same action repeatedly, subject to a condition C. If C is a condition and S is a statement, then C false true S while C S is a statement, called an iterative statement, that describes the following action: 1. Test whether C is true or false. 2. If C is true, then do S and go back to step 1; otherwise do nothing. The iterative statement is commonly known as a loop. These two steps, testing Figure 7.6: Iterative control flow Example 7.4. Construct an iterative algorithm to compute the quotient and remainder after dividing an integer A by another integer B. We formulated the specification of the algorithm in Example 6.6 as divide (A, B) -- inputs: A is an integer and B Chapter 7 Page indd :53:00

143 -- outputs : q and r such that A = q X B + r and -- 0 r < B Now we can construct an iterative algorithm that satisfies the specification. divide (A, B) -- inputs: A is an integer and B 0 -- outputs : q and r such that A = q X B + r and -- 0 < r < B q := 0, A while r B iteration q q+1 r r-b A B Table 7.1: Step by step execution of divide (22, 5) Example 7.5. In the Chameleons of Chromeland problem of Example 1.3, suppose two types of chameleons are equal in number. Construct an algorithm that arranges meetings between these two types so that they change their color to the third type. In the end, all should display the same color. q, r := q + 1, r - B Let us represent the number of chameleons of each type by variables a, b The algorithm is presented as a and c, and their initial values by A, B and C, flowchart in Figure 7.1. respectively. Let a = b be the input property. The input-output relation is a = b = 0 and c = A+B+C. Let us name the algorithm monochromatize. The algorithm can be specified as We can execute the algorithm stepby-step for a test input, say, (A, B) = (22, 5). Each row of Table 7.1 shows one iteration the evaluation of the expressions and the values of the variables at the end of an iteration. Note that the evaluation of the expression uses the values of the variables from the previous row. Output variables q and r change their values in each iteration. Input variables A and B do not change their values. Iteration 0 shows the values just before the loop starts. At the end of iteration 4, condition (r B) = (2 5) is false, and hence the loop ends with (q, r) = (4, 2). monochromatize(a, b, c) -- inputs: a=a, b=b, c=c, a=b -- outputs : a = b = 0, c = A+B+C In each iterative step, two chameleons of the two types (equal in number) meet and change their colors to the third one. For example, if A, B, C = 4, 4, 6, then the series of meetings will result in 137 Chapter 7 Page indd :53:00

144 iteration a b c Table 7.2: Series of meetings between two types of chameleons equal in number. In each meeting, a and b each decreases by 1, and c increases by 2. The solution can be expressed as an iterative algorithm. smaller and more manageable problems, and combining the solutions of the smaller problems to solve the original problem. Often, problems have structure. We can exploit the structure of the problem and break it into smaller problems. Then, the smaller problems can be further broken until they become sufficiently small to be solved by other simpler means. Their solutions are then combined together to construct a solution to the original problem Refinement monochromatize(a, b, c) After decomposing a problem into smaller subproblems, the next step is either -- inputs: a=a, b=b, c=c, a=b to refine the subproblem or to abstract the subproblem. -- outputs: a = b = 0, c = A+B+C 1. Each subproblem can be expanded into while a > 0 more detailed steps. Each step can be further expanded to still finer steps, and a, b, c := a-1, b-1, c+2 so on. This is known as refinement. The algorithm is depicted in the flowchart of Figure 7.7. a,b,c a > 0 a,b,c a=b, a=a, b=b, c=c True a, b, c,: = a-1, b-1, c+2 False a= b = 0, c = A + B + C Figure 7.7: Algorithm monochromatize 7.3 Decomposition Problem decomposition is one of the elementary problem-solving techniques. It involves breaking down a problem into 2. We can also abstract the subproblem. We specify each subproblem by its input property and the input-output relation. While solving the main problem, we only need to know the specification of the subproblems. We do not need to know how the subproblems are solved. Example 7.6. Consider a school goer's action in the morning. The action can be written as 1 Get ready for school We can decompose this action into smaller, more manageable action steps which she takes in sequence: 1 Eat breakfast 138 Chapter 7 Page indd :53:01

145 2 Put on clothes 3 Leave home 3 Eat eggs 4 Eat bananas We have refined one action into a detailed sequence of actions. However, each of these actions can be expanded into a sequence of actions at a more detailed level, and this expansion can be repeated. The action "Eat breakfast" can be expanded as 1 -- Eat breakfast 2 Eat idlis 3 Eat eggs 4 Eat bananas The action "Put on clothes" can be 13 Ride the bicycle away expanded as Refinement is not always a sequence 1 -- Put on clothes of actions. What the student does may 2 Put on blue dress depend upon the environment. How she eats breakfast depends upon how hungry 3 Put on socks and shoes she is and what is on the table; what clothes she puts on depends upon the day of the 4 Wear ID card week. We can refine the behaviour which depends on environment, using conditional and "Leave home" expanded as and iterative statements Put on clothes 7 Put on blue dress 8 Put on socks and shoes 9 Wear ID card Leave home 12 Take the bicycle out 1 -- Leave home 2 Take the bicycle out 3 Ride the bicycle away 1 -- Eat breakfast 2 if hungry and idlis on the table 3 Eat idlis Thus, the entire action of "Get ready for school" has been refined as 1 -- Eat breakfast 2 Eat idlis if hungry and eggs on the table 5 Eat eggs 6 if hungry and bananas on the table 7 Eat bananas Chapter 7 Page indd :53:01

146 Put on clothes 10 if Wednesday 11 Put on blue dress 12 else 13 Put on white dress 14 Put on socks and shoes 15 Wear the ID card Leave home 18 Take the bicycle out 19 Ride the bicycle away The action "Eat idlis" can be further refined as an iterative action: 1 -- Eat idlis 2 Put idlis on the plate 3 Add chutney 4 while idlis in plate 5 Eat a bite of idli How "Get ready for school" is refined in successive levels is illustrated in Figure 2.8. Gross Detailed More detailed Eat breakfast Eat idlis Put idlis on plate Add chutney Eat eggs Eat a bite of idli Eat bananas Eat a bite of idli Eat a bite of idli Put on clothes Put on blue dress Put on socks and shoes Wear ID card Leave home Take the bicycle out Ride the bicycle away Figure 7.8: Refinement at various levels of details The action "Eat breakfast" is depicted in a flowchart shown in Figure Chapter 7 Page indd :53:01

147 Enter false hungry and idlis on table true Put idlis on plate Add chutney Idli in plate? true Eat a bite of idli false hungry and eggs on table true Eat eggs false hungry and true Eat banabas bananas on table false Exit Figure 7.9: Flowchart for Eat breakfast Note that the flowchart does not show the hierarchical structure of refinement Functions After an algorithmic problem is decomposed into subproblems, we can abstract the subproblems as functions. A function is like a sub-algorithm. Similar to an algorithm, a function is specified by the input property, and the desired input-output relation. Main algorithm inputs outputs Function (subalgorithm) Figure 7.10: Function definition 141 Chapter 7 Page indd :53:01

148 To use a function in the main algorithm, the user need to know only the specification of the function the function name, the input property, and the inputoutput relation. The user must ensure that the inputs passed to the function will satisfy the specified property and can assume that the outputs from the function satisfy the input-output relation. Thus, users of the function need only to know what the function does, and not how it is done by the function. The function can be used a a "black box" in solving other problems. square(y) -- inputs : y -- outputs : y 2 we can use this function three times to test whether a triangle is right-angled. square() is a "black box" we need not know how the function computes the square. We only need to know its specification. y Ultimately, someone implements the Square function using an algorithm. However, users of the function need not know about the algorithm used to implement the function. It is hidden from the users. There is no need y 2 Figure 7.11: square function for the users to know how the function is 1 right_angled(a, b, c) implemented in order to use it inputs: c a, c b An algorithm used to implement a function may maintain its own variables outputs: result = true if c 2 = a 2 + b 2 ; These variables are local to the function in the sense that they are not visible to the 4 -- result = false, otherwise user of the function. Consequently, the user has fewer variables to maintain in the main algorithm, reducing the clutter of the main algorithm if square (c) = square (a) + square (b) result := true else Example 7.7. Consider the problem of testing whether a triangle is right-angled, given its three sides a, b, c, where c is the longest side. The triangle is right-angled, if c 2 = a 2 + b 2 We can identify a subproblem of squaring a number. Suppose we have a function square(), specified as 8 result := false 142 Chapter 7 Page indd :53:01

149 Points to Remember Compound statements are composed of sequential, alternative and iterative control flow statements. The value of a condition is true or false, depending on the values of the variables. Alternative statement selects and executes exactly one of the two statements,depending on the value of the condition. Programming language, pseudo code, and flowchart are notations for expressing algorithms. Decomposition breaks down a problem into smaller subproblems and combine their solutions to solve the original problem. A function is an abstraction of a subproblem, and specified by its input property, and its inputoutput relation. Conditional statement is executed Users of function need to know only if the condition is true. only what the function does, and Otherwise, nothing is done. not how it is done. Iterative statement repeatedly In refinement, starting at a high evaluates a condition and executes level, each statement is repeatedly a statement as long as the condition is true. expanded into more detailed statements in the subsequent levels. Evaluation Part I 1. Suppose u, v = 10,5 before the assignment. What are the values of u and v after the sequence of assignments? 1 u := v 2 v := u (a) u, v = 5,5 (c) u, v = 10,5 (b) u, v = 5,10 (d) u, v = 10, Chapter 7 Page indd :53:01

150 2. Which of the following properties is true after the assignment (at line 3? 1 -- i+j = 0 2 i, j := i+1, j ? (a) i+j >0 (b) i+j < 0 (c) i+j =0 (d) i = j 3. If C1 is false and C2 is true, the compound statement 1 if C1 2 S1 3 else 4 if C2 5 S2 6 else 7 S3 executes (a) S1 (b) S2 (c) S3 (d) none 4. If C is false just before the loop, the control flows through 1 S1 2 while C 3 S2 4 S3 (a) S1 ; S3 (b) S1 ; S2 ; S3 (c)s1 ; S2 ; S2 ; S3 (d) S1 ; S2 ; S2 ; S2 ; S3 5. If C is true, S1 is executed in both the flowcharts, but S2 is executed in C true S1 C true S1 false false S2 S2 (1) (2) (a) (1) only (b) (2) only (c) both (1) and (2) (d) neither (1) nor (2) 144 Chapter 7 Page indd :53:01

151 6. How many times the loop is iterated? i := 0 while i 5 i := i + 1 (a) 4 (b) 5 (c) 6 (d) 0 Part II 1. Distinguish between a condition and a statement. 2. Draw a flowchart for conditional statement. 3. Both conditional statement and iterative statement have a condition and a statement. How do they differ? 4. What is the difference between an algorithm and a program? 5. Why is function an abstraction? 6. How do we refine a statement? Part III 1. For the given two flowcharts write the pseudo code. 2. If C is false in line 2, trace the control flow in this algorithm. 1 S C is false 3 if C 4 S2 5 else 6 S3 7 S4 3. What is case analysis? 4. Draw a flowchart for -3case analysis using alternative statements. 5. Define a function to double a number in two different ways: (1) n + n, (2) 2 x n Part IV 1. Exchange the contents: Given two glasses marked A and B. Glass A is full of apple drink 145 Chapter 7 Page indd :53:01

152 and glass B is full of grape drink. Write the specification forexchanging the contents of glasses A and B, and write a sequence of assignments to satisfy the specification. 2. Circulate the contents: Write the specification and construct an algorithm to circulate the contents of the variables A, B and C as shown below: The arrows indicate that B gets the value of A, C gets the value of B and A gets the value of C. A B C 3. Decanting problem. You are given three bottles of capacities 5,8, and 3 litres. The 8L bottle is filled with oil, while the other two are empty. Divide the oil in 8L bottle into two equal quantities. Represent the state of the process by appropriate variables. What are the initial and final states of the process? Model the decanting of oil from one bottle to another by assignment. Write a sequence of assignments to achieve the final state. 4. Trace the step-by-step execution of the algorithm for factorial(4). factorial(n) -- inputs : n is an integer, n 0 -- outputs : f = n! f, i := 1,1 while i n f, i := f i, i Chapter 7 Page indd :53:01

153 Unit II Algorithmic Problem Solving CHAPTER 8 Iteration and recursion Learning Objectives After learning the concepts in this chapter, the students will be able To know the concepts of variants and invariants used in algorithmic techniques. Apply algorithmic techniques in iteration and recursion process. There are several problems which can be solved by doing the same action repeatedly. Both iteration and recursion are algorithm design techniques to execute the same action repeatedly. What is the use of repeating the than astronomy is about same action again and again? Even though the telescopes." action is the same, the state in which the action is executed is not the same. Each time we but more powerful.using recursion, we solve execute the action, the state changes. Therefore, a problem with a given input, by solving the the same action is repeatedly executed, but same problem with a part of the input, and in different states. The state changes in such a constructing a solution to the original problem way that the process progresses to achieve the from the solution to the partial input. desired input-output relation. Iteration: In iteration, the loop body is repeatedly executed as long as the loop condition is true. Each time the loop body is executed, the variables are updated. However, there is also a property of the variables which remains unchanged by the execution of the loop body. This unchanging property is called the loop invariant. Loop invariant is the key to construct and to reason about iterative algorithms. Recursion: Recursion is another algorithm design technique, closely related to iteration, 147 E W Dijkstra was one of the most influential pioneers of Computing Science. He made fundamental contributions in diverse areas such as programming language design, operating systems, and program design. He coined the phrase "structured programming" which helped lay the foundations for the discipline of software engineering. In 1972, he was awarded ACM Turing Award, considered the highest distinction in computer science. Dijkstra is attributed to have said "Computer science is no more about computers 8.1 Invariants Example 8.1. Suppose the following assignment is executed with (u, v) = (20,15). We can annotate before and after the assignment. -- before: u, v = 20, 15 u, v :=u+5,v-5 -- after: u, v = 25, 10 After assignment (u, v) = (25, 10). But what do you observe about the value Chapter 8 Page indd :52:35

11 th Computer Science Materials 1 P a g e Prepared By -- T.Thirumalai, M.Sc(CS).,B.Ed., * *

11 th Computer Science Materials 1 P a g e Prepared By -- T.Thirumalai, M.Sc(CS).,B.Ed., * * 1 P a g e FUNDAMENTALS OF COMPUTERS CHAPTER 1 INTRODUCTION TO COMPUTER Choose the correct answer: 1. First generation computers used Book Back 1-Marks (a) Vacuum tubes (b) Transistors (c) Integrated circuits

More information

GOVERNMENT OF TAMILNADU COMPUTER TECHNOLOGY HIGHER SECONDARY FIRST YEAR VOLUME-I. Untouchability is Inhuman and a Crime

GOVERNMENT OF TAMILNADU COMPUTER TECHNOLOGY HIGHER SECONDARY FIRST YEAR VOLUME-I. Untouchability is Inhuman and a Crime GOVERNMENT OF TAMILNADU COMPUTER TECHNOLOGY HIGHER SECONDARY FIRST YEAR VOLUME-I Untouchability is Inhuman and a Crime A publication under Free Textbook Programme of Government of Tamil Nadu Department

More information

watts of power generation

watts of power generation Chapter - I Introduction to Computers One Mark Questions: 1.Computer generation can be classified into 5 types 2. Charles Babbage is considered to be the father of computer 3. Analytical Engine was invented

More information

11 th Computer Science 1 P a g e 11 th Computer Science UNIT I - FUNDAMENTALS OF COMPUTER AND WORKING WITH A TYPICAL OPERATING SYSTEMS (WINDOWS & LINUX) CHAPTER 1 INTRODUCTION TO COMPUTER Choose the correct

More information

SASTRA MATRICULATION HIGHER SECONDARY SCHOOL KARUNGALIKUPPAM, KILPENNATHUR, TIRUVANNAMALAI VOLUME-I

SASTRA MATRICULATION HIGHER SECONDARY SCHOOL KARUNGALIKUPPAM, KILPENNATHUR, TIRUVANNAMALAI VOLUME-I SASTRA MATRICULATION HIGHER SECONDARY SCHOOL KARUNGALIKUPPAM, KILPENNATHUR, TIRUVANNAMALAI 11 th COMPUTER SCIENCE VOLUME-I CHAPTER 1-5 COMPLETE NOTES [ Book Back Evaluation & Extra Q/A ] NAME CLASS : :

More information

Padasalai.net- Higher Secondary first Year. Quarterly exam answer key-2018 Max Marks : 70

Padasalai.net- Higher Secondary first Year. Quarterly exam answer key-2018 Max Marks : 70 i.ne ww.pai.n STD: 11 i.n i.ne i.n i.ne i.n i.ne Pai.net- Higher Secondary first Year COMPUTER Applications Time : 2.30 Hrs Quarterly exam answer key-2018 Max Marks : 70 N.Gunasekaran MCA., B.Ed PG Asst

More information

Padasalai s - VIRUDHUNAGAR DISTRICT COMMON FIRST MID TERM TEST, JULY 2018 STANDARD 11 COMPUTER APPLICATION

Padasalai s - VIRUDHUNAGAR DISTRICT COMMON FIRST MID TERM TEST, JULY 2018 STANDARD 11 COMPUTER APPLICATION Padasalai s - VIRUDHUNAGAR DISTRICT COMMON FIRST MID TERM TEST, JULY 2018 I. CHOOSE THE CORRECT ANSWER: 1. C. Power on Self Test 2. d. Optical character reader 3. b. 2 4. c. Peta 5. d. a and b 6. b. 111,

More information

Chapter 1. Computer System Organization

Chapter 1. Computer System Organization Chapter 1 Computer System Organization Prepared By: Manish Kumar Prajapati PGT (Comp.Sc.) (First Shift) Kendriya Vidyalaya Bailey Road Patna-14 What is Computer? A computer is an electronic device that

More information

Computer Concepts and C Programming. Unit I 06CCP13

Computer Concepts and C Programming. Unit I 06CCP13 Computer Concepts and C Programming () Unit I Unit Division Unit-I Introducing Computer Systems Interacting with Computer Unit-II Processing Data Storing Data Unit-III Using Operating Systems Networks

More information

Downloaded from

Downloaded from Chapter 1 Fundamental of Computer Inside this chapter : Brief history of computer, Basic components of computer, Different I/O Devices, Computer Language, Software definition and its types, Computer Memory,

More information

Q1. Briefly describe the characteristic features of input and output devices of a computer system.

Q1. Briefly describe the characteristic features of input and output devices of a computer system. Q1. Briefly describe the characteristic features of input and output devices of a computer system. Answer-> Characteristic of input and output devices of a computer system: Input Devices: An input device

More information

Input: is any data or instructions that are used by a computer.

Input: is any data or instructions that are used by a computer. 1 What is input? Input: is any data or instructions that are used by a computer. Input devices: are hardware used to translate words, sounds, images, and actions that people understand into a form that

More information

Parts are adapted from Windows 98 by Mark Twain Media, Inc. A Computer System has Hardware and Software

Parts are adapted from Windows 98 by Mark Twain Media, Inc. A Computer System has Hardware and Software Parts are adapted from Windows 98 by Mark Twain Media, Inc. A Computer System has Hardware and Software All the parts--monitor, printer, hard drive, etc.-- cables, cabinets, and programs that make a computer

More information

Sir Sadiq s computer notes for class IX. Chapter no 3. Input/Output Devices

Sir Sadiq s computer notes for class IX. Chapter no 3. Input/Output Devices 12 Q: What are Input Devices? Ans: Input Devices: Input devices are physical equipment that read or translate data consisting of alphabets, numbers or other symbols into electronic impulses, which can

More information

Identify Components of the. Motherboard

Identify Components of the. Motherboard Identify Components of the Chipset Motherboard Collection of chips that work together to provide the switching circuitry needed to move data throughout the computer 2013 Pearson Education, Inc. Publishing

More information

Chapter 1. Computer Fundamentals-I

Chapter 1. Computer Fundamentals-I 1. Input Devices: Chapter 1. Computer Fundamentals-I The devices which are used to input the data and the programs in the computer are known as "Input Devices" or Input device can read data and convert

More information

Chapter 2: Computers: The Machines Behind Computing.

Chapter 2: Computers: The Machines Behind Computing. Chapter 2: Computers: The Machines Behind Computing. TRUEFALSE 1. Computers perform all tasks using a combination of arithmetic and logical operations. 2. Fourth-generation languages (4GLs) are also called

More information

VOLUME-I [ UNIT I & II ] CHAPTER 1-8 [ COMPLETE BOOK BACK ONE MARKS ]

VOLUME-I [ UNIT I & II ] CHAPTER 1-8 [ COMPLETE BOOK BACK ONE MARKS ] 11 th COMPUTER SCIENCE VOLUME-I [ UNIT I & II ] CHAPTER 1-8 [ COMPLETE BOOK BACK ONE MARKS ] UNIT I FUNDAMENTALS OF COMPUTER AND WORKING WITH A TYPICAL OPERATING SYSTEMS (WINDOWS & LINUX) CHAPTER 1 INTRODUCTION

More information

Arithmetic/logic Unit (ALU)

Arithmetic/logic Unit (ALU) 3D Printer Arithmetic/logic Unit (ALU) Barcode Barcode Printer Barcode Reader Biometric Reader BIOS (Basic input/output system) Bit Bus Bus Interface Unit A printer that uses molten plastic during a series

More information

Intentionally Blank 0

Intentionally Blank 0 Intentionally Blank 0 Technology in Action Chapter 2 Looking at Computers: Understanding the Parts 1 Understanding Your Computer: Computers are Data Processing Devices Perform four major functions Input:

More information

What is the typical configuration of a computer sold today? 1-1

What is the typical configuration of a computer sold today? 1-1 What is the typical configuration of a computer sold today? 1-1 Computer Hardware Components In this chapter: How did the computer become known as the stored-program computer? Do they all have the same

More information

Dawood Public School Computer Studies Course Outline for Class VI. Course book- Right Byte 1 Fourth edition (Oxford University Press)

Dawood Public School Computer Studies Course Outline for Class VI. Course book- Right Byte 1 Fourth edition (Oxford University Press) Dawood Public School Computer Studies Course Outline for 2017-2018 Class VI Course book- Right Byte 1 Fourth edition (Oxford University Press) Month wise Distribution of Course Work August The Evolution

More information

INFORMATION SYSTEM PARTS AND COMPUTER TYPES

INFORMATION SYSTEM PARTS AND COMPUTER TYPES INFORMATION SYSTEM PARTS AND COMPUTER TYPES PARTS OF INFORMATION SYSTEM People are end users who use computers to make themselves more productive. Hardware refers to the physical components of your computer

More information

SECTION 2 (Part B) Types And Components Of Computer Systems. Sophia Pratzioti

SECTION 2 (Part B) Types And Components Of Computer Systems. Sophia Pratzioti SECTION 2 (Part B) Types And Components Of Computer Systems 2 Hardware & Software Hardware: is the physical parts of the computer system the part that you can touch and see. Hardware can be either external

More information

What is a computer Types of computers Computer Peripherals Role of Computers & ICT in development

What is a computer Types of computers Computer Peripherals Role of Computers & ICT in development What is a computer Types of computers Computer Peripherals Role of Computers & ICT in development A computer is an electronic device which accepts and processes data by following a set of instructions

More information

Microprocessors I MICROCOMPUTERS AND MICROPROCESSORS

Microprocessors I MICROCOMPUTERS AND MICROPROCESSORS Microprocessors I Outline of the Lecture Microcomputers and Microprocessors Evolution of Intel 80x86 Family Microprocessors Binary and Hexadecimal Number Systems MICROCOMPUTERS AND MICROPROCESSORS There

More information

Copyright 2012 Pearson Education, Inc. Publishing as Prentice Hall

Copyright 2012 Pearson Education, Inc. Publishing as Prentice Hall 1 Technology in Action Chapter 2 Looking at Computers: Understanding the Parts 2 Chapter Topics Functions of a computer Data versus information Bits and bytes Input devices Output devices Processing Storage

More information

Types of Data. PE 231 Education Media AND Technology. Information. Assessment. Information Concepts

Types of Data. PE 231 Education Media AND Technology. Information. Assessment. Information Concepts Types of Data Data Represented by PE 231 Education Media AND Technology Alphanumeric data Image data Audio data Numbers, letters, and other characters Graphic images or pictures Sound, noise, tones Video

More information

Name: Date: Hour: The abacus (still in use today) is about 5,000 years old. Not a computer.

Name: Date: Hour: The abacus (still in use today) is about 5,000 years old. Not a computer. Introduction to Computers - Intel: The Journey Inside Name: Date: Hour: Directions: Read/review each lesson and write your short answers on this paper. If there is a video available, watch it using headphones.

More information

Angel International School - Manipay 1 st Term Examination November, 2015 ICT

Angel International School - Manipay 1 st Term Examination November, 2015 ICT Grade 07 Angel International School - Manipay 1 st Term Examination November, 2015 ICT I. Underline the correct answer. Duration: 2 Hours Index No:- 1) Components of a computer CPU are (a) ALU, CU (b)

More information

Full file at

Full file at Exam Name Full file at https://fratstock.eu MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question. 1) is data that has been organized or presented in a meaningful

More information

Introduction to Computers. Computer Science Department 101COMP حال - 3 للكليات العلمية

Introduction to Computers. Computer Science Department 101COMP حال - 3 للكليات العلمية Introduction to Computers Computer Science Department 101COMP-3 101 حال - 3 للكليات العلمية )الطب, الهندسة, الحاسب, العلوم, ادارة األعمال, اللغة االنجليزية( 1 1.1 What is Computer? Computer is a programmable,

More information

Computer Fundamentals

Computer Fundamentals Computer Fundamentals Computers have made great inroads in our everyday life and thinking. They are put to use for all sorts of application ranging from complex calculations in the field or frontline research,

More information

KULLEĠĠ SAN BENEDITTU Secondary School, Kirkop

KULLEĠĠ SAN BENEDITTU Secondary School, Kirkop KULLEĠĠ SAN BENEDITTU Secondary School, Kirkop HALF YEARLY EXAMINATION 2016/2017 MARKING SCHEME Year 9 ICT TIME: 1h 30min Question 1 2 3 4 5 6 7 8 9 Global Mark Max. Mark 10 12 26 8 16 6 13 5 4 100 Mark

More information

v.m.g.rajasekaran ramani sri sarada sakthi mat. Hr. sec. school

v.m.g.rajasekaran ramani sri sarada sakthi mat. Hr. sec. school v.m.g.rajasekaran ramani sri sarada sakthi mat. Hr. sec. school STD: XI COMPUTER SCIENCE L.1. Introduction to computers 2 marks 1. What is a computer? Computer: A computer is an electronic machine, capable

More information

Computer Skills Revision. By: Rana Hammady

Computer Skills Revision. By: Rana Hammady Computer Skills Revision By: Rana Hammady 1 Chapter 1 2 Introduction to Computer and Information Technology Definitions Computer tasks Uses of computer system History of computers and computer generations

More information

Homeschool Enrichment. Input & Output

Homeschool Enrichment. Input & Output Homeschool Enrichment Input & Output Overview This chapter covers: Different types of keyboards and pointing devices Types of scanners, readers, and digital cameras What audio input is Types of display

More information

Computers Are Your Future

Computers Are Your Future Computers Are Your Future Twelfth Edition Chapter 2: Inside the System Unit Copyright 2012 Pearson Education, Inc. Publishing as Prentice Hall 1 Inside the Computer System Copyright 2012 Pearson Education,

More information

HIGHER SECONDARY FIRST YEAR 2 MARK & 5 MARK NOTES CHAPTER 1 1. INTRODUCTION TO COMPUTER

HIGHER SECONDARY FIRST YEAR 2 MARK & 5 MARK NOTES CHAPTER 1 1. INTRODUCTION TO COMPUTER 1. What is computer? CHAPTER 1 1. INTRODUCTION TO COMPUTER A computer is an electronic machine, capable of performing basic operations like addition, subtraction, multiplication, division, etc. The computer

More information

Ink Jet Printers The most common type of computer printer for the consumer market An ink jet printer places an image onto a piece of paper by

Ink Jet Printers The most common type of computer printer for the consumer market An ink jet printer places an image onto a piece of paper by PERIPHERAL DEVICES PRINTERS a printer is a peripheral which produces a text or graphics of documents stored in electronic form into a physical print media such as paper or transparencies. Printer quality

More information

Bulbul NUB 1. Outline. Week # 02. Standard Input & Output Devices. Input Device 6/3/2018

Bulbul NUB 1. Outline. Week # 02. Standard Input & Output Devices. Input Device 6/3/2018 Standard Input & Output Devices June 3, 2018 Week # 02 Course: Introduction to Computers Course Code: CIT1101 Presented by: Bulbul Ahamed Assistant Professor of CSE, NUB Bulbul Ahamed 1 Definition of Input

More information

Input output and memory devices

Input output and memory devices Input output and memory devices One marks 1. What is cache memory The very high speed memory present between CPU and RAM 2. Expand the term OCR Optical Character Recognition (Recognizer) 3. Expand the

More information

ST. MARY S COLLEGE FORM 4

ST. MARY S COLLEGE FORM 4 Term 1 Week 1 Week 2 FUNDAMENTALS OF HARDWARE AND SOFTWARE 1. The generalpurpose computer system 2. Functions of the major hardware components of a computer system 3. Functions and uses of primary storage

More information

True/False Indicate whether the statement is true or false. Bubble A for True and B for False

True/False Indicate whether the statement is true or false. Bubble A for True and B for False 1A Name _ Midterm Review Part 1 Lesson 1 and 2 True/False Indicate whether the statement is true or false. Bubble A for True and B for False 1. A computer is an electronic device that receives data (input),

More information

True/False Indicate whether the statement is true or false. Bubble A for True and B for False

True/False Indicate whether the statement is true or false. Bubble A for True and B for False 1 Name Midterm Review Part 1 Lesson 1 and 2 "B" True/False Indicate whether the statement is true or false. Bubble A for True and B for False 1. Eight bits are equal to one byte. 2. A computer is an electronic

More information

Overview of a computer

Overview of a computer Overview of a computer One marks 1. What is von Neumann concept also called as? Stored memory or stored program concept. 2. Who is the father of computer Charles Babbage 3. What is a computer? It is an

More information

Computer Systems. Communication (networks, radio links) Meatware (people, users don t forget them)

Computer Systems. Communication (networks, radio links) Meatware (people, users don t forget them) Computers are useful machines, but they are generally useless by themselves. Computers are usually part of a system a computer system includes: Hardware (machines) Software (programs, applications) Communication

More information

Parts of Computer hardware Software

Parts of Computer hardware Software Parts of Computer Parts of Computer If you use a desktop computer, you might already know that there is not any single part called the "computer." A computer is really a system of many parts working together.

More information

Zimmer CSCI /24/18. CHAPTER 1 Overview. COMPUTER Programmable devices that can store, retrieve, and process data.

Zimmer CSCI /24/18. CHAPTER 1 Overview. COMPUTER Programmable devices that can store, retrieve, and process data. CHAPTER 1 Overview COMPUTER Programmable devices that can store, retrieve, and process data. COMPUTER DEVELOPMENTS- Smaller size - processors (vacuum tubes -> transistors ->IC chip) Microprocessor - miniaturized

More information

Aryan College. Computer Fundamental. Introduction to Computer System

Aryan College. Computer Fundamental. Introduction to Computer System Computer Fundamental Unit 1 Introduction to Computer System 1. List various characteristics of computer. (2017) 2. Give name of two super computers. (2017) 3. What do you mean by system software? (2017)

More information

(A Book on Computer Education)

(A Book on Computer Education) (A Book on Computer Education) (Class-IV) Publication Division D.A.V. COLLEGE MANAGING COMMITTEE Arya Samaj Building, UP Block, Pitampura, Delhi-110034 S.NO. TOPIC PAGE NO. 1. Working of Computer System

More information

An Overview of the Computer System. Kafui A. Prebbie 24

An Overview of the Computer System. Kafui A. Prebbie 24 An Overview of the Computer System Kafui A. Prebbie -kafui@kafui.com 24 The Parts of a Computer System What is a Computer? Hardware Software Data Users Kafui A. Prebbie -kafui@kafui.com 25 The Parts of

More information

Input and Output Devices

Input and Output Devices Input and Output Devices PRINTER A computer peripheral that puts text or a computer generated image on paper or on another medium, such as a transparency. Printer can be categorized in several ways the

More information

Chapter One. Introduction to Computer System

Chapter One. Introduction to Computer System Principles of Programming-I / 131101 Prepared by: Dr. Bahjat Qazzaz -------------------------------------------------------------------------------------------- Chapter One Introduction to Computer System

More information

Information Communications Technology (CE-ICT) 6 th Class

Information Communications Technology (CE-ICT) 6 th Class Information Communications Technology (CE-ICT) 6 th Class Lecture 2: Computer Concepts (Part A) Lecturer: Objectives Hardware Concepts Types of Computer Components of a Computer System Computer Performance

More information

HIGHER SECONDARY QUARTERLY EXAMINATION TH COMPUTER SCIENCE ANSWER KEY (CUDDALORE DIST.)

HIGHER SECONDARY QUARTERLY EXAMINATION TH COMPUTER SCIENCE ANSWER KEY (CUDDALORE DIST.) HIGHER SECONDARY QUARTERLY EXAMINATION 2018-19 11 TH COMPUTER SCIENCE ANSWER KEY (CUDDALORE DIST.) 1-MARKS (Section I) Q.NO 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ANS B B C A C C C B A C A A B A B 2-MARKS

More information

LECTURE SCHEDULE 2. Units of Memory, Hardware, Software and Classification of Computers

LECTURE SCHEDULE 2. Units of Memory, Hardware, Software and Classification of Computers LECTURE SCHEDULE 2 Units of Memory, Hardware, Software and Classification of Computers Units of Memory The memory unit is the principal storage of the computer. All the data and instructions that the computer

More information

UNIQUE IAS ACADEMY-COMPUTER QUIZ-11

UNIQUE IAS ACADEMY-COMPUTER QUIZ-11 1. Which of the following functions most like a copy machine: a) Portable Scanner b) Flatbed Scanner c) Touch Screen 2. A universal product code is read by what type of scanner: a) Bar - Code b) Flatbed

More information

Sahalsoftware college. Welcome To understanding Basic Computer Concept

Sahalsoftware college. Welcome To understanding Basic Computer Concept Welcome To understanding Basic Computer Concept 1 Chapter1: Understanding Computer Concepts What is a computer? A computer is a machine that takes in data, processes if following a set of instructions

More information

Components of a personal computer

Components of a personal computer Components of a personal computer Computer systems ranging from a controller in a microwave oven to a large supercomputer contain components providing five functions. A typical personal computer has hard,

More information

CMSC 1513 Lecture 1.2

CMSC 1513 Lecture 1.2 Key Point: A computer is an electronic device that stores and processes data. Hardware Software Hardware comprises the visible, physical elements of the computer. Software provides the invisible instructions

More information

What is Output? p Fig. 6-1 Next

What is Output? p Fig. 6-1 Next Output What is Output? What is output? Data that has been processed into a useful form, called information Output device is any hardware component that can convey information to user p. 6.06 Fig. 6-1 Next

More information

C H A P T E R 1. Introduction to Computers and Programming

C H A P T E R 1. Introduction to Computers and Programming C H A P T E R 1 Introduction to Computers and Programming Topics Introduction Hardware and Software How Computers Store Data How a Program Works Using Python Computer Uses What do students use computers

More information

INTRODUCTION TO COMPUTERS

INTRODUCTION TO COMPUTERS INTRODUCTION TO COMPUTERS When we talk about computers, we really are talking about a Computer System. Computer System: It is a combination of Hardware and Software. This combination allows a computer

More information

- Input hardware - Processing hardware - Storage hardware

- Input hardware - Processing hardware - Storage hardware INTRODUCTION TO COMPUTER HARDWARE A Computer system can be broadly classified in to four parts namely: - Input hardware - Processing hardware - Storage hardware - Output hardware A computer is only useful

More information

Programming Principles and Techniques

Programming Principles and Techniques Aptech Ltd Version 1.0 Page 1 of 11 Table of Contents Aptech Ltd Version 1.0 Page 2 of 11 Application Software Assembler American Standard Code for Information Interchange Arithmetic Logic Unit (ALU) Algorithm

More information

Dec Hex Bin ORG ; ZERO. Introduction To Computing

Dec Hex Bin ORG ; ZERO. Introduction To Computing Dec Hex Bin 0 0 00000000 ORG ; ZERO Introduction To Computing OBJECTIVES this chapter enables the student to: Convert any number from base 2, base 10, or base 16 to any of the other two bases. Add and

More information

CC411: Introduction To Microprocessors

CC411: Introduction To Microprocessors CC411: Introduction To Microprocessors OBJECTIVES this chapter enables the student to: Use number { base 2, base 10, or base 16 }. Add and subtract binary/hex numbers. Represent any binary number in 2

More information

5. a computer which CPU speed around 100 million instruction per second and with the word length of around 64 bits is known as

5. a computer which CPU speed around 100 million instruction per second and with the word length of around 64 bits is known as 1. To locate a data item for storage is a. Field b. Feed c. Database d. Fetch 2. programs designed to perform specific tasks is known as a. system software b. application software c. utility programs d.

More information

Dawood Public School Course Outline Computer Studies Class VI

Dawood Public School Course Outline Computer Studies Class VI Dawood Public School Course Outline 2016-17 Computer Studies Class VI Month August September October November The evolution of computers The evolution of computers Spreadsheet Input devices December Mid-Year

More information

Computer Hardware. Lect 3: Input / System Unit/Output & Storage

Computer Hardware. Lect 3: Input / System Unit/Output & Storage Computer Hardware Lect 3: Input / System Unit/Output & Storage 1 Input Devices: Giving Commands Input is any data or instructions that are entered into a computer. An input device is a type of hardware

More information

Computers Are Your Future

Computers Are Your Future Computers Are Your Future 2006 Prentice-Hall, Inc. Computers Are Your Future Chapter 7 Input/Output and Storage 2006 Prentice-Hall, Inc Slide 2 Input Input is any data entered into the computer s memory

More information

Chapter Three. Hardware Basics: Peripherals

Chapter Three. Hardware Basics: Peripherals Chapter Three Hardware Basics: Peripherals After reading this chapter, you should be able to: List examples of input devices and explain how they can make it easier to get different types of information

More information

Information Technology Training Package ICA99

Information Technology Training Package ICA99 The Components of a Computer System The basic components of the computer have not varied since the earliest computers were made in the early 1950 s. The only real changes have been in the number and variety

More information

PARTS OF THE COMPUTER. 2nd ESO IES CAP DE LLEVANT

PARTS OF THE COMPUTER. 2nd ESO IES CAP DE LLEVANT PARTS OF THE COMPUTER 2nd ESO IES CAP DE LLEVANT 1. COMPUTING OR INFORMATION TECHNOLOGY The branch of engineering science that studies (with the aid of computers)the procedure of calculating and information

More information

2011 Francisco Delgadillo

2011 Francisco Delgadillo 1800 s: Analytical Engine Charles Babbage Dawn of Human Concept of Numbers Abacus 1642: Pascal s Machine 1880: Mechanical Tabulator Herman Hollerith 1674: Leibniz Calculating Machine 1911: Hollerith s

More information

Computer ANAMIKA ACADEMY. Mo Which function has the ability to move from one web page to another Hyper link

Computer ANAMIKA ACADEMY. Mo Which function has the ability to move from one web page to another Hyper link 1. Which function has the ability to move from one web page to another Hyper link web page? 2. What is the full name of GUI? GRAPHICAL USER INTERFACE 3. Which function keys are used to make spell and mild

More information

1.The First Instrument known in the history of computers was. a) Pascal s adding machine b) Napier s bones c) Abacus d) Analytical Engine

1.The First Instrument known in the history of computers was. a) Pascal s adding machine b) Napier s bones c) Abacus d) Analytical Engine Quiz Questions 1.The First Instrument known in the history of computers was. a) Pascal s adding machine b) Napier s bones c) Abacus d) Analytical Engine 5/1/2006 Computer Programming TA 103 BE I year 2

More information

SYLLABUS. Subject Information B.B.A. I SEM Technology

SYLLABUS. Subject Information B.B.A. I SEM Technology SYLLABUS Subject Information B.B.A. I SEM Technology UNIT I UNIT II UNIT III UNIT IV UNIT V UNIT VI UNIT VII Introduction to Computer Hardware: Input / Output devices, storage devices and memory. Software:

More information

Ch. 1: Computer System part I

Ch. 1: Computer System part I Chapter 1 Computer System Ch. 1: Computer System part I Benjamas Panyangam 2013 Revision by Suphakit Awiphan Ph.D. Adapted for English Section by Kittipitch Kuptavanich And Prakarn Unachak Computer Classification

More information

Chapter 1 Basic Computer Organization

Chapter 1 Basic Computer Organization Chapter 1 Basic Computer Organization Course Outcome (CO) CO1 Explain the basic principles of modern computer systems organization Program Outcome (PO) PO1 Apply knowledge of mathematics, science and engineering

More information

COMPUTER SYSTEMS. Section 1

COMPUTER SYSTEMS. Section 1 COMPUTER SYSTEMS Section 1 BITS AND BYTES In order for information to flow through a computer system and be in a form suitable for processing, all symbols, pictures, or words must be reduced to a string

More information

Characteristics of Computers

Characteristics of Computers The word computer comes from word compute, which means to calculate. A computer is a programmable machine (or more precisely, a programmable sequential state machine) that operates on data and is used

More information

4) Apple's OS X and Microsoft Windows are examples of software. A) utility B) application C) operating system D) communication

4) Apple's OS X and Microsoft Windows are examples of software. A) utility B) application C) operating system D) communication Technology in Action Complete, 13e (Evans et al.) Chapter 2 Looking at Computers: Understanding the Parts 1) Computers use language consisting of 0s and 1s. A) symbol B) binary C) byte D) system 2) In

More information

Introduction to Computers

Introduction to Computers Introduction to Computers Considers: Definition of computer Computer system devices Central Processing Unit Introduction to software What Is A Computer? A computer is an electronic device, operating under

More information

Fundamental of digital computer

Fundamental of digital computer Introduction to computer:- Fundamental of digital computer A computer is an electronic device that has the ability to accept data, store data, perform mathematical and logical operations, and report the

More information

Introduction to Computers. Joslyn A. Smith

Introduction to Computers. Joslyn A. Smith Introduction to Computers Joslyn A. Smith March 9, 2010 5/18/2011 1 What is a Computer? An electronic device that has the capability of performing the following tasks: Responds to input. Processes the

More information

Memory Addressing, Binary, and Hexadecimal Review

Memory Addressing, Binary, and Hexadecimal Review C++ By A EXAMPLE Memory Addressing, Binary, and Hexadecimal Review You do not have to understand the concepts in this appendix to become well-versed in C++. You can master C++, however, only if you spend

More information

Computer is an electronic machine that can receive, store, transform and output data of all kinds (image, text, numeric, graphics and sound).

Computer is an electronic machine that can receive, store, transform and output data of all kinds (image, text, numeric, graphics and sound). ELECTRONIC COMPUTERS THEN AND NOW Computer is an electronic machine that can receive, store, transform and output data of all kinds (image, text, numeric, graphics and sound). In the Past (i.e., during

More information

Computers Are Your Future Prentice-Hall, Inc.

Computers Are Your Future Prentice-Hall, Inc. Computers Are Your Future 2006 Prentice-Hall, Inc. Computers Are Your Future Chapter 7 Input/Output and Storage 2006 Prentice-Hall, Inc Slide 2 What You Will Learn About ü The purpose of special keys and

More information

SSRVM Content Creation Template

SSRVM Content Creation Template SSRVM Content Creation Template Title: Evolution of Computers Contributors: Sreeja. T Std: IV Submission Date: Reviewers: Approval Date: REF No: Brief Description: Goal: Brief History which reveals a clear

More information

1.2.1 Electronic computers based on digital switching

1.2.1 Electronic computers based on digital switching 1.2.1 Electronic computers based on digital switching The first true digital electronic computer was created by John V Atanasoff during 1937-1942. The Atanasoff-Berry Computer (called ABC figure 2.8) was

More information

CREATED BY M BILAL & Arslan Ahmad Shaad Visit:

CREATED BY M BILAL & Arslan Ahmad Shaad Visit: CREATED BY M BILAL & Arslan Ahmad Shaad Visit: www.techo786.wordpress.com Q1: Define microprocessor? Short Questions Chapter No 01 Fundamental Concepts Microprocessor is a program-controlled and semiconductor

More information

1 Anatomy of a Digital Computer

1 Anatomy of a Digital Computer 1 Anatomy of a Digital Computer 1.1 Introduction We should keep in mind that a computer is a programmable machine. The two main characteristics of a computer are: (i) it responds to a specific set of instructions

More information

BUYING A COMPUTER TERM 2 AIT

BUYING A COMPUTER TERM 2 AIT BUYING A COMPUTER TERM 2 AIT HARDWARE COMPONENTS AND FUNCTIONS describe the components of a multimedia computer system processing (central processing unit) input devices e.g. mouse, keyboard output devices

More information

COMPUTERIZED OFFICE MANAGEMENT

COMPUTERIZED OFFICE MANAGEMENT COMPUTERIZED OFFICE MANAGEMENT Module 1 (COMPUTER FUNDAMENTALS) COMPUTER FUNDAMENTALS : INTRODUCTION : The term computer is derived from the Latin word compute which means to calculate. Computer is a fast

More information

COMPUTER HARDWARE RAYMOND ROSE

COMPUTER HARDWARE RAYMOND ROSE COMPUTER HARDWARE RAYMOND ROSE LEARNING OUTCOMES 1.1 Identify types of computer how they process information, and the purpose and function of different hardware components. Understanding the computer and

More information

ELEG3923 Microprocessor Ch.0 & Ch.1 Introduction to Microcontroller

ELEG3923 Microprocessor Ch.0 & Ch.1 Introduction to Microcontroller Department of Electrical Engineering University of Arkansas ELEG3923 Microprocessor Ch. & Ch. Introduction to Microcontroller Dr. Jingxian Wu wuj@uark.edu OUTLINE 2 What is microcontroller? (Ch..) 85 Microcontroller

More information

DIGITAL SYSTEM DESIGN

DIGITAL SYSTEM DESIGN DIGITAL SYSTEM DESIGN UNIT I: Introduction to Number Systems and Boolean Algebra Digital and Analog Basic Concepts, Some history of Digital Systems-Introduction to number systems, Binary numbers, Number

More information

1. This memory is for short term storage and is lost when the computer is turned off. A. Icon B. CPU C. Hard drive D. RAM 2. This input device will

1. This memory is for short term storage and is lost when the computer is turned off. A. Icon B. CPU C. Hard drive D. RAM 2. This input device will 1. This memory is for short term storage and is lost when the computer is turned off. A. Icon B. CPU C. Hard drive D. RAM 2. This input device will allow the user to move the pointer on the screen. A.

More information