Unit 1 Computer Fundamentals
Total Page:16
File Type:pdf, Size:1020Kb
15 MM VENKATESHWARA COMPUTER FUNDAMENTALS OPEN UNIVERSITY AND PROGRAMMING www.vou.ac.in COMPUTER FUNDAMENTALS AND PROGRAMMING AND FUNDAMENTALS COMPUTER COMPUTER FUNDAMENTALS BBA [BBA-304] VENKATESHWARA OPEN UNIVERSITYwww.vou.ac.in COMPUTER FUNDAMENTALS BBA [BBA-304] BOARD OF STUDIES Prof Lalit Kumar Sagar Vice Chancellor Dr. S. Raman Iyer Director Directorate of Distance Education SUBJECT EXPERT Prof. Saurabh Upadhya Professor Dr. Kamal Upreti Associate Professor Mr. Animesh Srivastav Associate Professor Hitendranath Bhattacharya Assistant Professor CO-ORDINATOR Mr. Tauha Khan Registrar Authors: B. Basavaraj: Unit (1.0-1.2.4, 1.4-1.5.2, 1.8-1.9) Copyright © Vikas® Publishing House, 2010 Vivek Kesari: Unit (1.6-1.7, 1.11) Copyright © Vivek Kesari, 2010 S. Mohan Naidu: Unit (2.0-2.3, 2.5, 2.7, 3.3, 3.6-3.9, 3.17-3.18, 3.20-3.21, 3.23) Copyright © S. Mohan Naidu, 2010 R. Subburaj: Unit (3.0-3.2, 3.4-3.5, 3.10-3.12, 3.19, 3.22) Copyright © Vikas® Publishing House, 2010 Vikas® Publishing House: Units (1.3, 1.10, 1.12-1.17, 2.4, 2.6, 2.8-2.13, 3.13-3.16, 3.24-3.32) Copyright © Vikas® Publishing House, 2010 All rights reserved. No part of this publication which is material protected by this copyright notice may be reproduced or transmitted or utilized or stored in any form or by any means now known or hereinafter invented, electronic, digital or mechanical, including photocopying, scanning, recording or by any information storage or retrieval system, without prior written permission from the Publisher. Information contained in this book has been published by VIKAS® Publishing House Pvt. Ltd. and has been obtained by its Authors from sources believed to be reliable and are correct to the best of their knowledge. However, the Publisher and its Authors shall in no event be liable for any errors, omissions or damages arising out of use of this information and specifically disclaim any implied warranties or merchantability or fitness for any particular use. Vikas® is the registered trademark of Vikas® Publishing House Pvt. Ltd. VIKAS® PUBLISHING HOUSE PVT LTD E-28, Sector-8, Noida - 201301 (UP) Phone: 0120-4078900 Fax: 0120-4078999 Regd. Office: A-27, 2nd Floor, Mohan Co-operative Industrial Estate, New Delhi 1100 44 Website: www.vikaspublishing.com Email: [email protected] SYLLABI-BOOK MAPPING TABLE Computer Fundamentals and Programming Syllabi Mapping in Book Computer Fundamentals Number system: Decimal, octal, binary and hexadecimal; Unit 1: Computer Fundamentals Representation of integers, fixed and floating points, character (Pages: 3-40) representation: ASCII, EBCDIC; Functional units of computer, I/O devices, primary and secondary memories; Programming Fundamentals Algorithm development, Techniques of problem solving, Unit 2: Programming Flow-charting, Step-wise refinement, Algorithms for Fundamentals: Algorithms searching, Sorting (exchange and insertion), merging of and Flowcharts ordered lists. (Pages: 41-161) Programming Representation of integers, characters, real Data types: Unit 3: Programming constants and variables; Arithmetic Expressions, Assignment, (Pages: 163-333) statement, Logical expression, Sequencing, Alteration and iteration; string processing; Sub programs, Recursion, Files and pointers; Structured programming concepts; Top down Design, Development of efficient programs; program correctness; Debugging and testing of Programs. CONTENTS INTRODUCTION 1 UNIT 1 COMPUTER FUNDAMENTALS 3-40 1.0 Introduction 1.1 Unit Objectives 1.2 Number System 1.2.1 Decimal Number System 1.2.2 Binary Number System 1.2.3 Octal Number System 1.2.4 Hexadecimal Number System 1.3 Integers 1.4 Fixed and Floating Points Arithmetic Operations 1.5 Character Representation 1.5.1 ASCII 1.5.2 EBCDIC 1.6 Definition of Computer 1.7 Functional Units of a Computer 1.8 Input Unit 1.9 Output Unit 1.10 I/O Devices 1.11 Primary and Secondary Memories 1.12 PROM and EPROM 1.13 Summary 1.14 Key Terms 1.15 Answers to ‘Check Your Progress’ 1.16 Questions and Exercises 1.17 Further Reading UNIT 2 PROGRAMMING FUNDAMENTALS: ALGORITHMS AND FLOWCHARTS 41-161 2.0 Introduction 2.1 Unit Objectives 2.2 Procedure and Algorithms 2.3 Algorithm Development 2.4 Techniques of Problem Solving 2.5 Flowcharting 2.6 Stepwise Refinement 2.7 Algorithm for Sorting and Searching 2.8 Merging of Ordered List 2.9 Summary 2.10 Key Terms 2.11 Answers to ‘Check Your Progress’ 2.12 Questions and Exercises 2.13 Further Reading UNIT 3 PROGRAMMING 163-333 3.0 Introduction 3.1 Unit Objectives 3.2 Introduction to Programming 3.3 Introduction to C as Reference 3.4 Representation of Integers 3.5 Data Types 3.6 Constants/Literals 3.7 Variables 3.8 Operators 3.9 Program Structures 3.10 Arithmetic Expressions 3.11 Assignment Statement 3.12 Logical Expression 3.13 Sequencing 3.14 Alteration and Iteration 3.15 String Processing 3.16 Subprograms 3.17 Recursion 3.18 Arrays 3.19 Functions 3.20 Pointers 3.21 Input and Output 3.22 Files 3.23 Structured Programming Concepts 3.24 Top-Down and Bottom-Up Design 3.25 Development of Efficient Programs 3.26 Program Correctness 3.27 Debugging and Testing of Programs 3.28 Summary 3.29 Key Terms 3.30 Answers to ‘Check Your Progress’ 3.31 Questions and Exercises 3.32 Further Reading Introduction INTRODUCTION NOTES Computers have become an indispensable part of our lives. We depend on computers for our day-to-day tasks. But, have you ever wondered how these dumb machines have acquired their present-day status in our society? Yes, computers are actually dumb machines, because they cannot function on their own. A bare computer machine, without any software loaded in it, is as good as a piece of wood. However, these bare machines are capable of performing zillions of calculations in almost no time. To reap the benefits of this enormous capability, we need to program these machines, i.e. to provide them with instructions to do our desired tasks. To make use of computers, we need programs (or a set of instructions) that are written in a computer programming language. A computer programming language is a script language that a computer can understand. Now, to tell the computer to perform a desired task, we need to write our requirements in a computer programming language and feed these instructions in the computer. All this is as simple as it sounds, provided that we have thorough understanding of components of a computer and programming concepts and techniques. The present book lays out the very basic concepts and techniques required to write a successful computer program. Unit 1 introduces you to the various number systems and character sets the understanding of which is a prerequisite to writing computer programs. The unit also deals with the input–output devices and computer memory types. Unit 2 teaches you the basics of writing algorithms and making use of flowcharts to write efficient and effective programs. Unit 3 covers the basic constructs of a programming language (C in particular) to enable you to write computer programs to perform various tasks. The book includes ample examples to render better understanding of all the concepts. The book follows the SIM format or the self-instructional mode wherein each Unit begins with an Introduction to the topic followed by an outline of the Unit Objectives. The detailed content is then presented in a simple and an organized manner, interspersed with Check Your Progress questions to test the understanding of the students. A Summary along with a list of Key Terms and a set of Questions and Exercises is also provided at the end of each unit for effective recapitulation. Self-Instructional Material 1 Computer Fundamentals UNIT 1 COMPUTER FUNDAMENTALS NOTES Structure 1.0 Introduction 1.1 Unit Objectives 1.2 Number System 1.2.1 Decimal Number System 1.2.2 Binary Number System 1.2.3 Octal Number System 1.2.4 Hexadecimal Number System 1.3 Integers 1.4 Fixed and Floating Points Arithmetic Operations 1.5 Character Representation 1.5.1 ASCII 1.5.2 EBCDIC 1.6 Definition of Computer 1.7 Functional Units of a Computer 1.8 Input Unit 1.9 Output Unit 1.10 I/O Devices 1.11 Primary and Secondary Memories 1.12 PROM and EPROM 1.13 Summary 1.14 Key Terms 1.15 Answers to ‘Check Your Progress’ 1.16 Questions and Exercises 1.17 Further Reading 1.0 INTRODUCTION The word ‘compute’ means to calculate and we are all aware of the calculations we are required to do in our everyday life, whether it is addition, subtraction, multiplication or subtraction. The earliest known tool for calculations was the abacus, and it was thought to have been invented in Babylon circa 2400 BC. Today, you cannot even think of a life without computers as they exist in every area of our lives, whether it be banking, airlines, communications or simply working in an office. Self-Instructional Material 3 Computer Fundamentals 1.1 UNIT OBJECTIVES After going through this unit, you will be able to: NOTES Understand the different systems of arithmetic used in digital systems Discuss the different arithmetic concepts of integers and fixed and floating points which are used in computer programming. Elaborate on the different functional units of a computer. Analyse the main and auxiliary memory units in a computer. 1.2 NUMBER SYSTEM A number represents a thought that refers to a precise amount of something. Numbers can be expressed in words, gestures and symbols. When expressed in words, numbers are spoken out. Numbers are expressed through gestures using (usually) our hands. Numbers are expressed in symbols that can be written down.