Full Transcript

Principles of Programming using C Course Code: BPOPS103/203 CIE Marks:50 Course Type SEE Marks:50 Integrated...

Principles of Programming using C Course Code: BPOPS103/203 CIE Marks:50 Course Type SEE Marks:50 Integrated (Theory/Practical/Integrated) Total marks:100 Teaching Hours/Week 2:0:2 Exam Hours (L:T:P: S) 3+2 Total Hours of Pedagogy 40 hours Credits 03 Module-1 (6 Hours of Pedagogy) Introduction to C: Introduction to computers, input and output devices, designing efficient programs. Introduction to C, Structure of C program, Files used in a C program, Compilers, Compiling and executing C programs, variables, constants, Input/output statements in C, Textbook: 1. Computer fundamentals and programming in c, “Reema Thareja”, Oxford University, Second edition, 2017. Chapter 1 Introduction to Computers Takeaways: Characteristics of computers Digital computers Stored program concept Generations of computers Types of computers Applications of computers Basic organization of a computer Chapter 1 Introduction to Computers 1.1 COMPUTER A computer, in simple terms, can be defined as an electronic device that is designed to accept data, perform the required mathematical and logical operations at high speed, and output the result. We all have seen computers in our homes, schools, and colleges. In fact, in today’s scenario, we find computers in most aspects of our daily lives. For some of us, it is hard to even imagine a world without them. In the past, computers were extremely large in size and often required an entire room for installation. These computers consumed enormous amounts of power and were too expensive to be used for commercial applications. Therefore, they were used only for limited tasks, such as computing trajectories for astronomical or military applications. However, with technological advancements, the size of computers became smaller and their energy requirements reduced immensely. This opened the way for adoption of computers for commercial purposes. 1.2 CHARACTERISTICS OF COMPUTERS These days, computers have become a crucial part of our everyday lives, and we need computers just like we need televisions, telephones, or other electronic devices at home. Computers are basically meant to solve problems quickly and accurately. The important characteristics of a computer are discussed in the following text. Speed Computers can perform millions of operations per second, which means that data that may otherwise take many hours to process is output as information in the blink of an eye. The speed of computers is usually given in nanoseconds and picoseconds, where 1 nanosecond = 1 × 10 −9 seconds and 1 picosecond = 1 × 10 −12 seconds. Accuracy: A computer is a very fast, reliable, and robust electronic device. It always gives accurate results, provided the correct data and set of instructions are input to it. Hence, in the event of an error, it is the user who has fed the incorrect data/program is responsible. This clearly means that the output generated by a computer depends on the given instructions and input data. If the input data is wrong, then the output will also be erroneous. In computer terminology, this is known as garbage-in, garbage-out (GIGO). Automation: Besides being very fast and accurate, computers are automatable devices that can perform a task without any user intervention. The user just needs to assign the task to the computer, after which it automatically controls different devices attached to it and executes the program instructions. Diligence: Unlike humans, computers never get tired of a repetitive task. It can continually work for hours without creating errors. Even if many executions need to be executed, each execution requires the same duration, and is executed with the same accuracy. Versatile: Versatility is the quality of being flexible. Today, computers are used in our daily life in different fields. For example, they are used as personal computers (PCs) for home use, for business- oriented tasks, weather forecasting, space exploration, teaching, railways, banking, medicine, and so on, indicating that computers can perform different tasks simultaneously. On the PC that you use at home, you CSE dept. VIT,Bangalore may play a game, compose, and send e-mails, listen to music, etc. Therefore, computers are versatile devices as they can perform multiple tasks of different nature at the same time. Memory: Like humans, computers also have memory. Just the way we cannot store everything in our memory and need secondary media, such as a notebook, to record certain important things, computers also have internal or primary memory (storage space) as well as external or secondary memory. While the internal memory of computers is very expensive and limited in size, secondary storage is cheaper and of bigger capacity. The computer stores a large amount of data and programs in the secondary storage space. The stored data and programs can be retrieved and used whenever required. Secondary memory is the key for data storage. Some examples of secondary devices include floppy disks, optical disks (CDs and DVDs), hard disk drives (HDDs), and pen drives. No IQ: Although the trend today is to make computers intelligent by inducing artificial intelligence (AI) in them, they still do not have any decision-making abilities of their own. They need guidance to perform various tasks. Economical: Today, computers are considered as short-term investments for achieving long-term gains. Using computers also reduces manpower requirements and leads to an elegant and efficient way of performing various tasks. Hence, computers save time, energy, and money. When compared to other systems, computers can do more work in less time. 1.3 STORED PROGRAM CONCEPT All digital computers are based on the principle of stored program concept, which was introduced by Sir John von Neumann in the late 1940s. The following are the key characteristic features of this concept: Before any data is processed, instructions are read into memory. Instructions are stored in the computer’s memory for execution. Instructions are stored in binary form (using binary numbers—only 0s and 1s). Processing starts with the first instruction in the program, which is copied into a control unit circuit. The control unit executes the instructions. CSE dept. VIT,Bangalore Instructions written by the users are performed sequentially until there is a break in the current flow. Input/Output and processing operations are performed simultaneously. While data is being read/written, the central processing unit (CPU) executes another program in the memory that is ready for execution. Figure 1.2: Von Neumann architecture (a) Shared memory for instructions and data (b) Separate memories for instructions and data A computer with a Von Neumann architecture stores data and instructions in the same memory. There is a serial machine in which data and instructions are selected one at a time. Data and instructions are transferred to and from memory through a shared data bus. Since there is a single bus to carry data and instructions, process execution becomes slower. 1.4 HISTORY OF COMPUTERS Early computers were designed not for entertainment but for solving number-crunching problems. These computers were punch-card based computers that took up entire rooms. Today, our smartphones have much more computing power than was available in those early computers. In this section, we will read about the history of computers way back from the invention of abacus and lookat the remarkable achievements in computing technology till the current time. Timeline of Developments 300 BC: The abacus was an early aid for mathematical computations and was designed to aid human memory while performing calculations. A skilled abacus operator can add and subtract with the same speed as that of a person performing the same calculation using a hand calculator. The invention of abacus is often wrongly attributed to China. It was used by the Babylonians even in 300 BC and is still in use today (in the Far East). CSE dept. VIT,Bangalore 1822: English mathematician Charles Babbage designed a steam-driven calculating machine that could compute tables of numbers. Though the project failed as he could not complete the construction of the engine, it laid the foundation for the first computer. 1890: Herman Hollerith, an American inventor, designed a punched card system to calculate the 1880 census. The system completed the task in three years saving the US government $5 million. Later Herman established a company that we today know as IBM. 1936: British mathematician Alan Turing introduced a universal machine called the Turing machine capable of computing anything that is computable. The central concept of the modern computer is based on this machine. 1941: John Vincent Atanasoff, a Bulgarian-American physicist, and his graduate student, Clifford Berry, at Iowa State College designed Atanasoff–Berry computer (ABC) that could solve 29 equations simultaneously. It was the first time a computer could store information in its main memory. 1943–1944: John W. Mauchly and J. Presper Eckert built the Electronic Numerical Integrator and Calculator (ENIAC), which is considered the grandfather of digital computers. It filled a 20 × 40 feet room and had 18,000 vacuum tubes. 1946: Mauchly and Presper designed UNIVAC, which was the first commercial computer for business and government applications. 1947: William Shockley, John Bardeen, and Walter Brattain of Bell Laboratories invented the transistor. Soon vacuum tubes in computers were replaced by transistors. 1953: Grace Hopper developed the first computer language COBOL. 1954: The FORTRAN programming language was developed. 1958: Jack Kilby of Texas Instruments and Robert Noyce at Fairchild Semiconductor Corporation separately invented integrated circuit, which is commonly known as the computer chip. 1964: Douglas Engelbart developed a prototype of the modern computer, with a mouse and a graphical user interface (GUI). This was a remarkable achievement as it shifted computers from a specialized machine for scientists and mathematicians to the public. 1969: Unix operating system was developed at Bell Labs. It was written in the C programming language and was designed to be portable across multiple platforms. Soon it became the operating system of choice among mainframes at large companies and government entities. 1970: DRAM chips were introduced by Intel. 1971: Alan Shugart with his team in IBM invented the floppy disk which allowed data to be shared among computers. 1973: Robert Metcalfe, a research member at Xerox, developed Ethernet for connecting multiple computers and other hardware. 1974–1977: Personal computers started becoming popular. 1975: Paul Allen and Bill Gates started writing software for the Altair 8800 using the new BASIC language. On April 4, they both formed their own software company, Microsoft. 1976: Steve Jobs and Steve Wozniak started Apple Computers and developed Apple I, the fi rst computer with a single-circuit board. CSE dept. VIT,Bangalore 1977: Apple II was launched that offered colour graphics and incorporated an audio cassette drive for storage. 1978: WordStar, a word processor application, was released by MicroPro International. 1979: VisiCalc, the first computerized spreadsheet program for personal computers, was unveiled. 1981: The fir s t IBM personal computer was introduced that used Microsoft’s MS-DOS operating system. The term PC was popularized. 1983: The first laptop was introduced. Moreover, Apple introduced Lisa as the first personal computer with a GUI with drop-down menus and icons. 1985: Microsoft announced Windows as a new operating system. 1986: Compaq introduced Deskpro 386 in the market, which was a 32-bit architecture machine that provides speed comparable to mainframes. 1990: Tim Berners-Lee invented the World Wide Web with HTML as its publishing language. 1993: The Pentium microprocessor introduced the use of graphics and music on PCs. 1994: PC games became popular. 1996: Sergey Brin and Larry Page developed the Google search engine at Stanford University. 1999: The term Wi-Fi was introduced when users started connecting to the Internet without wires. 2001: Apple introduced Mac OS X operating system, which had protected memory architecture and pre- emptive multi-tasking, among other benefits. To stay competitive, Microsoft launched Windows XP. 2003: The first 64-bit processor, AMD’s Athlon 64, was brought into the consumer market. 2004: Mozilla released Firefox 1.0 and in the same year Facebook, a social networking site, was launched. 2005: YouTube, a video sharing service, was launched. In the same year, Google acquired Android, a Linux-based mobile phone operating system. 2006: Apple introduced MacBook Pro, its first Intel based, dual-core mobile computer. 2007: Apple released iPhone, which brought many computer functions to the smartphone. 2009: Microsoft launched Windows 7 in which users could pin applications to the taskbar. 2010: Apple launched iPad, which revived the tablet computer segment. 2011: Google introduced Chrome book, a laptop that runs on the Google Chrome operating system. 2015: Apple released the Apple Watch. In the same year, Microsoft launched Windows 10. After reading these interesting developments in computing technology, let us also understand the evolution of computers through different generations. First Generation (1942–1955) Hardware Technology First generation computers were manufactured using thousands of vacuum tubes (see Figure 1.3); a vacuum tube is a device made of fragile glass. Memory Electromagnetic relay was used as primary memory and punched cards were used to store data and instructions. Software Technology Programming was done in machine or assembly language. Used for Scientific applications. CSE dept. VIT,Bangalore Examples ENIAC, EDVAC, EDSAC, UNIVAC I, IBM 701 Highlights They were the fastest calculating device of those times. The computers were too bulky and required a complete room for storage. Highly unreliable as vacuum tubes emitted a large amount of heat and burnt frequently. Required air-conditioned rooms for installation. Costly Difficult to use. Required constant maintenance because vacuum tubes used fi laments that had limited lifet i m e.Therefore, these computers were prone to frequent hardware failures. Figure 1.3 Vacuum tube Second Generation (1955–1964) CSE dept. VIT,Bangalore Hardware Technology Second generation computers were manufactured using transistors (see Figure 1.4). Transistors were reliable, powerful, cheaper, smaller, and cooler than vacuum tubes. Memory Magnetic core memory was used as primary memory; magnetic tapes and magnetic disks were used to store data and instructions. These computers had faster and larger memory than the fi rst generation computers. Software Technology Programming was done in high level programming languages. Batch operating system was used. Used for Scientific and commercial applications. Examples Honeywell 400, IBM 7030, CDC 1604, UNIVAC LARC Highlights Faster, smaller, cheaper, reliable, and easier to use than the first-generation computers. They consumed1/10th the power consumed by first generation computers. Bulky in size and required a complete room for its installation. Dissipated less heat than fi rst generation computers but still required air-conditioned rooms. Costly Difficult to use. Figure 1.4 Transistors Third Generation (1975-1989) Hardware Technology Third generation computers were manufactured using integrated chips (ICs) (shown in Figure 1.5). ICs consist of several components such as transistors, capacitors, and resistors on a single chip to avoid wired interconnections between components. These computers used SSI and MSI technology. Minicomputers came into existence. Note- Initially, ICs contained 10–20 components. This technology was called Small Scale Integration (SSI). Later, it was enhanced to contain about 100 components. This was called MSI (Medium Scale Integration). Memory Larger magnetic core memory was used as primary memory; larger capacity magnetic tapes and magnetic disks were used to store data and instructions. Software Technology Programming was done in high level programming languages such as FORTRAN, COBOL, Pascal, and BASIC. Time sharing operating system was used. Software was separated from the hardware. This allowed users to invest only in the software they need. Used for Scientific, commercial, and interactive online applications. Examples IBM 360/370, PDP-8, PADP-11, CDC6600 Highlights Faster, smaller, cheaper, reliable, and easier to use than the second-generation computers. CSE dept. VIT,Bangalore They consume less power than second generation computers. Bulky in size and required a complete room for installation. Dissipated less heat than second generation computers but still required air-conditioned rooms. Costly Easier to use and upgrade. Figure 1.5 Integrated Circuits Fourth Generation (1975–1989) Hardware Technology Fourth generation computers were manufactured using ICs with LSI (Large Scale Integrated) and later with VLSI technology (Very Large-Scale Integration). Microcomputers came into existence. The use of personal computers became widespread. High speed computer networks in the form of LANs, WANs, and MANs started growing. Besides mainframes, supercomputers were also used. Memory Semiconductor memory was used as primary memory, large capacity magnetic disks were used as built-in secondary memory. Magnetic tapes and floppy disks were used as portable storage devices. Software Technology Programming was done in high level programming languages such as C and C++. Graphical User Interface (GUI) based operating system (e.g., Windows) was introduced. It had icons and menus among other features to allow computers to be used as a general-purpose machine by all users. UNIX was also introduced as an open-source operating system. Apple Mac OS and MS DOS were also released during this period. All these operating systems had multi-processing and multiprogramming capabilities. Used for Scientific, commercial, interactive online, and network applications. Examples IBM PC, Apple II, TRS-80, VAX 9000, CRAY-1, CRAY-2, CRAY-X/MP CSE dept. VIT,Bangalore Figure 1.6: VLSI Chip CSE dept. VIT,Bangalore FIFITH GENERATION (1989-PRESENT) Hardware Technology Fifth generation computers are manufactured using ICs with ULSI Ultra Large Scale Integrated) technology. The use of the Internet became widespread and very powerful mainframes, desktops, portable laptops, and smartphones are being used commonly. Supercomputers use parallel processing techniques. Memory Semiconductor memory is used as primary memory; large capacity magnetic disks are used as built-in secondary memory. Magnetic tapes and floppy disks were used as portable storage devices, which have now been replaced by optical disks and USB flash drives. Software Technology Programming is done in high-level programming languages such as Java, Python, and C#. Graphical User Interface (GUI)-based operating systems such as Windows, Unix, Linux, Ubuntu, and Apple Mac are being used. These operating systems are more powerful and user friendly than the ones available in previous generations. Used for Scientific, commercial, interactive online, multimedia (graphics, audio, video), and network applications. Examples IBM notebooks, Pentium PCs, SUM workstations, IBM SP/2, Param supercomputer. Highlights Faster, smaller, cheaper, powerful, reliable, and easier to use than the previous generation computers. The speed of microprocessors and the size of memory are growing rapidly. Figure 1.7: ULSI Chip 1.5 CLASSIFICATION OF COMPUTERS Computers can be broadly classified into four categories based on their speed, amount of data that they can process and price (refer to Figure 1.8). These categories are as follows: Supercomputers Mainframe computers Minicomputers CSE dept. VIT,Bangalore Microcomputers Figure 1.8: Classification of Computers 1.5.1 Supercomputers Among the four categories, the supercomputer is the fastest, most powerful, and most expensive computer. Supercomputers were first developed in the 1980s to process large amounts of data and to solve complex scientific problems. Supercomputers use parallel processing technology and can perform more than one trillion calculations in a second. 1.5.2 Mainframe Computers Mainframe computers are large-scale computers (but smaller than supercomputers). These are very expensive and need a very large clean room with air conditioning, thereby making them very costly to deploy. As with supercomputers, mainframes can also support multiple processors. For example, the IBM S/390 mainframe can support 50,000 users at the same time. Users can access mainframes by either using terminals or via PCs. The two types of terminals that can be used with mainframe systems are as follows: Dumb Terminals Dumb terminals consist of only a monitor and a keyboard (or mouse). They do not have their own CPU and memory and use the mainframe system’s CPU and storage devices. Intelligent Terminals In contrast to dumb terminals, intelligent terminals have their own processor and thus can perform some processing operations. However, just like the dumb terminals, they do not have their own storage space. Usually, PCs are used as intelligent terminals to facilitate data access and other services from the mainframe system. Mainframe computers are typically used as servers on the World Wide Web. They are also used in organizations such as banks, airline companies, and universities, where a large number of users frequently access the data stored in their databases. IBM is the major manufacturer of mainframe computers. Some examples of mainframe computers include IBM S/390, Control Data CYBER 176, and Amdahl 580. 1.5.3 Minicomputers As the name suggests, minicomputers are smaller, cheaper, and slower than mainframes. They are called minicomputers because they were the smallest computer of their times. Also known as midrange computers, the capabilities of minicomputers fall between mainframe and personal computers. 1.5.4 Microcomputers Microcomputers, commonly known as PCs, are very small and cheap. The first microcomputer was designed by IBM in 1981 and was named IBM-PC. Later on, many computers hardware companies CSE dept. VIT,Bangalore copied this design and termed their microcomputers as PC-compatible, which refers to any PC that is based on the original IBM PC design. Another type of popular PC is designed by Apple. PCs designed by IBM and other PC-compatible computers have a different architecture from that of Apple computers. Moreover, PCs and PC-compatible computers commonly use the Windows operating system, while Apple computers use the Macintosh operating system (MacOS). PCs can be classified into the following categories: Desktop PCs A desktop PC is the most popular model of PCs. The system unit of the desktop PC can be placed flat on a desk or table. It is widely used in homes and offices. Laptops Laptops (Figure 1.9) are small microcomputers that can easily fit inside a briefcase. They are very handy and can easily be carried from one place to another. They may also be placed on the user’s lap (thus the name). Hence, laptops are very useful, especially when going on long journeys. Laptops operate on a battery and do not always have to be plugged in like desktop computers. Workstations Workstations are single-user computers that have the same features as PCs, but their processing speed matches that of a minicomputer or mainframe computer. Workstation computers have advanced processors, more RAM and storage capacity than PCs. Therefore, they are more expensive and powerful than a normal desktop computer. Network Computers Network computers have less processing power, memory, and storage than a desktop computer. These are specially designed to be used as terminals in a networked environment. For example, some network computers are specifically designed to access data stored on a network (including the Internet and intranet) Handheld Computers The mid-1990s witnessed a range of small personal computing devices that are commonly known as handheld computers, or mobile computers. These computers are called handheld computers because they can fit in one hand, while users can use the other hand to operate them. Handheld computers are very small in size, and hence they have small-sized screens and keyboards. These computers are preferred by business travelers and mobile employees whose jobs require them to move from place to place. Some examples of handheld computers are as follows: Smartphones Tablet PCs Smartphones These days, cellular phones are web-enabled telephones. Such phones are also known as smartphones because, in addition to basic phone capabilities, they also facilitate the users to access the Internet and send e-mails, edit Word documents, generate an Excel sheet, create a presentation, and lots more. Smartphones run an advanced mobile operating system that enables it to run various applications. The four major mobile operating systems are iOS, Android, BlackBerryOS, and Windows Mobile. Smartphones also have a CPU, more storage space, more memory, and a larger screen than a regular cell phone. In a nutshell, smartphone refers to a multi-functional mobile phone handset that packs in varied functionalities from a camera to a web browser to a high-density display. CSE dept. VIT,Bangalore Tablet PCs A tablet PC (see Figure 1.10) is a computing device that is smaller than a laptop, but bigger than a smartphone. Features such as user-friendly interface, portability, and touch screen have made them very popular in the last few years. These days, a wide range of high-performance tablets are available in the market. While all of them look similar from outside, they may differ in features such as operating system, speed of data connectivity, camera specifications, size of the screen, processing power, battery life, and storage capability. 1.6 APPLICATIONS OF COMPUTERS When the first computers were developed, they were used only in the fields of mathematics and science. In fact, the first effective utilization of computers was for decoding. messages in military applications. Later, computers were used in real-time control systems, like for landing on the moon. However, with the advancement of technology, the cost of computers and their maintenance declined. This opened the way for computers to be extensively used in the business and commercial sector for information processing. Today, computers are widely used in fields such as engineering, health care, banking, education, etc. Let us discuss how computers are being effectively utilized to perform important tasks. Word-processing Word-processing software enables users to read and write documents. Users can also add images, tables, and graphs for illustrating a concept. The software automatically corrects spelling mistakes and includes copy–paste features (which is very useful where the same text has to be repeated several times). Internet The Internet is a network of networks that connects computers all over the world. It gives the user access to an enormous amount of information, much more than available in any library. Using e- mail, the user can communicate in seconds with a person who is located thousands of miles away. Chat software enables users to chat with another person in real-time (irrespective of the physical location of that person). Video conferencing tools are becoming popular for conducting meetings with people who are unable to be present at a particular place. Digital video or audio composition Computers make audio or video composition and editing very simple. This has drastically reduced the cost of equipment to compose music or make a fi lm. Graphics engineers use computers for developing short or full-length films and creating 3-D models and special effects in science fiction and action movies. Desktop publishing Desktop publishing software enables us to create page layouts for entire books. After discussing how computers are used in today’s scenario, let us now have a look at the different areas where computers are being widely utilized. Bioinformatics Bioinformatics is the application of computer technology to manage large amounts of biological information. Computers are used to collect, store, analyses, and integrate biological and genetic information to facilitate gene-based drug discovery and development. The need for analysis has become even more important with the enormous amount of genomic information available publicly from the Human Genome Project. Health care Last few years have seen a massive growth of computers and smartphone users. Like in our daily lives, computers have also become a necessary device in the health care industry. The following are areas in which computers. o Storing records to begin with, computers are first and foremost used to store the medical records of patients. Earlier, patient records were kept on paper, with separate records dealing with different medical issues from separate healthcare organizations. CSE dept. VIT,Bangalore PRINCIPLES OF PROGRAMMING-BPOPS103 o Surgical procedures Computers are used for certain surgical procedures. They enable thesurgeon to use computers to control and move surgical instruments in the patient’s body for a variety of surgical procedures. In such surgeries, a small incision is made, and then a small surgical tool with an attached camera is placed inside the patient’s body. This reduces the risk of complications from a larger surgical wound, and minimizes damage done to the patient’s body. Better diagnosis and treatment Computers help physicians make better diagnoses and recommendtreatments. Moreover, computers can be used to compare expected results with actual results to help physicians make better decisions. Meteorology Meteorology is the study of the atmosphere. This branch of science observes variables of Earth’s atmosphere such as temperature, air pressure, water vapour, and the gradients and interactions of each variable, and how they change over time. Meteorology has applications in many diverse fields such as the military, energy production, transport, agriculture, and construction. Multimedia and Animation Multimedia and animation that combines still images, moving images, text, and sound in meaningful ways is one of most powerful aspects of computer technology. We all have seen cartoon movies, which are nothing but an example of computer animation. Retail Business Computers are used in retail shops to enter orders, calculate costs, and print receipts. They are also used to keep an inventory of the products available and their complete description. Sports In sports, computers are used to compile statistics, identify weak players and strong players by analysing statistics, sell tickets, create training programs and diets for athletes, and suggest game plan strategies based on the competitor’s past performance. Computers are also used to generate most of the graphic art displays flashed on scoreboards. Travel and Tourism Computers are used to prepare tickets, monitor the trains or airplane’s route, and guide the plane to a safe landing. They are also used to research about hotels in an area, reserve rooms, or to rent a car. Simulation Supercomputers that can process enormous amounts of data are widely used in simulation tests. Simulation of automobile crashes or airplane emergency landings is done to identify potential weaknesses in designs without risking human lives. Astronomy Spacecraft’s are usually monitored using computers that not only keep a continuous record of the voyage and of the speed, direction, fuel, and temperature, but also suggest corrective action if the vehicle makes a mistake. The remote stations on the earth compare all these quantities with the desired values, and in case these values need to be modified to enhance the performance of the spacecraft, signals are immediately sent that set- in motion the mechanics to rectify the situation. Education A computer is a powerful teaching aid and can act as another teacher in the DEPT OF CSE, VIT PRINCIPLES OF PROGRAMMING-BPOPS103 classroom. Teachers use computers to develop instructional material. Teachers may use pictures, graphs, and graphical presentations to easily illustrate an otherwise difficult concept. Moreover, teachers at all levels can use computers to administer assignments and keep track of grades. Students can also take exams online and get instant results. 1.7 BASIC ORGANIZATION OF A COMPUTER A computer is an electronic device that performs five major operations: Accepting data or instructions (input) Storing data Processing data Displaying results (output) Controlling and coordinating all operations inside a computer In this section, we will discuss all these functions and see how one unit of a computer interacts with another to perform these operations. Refer to Figure 1.9, which shows the interaction between the different units of a computer system. Figure 1.9: Block diagram of Computer Input unit – Input unit is a unit that accepts any input device. The input device is used to input data intothe computer system. Function of input unit: o It converts input data into binary codes. o It sends data to the main memory of the computer. Central Processing Unit (CUP) – CPU is called the brain of a computer. An electronic DEPT OF CSE, VIT PRINCIPLES OF PROGRAMMING-BPOPS103 circuitry that carries out the instruction given by a computer program. CPU can be sub classified into three parts. i. Control unit (CU) ii. Arithmetic & Logic unit (ALU) iii. Memory Unit (MU) i. Control unit (CU)- the control unit manages the various components of the computer. It reads instructions from memory and interpretation and changes in a series of signals to activate other parts of the computer. It controls and co-ordinates its input, o u t p u t , memory, and all other units. ii. Arithmetic & Logic unit (ALU) – The arithmetic logic unit (ALU), which performs simple arithmetic operation such as +, -, *, / and logical operation such as >,

Use Quizgecko on...
Browser
Browser