Basic Radio & Television 0070473358, 9780070473355

1,013 167 14MB

English Pages 700 [454] Year 2003

Report DMCA / Copyright

DOWNLOAD FILE

Polecaj historie

Basic Radio & Television
 0070473358, 9780070473355

Table of contents :
Title
Contents
1 Fundamentals of Computers
2 Operating Systems
3 Programming Languages
4 Introduction to Programming
5 Beginning with C++
6 Tokens, Expressions and Control Structures
7 Functions in C++
8 Classes and Objects
9 Constructors and Destructors
10 Operator Overloading and Type Conversions
11 Derived Classes and Inheritance
12 Managing Console I/O Operations
13 Database Management System
14 Computer Networking
Appendix A
Appendix B
Examination Paper

Citation preview

BASIC COMPUTER ENGINEERING (RGPV 2011) BE 205 Bachelor of Engineering B.E. (Common to all Disciplines)

Published by the Tata McGraw Hill Education Private Limited, 7 West Patel Nagar, New Delhi 110 008. Basic Computer Engineering, (For RGPV), 2e Copyright © 2011, by Tata McGraw Hill Education Private Limited. No part of this publication may be reproduced or distributed in any form or by any means, electronic, mechanical, photocopying, recording, or otherwise or stored in a database or retrieval system without the prior written permission of the publishers. The program listings (if any) may be entered, stored and executed in a computer system, but they may not be reproduced for publication. This edition can be exported from India only by the publishers, Tata McGraw Hill Education Private Limited ISBN-13: 978-0-07-13-2976-7 ISBN-10: 0-07-13-2976-5 Vice President and Managing Director—McGraw-Hill Education, Asia-Pacific Region: Ajay Shukla Head—Higher Education Publishing and Marketing: Vibha Mahajan Publishing Manager—SEM & Tech. Ed.: Shalini Jha Asst Sponsoring Editor: Tina Jajoriya Sr Editorial Researcher: Manish Choudhary Executive—Editorial Services: Sohini Mukherjee Sr Production Manager: Satinder S. Baveja Proof Reader: Yukti Sharma Sr Product Specialist—SEM & Tech. Ed.: John Mathews General Manager—Production: Rajender P Ghansela Asst General Manager—Production: B L Dogra Information contained in this work has been obtained by Tata McGraw-Hill, from sources believed to be reliable. However, neither Tata McGraw-Hill nor its authors guarantee the accuracy or completeness of any information published herein, and neither Tata McGraw-Hill nor its authors shall be responsible for any errors, omissions, or damages arising out of use of this information. This work is published with the understanding that Tata McGraw-Hill and its authors are supplying information but are not attempting to render engineering or other professional services. If such services are required, the assistance of an appropriate professional should be sought. Typeset at The Composers, 260, C.A. Apt., Paschim Vihar, New Delhi 110 063 and printed at Gopsons, A-2 & 3, Sector-64, Noida, U.P. 201 301 Cover Printer: Gopsons RBLBCRAGRCYRC The McGraw-Hill Companies

1 Fundamentals of Computers

1.1 Introduction

Key Concepts

Computer Computer Classification Computer Organization CPU

The term computer is derived from the word compute. A computer is an electronic device that takes data and instructions as an input from the user, processes data, and provides useful information known as output. This cycle of operation of a computer is known as the input–process–output cycle and is shown in Fig. 1.1. The electronic device is known as hardware and the set of instructions is known as software.

Register Bus Architecture Instruction Set Memory and Storage Systems Input Devices System Software Application Software

Data

INPUT

OUTPUT PROCESS

Information

Instructions

Fig. 1.1

3 Input–process–output concept

The spurt of innovations and inventions in computer technology during the last few decades has led to the development of a variety of computers. They are so versatile that they have become indispensable to engineers, scientists, business executives, managers, administrators, accountants, teachers and students. They have strengthened man’s powers in numerical computations and information processing.

1.2

Basic Computer Engineering

Modern computers possess certain characteristics and abilities peculiar to them. They can: (i) (ii) (iii) (iv) (v) (vi) (vii) (viii) (ix)

perform complex and repetitive calculations rapidly and accurately, store large amounts of data and information for subsequent manipulations, hold a program of a model which can be explored in many different ways, compare items and make decisions, provide information to the user in many different forms, automatically correct or modify the parameters of a system under control, draw and print graphs, converse with users interactively, and receive and display audio and video signals.

These capabilities of computers have enabled us to use them for a variety of tasks. Application areas may broadly be classified into the following major categories. 1. 2. 3. 4. 5. 6.

Data processing (commercial use) Numerical computing (scientific use) Text (word) processing (office and educational use) Message communication (e-mail) Image processing (animation and industrial use) Voice recognition (multimedia)

Engineers and scientists make use of the high-speed computing capability of computers to solve complex mathematical models and design problems. Many calculations that were previously beyond contemplation have now become possible. Many of the technological achievements such as landing on the moon would not have been possible without computers. The areas of computer applications are too numerous to mention. Computers have become an integral part of man’s everyday life. They continue to grow and open new horizons of discovery and application such as the electronic office, electronic commerce, and the home computer center. The microelectronics revolution has placed enormous computational power within the reach of not only every organisation but also individual professionals and businessmen. However, it must be remembered that computers are machines created and managed by human beings. A computer has no brain of its own. Anything it does is the result of human instructions. It is an obedient slave which carries out the master’s instructions as long as it can understand them, no matter whether they are right or wrong. A computer has no common sense.

1.2

Classification of Computers

Computers can be classified into several categories depending on their computing ability and processing speed. These include Microcomputer Minicomputer Mainframe computers Supercomputers

Fundamentals of Computers

1.3

1.2.1 Microcomputers A microcomputer is defined as a computer that has a microprocessor as its CPU. The microcomputer system can perform the following basic operations: Inputting — It is the process of entering data and instructions into the microcomputer system. Storing — It is the process of saving data and instructions in the memory of the microcomputer system, so that they can be used whenever required. Processing — It is the process of performing arithmetic or logical operations on data, where data can be converted into useful information. Various arithmetic operations include addition, subtraction, multiplication and division. Among logical operations, operations of comparisons like equal to, less than, greater than, etc., are prominent in use. Outputting — It provides the results to the user, which could be in the form of visual display and/or printed reports. Controlling — It helps in directing the sequence and manner in which all the above operations are performed.

1.2.2 Minicomputers A minicomputer is a medium-sized computer that is more powerful than a microcomputer. An important distinction between a microcomputer and a minicomputer is that a minicomputer is usually designed to serve multiple users simultaneously. A system that supports multiple users is called a multiterminal, time-sharing system. Minicomputers are the popular computing systems among research and business organizations today. They are more expensive than microcomputers.

1.2.3 Mainframe Computers Mainframe computers are those computers, which help in handling the information processing of various organizations like banks, insurance companies, hospitals and railways. Mainframe computers are placed on a central location and are connected to several user terminals, which can act as access stations and may be located in the same building. Mainframe computers are larger and expensive in comparison to the workstations.

1.2.4 Supercomputers Supercomputers are the most powerful and expensive computers available at present. They are also the fastest computers available. Supercomputers are primarily used for complex scientific applications, which need a higher level of processing. Some of these applications include weather forecasting, climate research, molecular modeling used for chemical compounds, aeroplane simulations and nuclear fusion research. In supercomputers, multiprocessing and parallel processing technologies are used to promptly solve complex problems. Here, the multiprocessor can enable the user to divide a complex problem into smaller problems. A supercomputer also supports multiprogramming where multiple users can access the computer simultaneously. Presently, some of the popular manufacturers of supercomputers are IBM, Silicon Graphics, Fujitsu, and Intel.

1.4

1.3

Basic Computer Engineering

Computing Concepts

We can understand how a computer functions by analysing the fundamental computing concepts. The most elementary computing concepts include receiving input—known as data— from the user, manipulating the input according to the given set of instructions and delivering the output—known as information—to the user. Figure 1.2 shows the functioning of a computer based on these concepts.

Fig. 1.2

3 The Input-Process-Output Cycle of a computer

The various functions performed by the computer are briefly described below:

Accepting the raw data The first task to be performed by a computer is to accept the data from the user, with the help of an input device, such as mouse and keyboard. Mouse is used to enter the data through point-and-click operation while keyboard is used to enter the character data by typing the various keys. We need to enter the data into the computer so as to obtain the required result as output.

Processing the data The data is processed with the help of specific instructions known as programs after taking the input from the user. The manipulation of data is handled by the CPU of the computer. CPU is considered as the brain of the computer because it controls the execution of various instructions. The raw data entered by the user through input devices is processed by the CPU to generate meaningful information.

Storing the data The data is stored in the main memory of a computer in its processed form. The various external storage devices—such as hard disk and magnetic disk—can also be used for storing the processed data so that it can again be fetched later. Delivering the output The processed data is delivered as useful information to the user with the help of output devices, such as printer and monitor.

1.4

Central Processing Unit

The function of any computer system revolves around a central component known as central processing unit (CPU). The CPU, which is popularly referred to as the “brain” of the computer, is responsible for processing the data inside the computer system. It is also responsible for controlling all other components of the system. Figure 1.3 shows a typical block diagram of the computer system, illustrating the arrangement of CPU with the input and output units as well as the memory of the computer system.

Fundamentals of Computers

Fig. 1.3

3 The block diagram of a computer system

The main operations of the CPU include four phases: Fetching instructions from the memory. Decoding the instructions to decide what operations to be preformed. Executing the instructions. Storing the results back in the memory. This four-phase process is known as the CPU cycle, which is illustrated in Fig. 1.4.

Fig. 1.4

3 The CPU cycle

1.5

1.6

Basic Computer Engineering

As shown in the Fig. 1.3, the central processing unit consists of the following subsystems: Arithmetic Unit (AU) Logic Unit (LU) Control Unit (CU) The CPU makes use of the following memory subsystems for carrying out its processing operations: Main Memory Unit Cache Memory Registers

1.4.1 Arithmetic Unit Arithmetic Unit (AU) is a part of the CPU that performs arithmetic operations on the data. The arithmetic operations can be addition, subtraction, multiplication or division. The multiplication and division operations are usually implemented by the AU as the repetitive process of addition and subtraction operations respectively. Some CPUs contain separate AUs for integer or fixedpoint operations (integers) and real or floating-point operations (real/decimal). AU takes the input in the form of an instruction that contains an opcode, operands and the format code. The opcode specifies the operation to be performed and the operands specify the data on which operation is to be performed. The format code suggests the format of the operands, such as fixedpoint or floating-point. The output of AU contains the result of the operation and the status of the result, whether it is final or not. The output is stored in a storage register by the AU. Register is a small storage area inside the CPU from where data is retrieved faster than any other storage area.

1.4.2 Logic Unit Logic Unit (LU) is a part of the CPU that performs logical operations on the data. It performs 16 different types of logical operations. The various logical operations include greater than (>), less than ( 40 Step 5 – Display Pass Step 6 – Else Step 7 – Display Fail Figure 3.6 shows the flowchart for the above algorithm.

Fig. 3.6

3 Flowchart for calculating the percentage of marks and displaying the result

After developing the algorithm and flowchart, the actual development of the program can be started in the source code editor of C++. The following code shows the C++ program for calculating the percentage of marks in two different subjects for a student.

3.22

Basic Computer Engineering

#include #include using namespace std; int main() { float mark1,mark2; float percentage; cout > mark1; cout > mark2; percentage =((mark1+mark2)/200)*100; if (percentage>40) cout