Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
100% found this document useful (2 votes)
8 views

Problem Solving and Python Programming 1st edition - eBook PDF instant download

The document provides information about the eBook 'Problem Solving and Python Programming' by E Balagurusamy, detailing its contents, author background, and educational approach. It emphasizes the importance of Python programming in today's digital landscape and outlines the book's structure, which includes various chapters on computing concepts and programming techniques. Additionally, it offers links for downloading the eBook and other related resources.

Uploaded by

jedzilary
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (2 votes)
8 views

Problem Solving and Python Programming 1st edition - eBook PDF instant download

The document provides information about the eBook 'Problem Solving and Python Programming' by E Balagurusamy, detailing its contents, author background, and educational approach. It emphasizes the importance of Python programming in today's digital landscape and outlines the book's structure, which includes various chapters on computing concepts and programming techniques. Additionally, it offers links for downloading the eBook and other related resources.

Uploaded by

jedzilary
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 57

Problem Solving and Python Programming 1st

edition - eBook PDF pdf download

https://ebooksecure.com/download/problem-solving-and-python-
programming-ebook-pdf/

Download more ebook from https://ebooksecure.com


We believe these products will be a great fit for you. Click
the link to download now, or visit ebooksecure.com
to discover even more!

Programming and Problem Solving with Python 1st Edition


- eBook PDF

https://ebooksecure.com/download/programming-and-problem-solving-
with-python-ebook-pdf/

(eBook PDF) Programming, Problem Solving and


Abstraction with C

http://ebooksecure.com/product/ebook-pdf-programming-problem-
solving-and-abstraction-with-c/

Programming for Problem Solving- GTU 2018 - eBook PDF

https://ebooksecure.com/download/programming-for-problem-solving-
ebook-pdf/

(eBook PDF) Java: An Introduction to Problem Solving


and Programming 7th Edition

http://ebooksecure.com/product/ebook-pdf-java-an-introduction-to-
problem-solving-and-programming-7th-edition/
(eBook PDF) Java: An Introduction to Problem Solving
and Programming 8th Edition

http://ebooksecure.com/product/ebook-pdf-java-an-introduction-to-
problem-solving-and-programming-8th-edition/

(eBook PDF) Matlab: A Practical Introduction to


Programming and Problem Solving 4th Edition

http://ebooksecure.com/product/ebook-pdf-matlab-a-practical-
introduction-to-programming-and-problem-solving-4th-edition/

(eBook PDF) Introduction to Programming with Java: A


Problem Solving Approach 3rd Edition

http://ebooksecure.com/product/ebook-pdf-introduction-to-
programming-with-java-a-problem-solving-approach-3rd-edition/

Pericyclic reactions : a mechanistic and problem


solving approach 1st Edition Kumar - eBook PDF

https://ebooksecure.com/download/pericyclic-reactions-a-
mechanistic-and-problem-solving-approach-ebook-pdf/

(eBook PDF) Problem Solving with C++ 10th Edition

http://ebooksecure.com/product/ebook-pdf-problem-solving-
with-c-10th-edition/
Problem Solving and
Python Programming
About the Author
E Balagurusamy is presently the Chairman of EBG Foundation, Coimbatore. In the past he has also held the
positions of member, Union Public Service Commission, New Delhi and Vice-Chancellor, Anna University,
Chennai, Tamil Nadu. He is a teacher, trainer and consultant in the fields of Information Technology and
Management. He holds an ME (Hons) in Electrical Engineering and PhD in Systems Engineering from the
Indian Institute of Technology, Roorkee, Uttarakhand. His areas of interest include Object-Oriented Software
Engineering, E-Governance: Technology Management, Business Process Re-engineering and Total Quality
Management.
A prolific writer, he has authored a large number of research papers and several books. His best-selling
books, among others include:
● Programming in ANSIC, 7/e

● Fundamentals of Computers

● Computing Fundamentals and C Programming, 2e

● Programming in C#, 3/e

● Programming in Java, 5/e

● Object-Oriented Programming with C++, 7/e

● Programming in BASIC, 3/e

● Numerical Methods

● Reliability Engineering

● Problem Solving and Python Programming


A recipient of numerous honors and awards, he has been listed in the Directory of Who’s Who of
Intellectuals and in the Directory of Distinguished Leaders in Education.
Problem Solving and
Python Programming

E Balagurusamy
Chairman
EBG Foundation
Coimbatore

McGraw Hill Education (India) Private Limited


CHENNAI

McGraw Hill Education Offices


Chennai New York St Louis San Francisco Auckland Bogotá Caracas
Kuala Lumpur Lisbon London Madrid Mexico City Milan Montreal
San Juan Santiago Singapore Sydney Tokyo Toronto
McGraw Hill Education (India) Private Limited

Published by McGraw Hill Education (India) Private Limited


444/1, Sri Ekambara Naicker Industrial Estate, Alapakkam, Porur, Chennai - 600 116

Problem Solving and Python Programming

Copyright © 2018 by McGraw Hill Education (India) 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,


McGraw Hill Education (India) Private Limited

1 23456789 D101417 22 21 20 19 18
Printed and bound in India

Print Edition:
ISBN-13: 978-93-87067-01-1
ISBN-10: 93-87067-01-7

Managing Director: Kaushik Bellani

Director—Science & Engineering Portfolio: Vibha Mahajan


Senior Portfolio Manager—Science & Engineering: Hemant K Jha
Associate Portfolio Manager: Mohammad Salman Khurshid

Production Head: Satinder S Baveja


Copy Editor: Taranpreet Kaur
Assistant Manager—Production: Anuj K Shriwastava

General Manager—Production: Rajender P Ghansela


Manager—Production: Reji Kumar

Information contained in this work has been obtained by McGraw Hill Education (India), from sources believed to be reliable. However,
neither McGraw Hill Education (India) nor its authors guarantee the accuracy or completeness of any information published herein,
and neither McGraw Hill Education (India) 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 McGraw Hill Education (India) 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

Cover Printer:

Visit us at: www.mheducation.co.in


Contents

Preface ix

Unit 1: Introduction to Computing and Algorithmic Problem Solving

Chapter 1 Introduction to Digital Computer 3


1.1 Introduction 3
1.2 Von Neumann Concept 5
1.3 Storage 8
1.4 Programming Languages 12
1.5 Translators 14
1.6 Hardware and Software 15
1.7 Operating Systems 17
Always Remember 18
Key Terms 18
Review Exercises 19
Multiple Choice Questions 19
Short Questions 21
Answers to Multiple Choice Questions 22

Chapter 2 Problem Solving Strategies 23


2.1 Problem Analysis 23
2.2 Algorithms 24
2.3 Flow Charts 26
2.4 Examples of Algorithms and Flow Charts 30
Always Remember 35
Key Terms 35
Review Exercises 36
vi Contents

Multiple Choice Questions 36


Short Questions 37
Answers to Multiple Choice Questions 37

Appendix A: Practice Exercises with Algorithm and Flow Chart 38

Appendix B: Problem Solving Exercises with Algorithms and Pseudocode 91

Unit 2: Introduction to Python and Data, Expressions, Statements

Chapter 3 Introduction to Python 117


3.1 Introduction 117
3.2 Python Overview 117
3.3 Getting Started with Python 118
3.4 Comments 123
3.5 Python Identifiers 123
3.6 Reserved Keywords 124
3.7 Variables 124
3.8 Standard Data Types 126
3.9 Operators 132
3.10 Statement and Expression 142
3.11 String Operations 143
3.12 Boolean Expressions 145
3.13 Control Statements 146
3.14 Iteration – while Statement 152
3.15 Input from Keyboard 154
Always Remember 156
Key Terms 157
Review Exercises 157
Multiple Choice Questions 161
Short Questions 162
Answers to Multiple Choice Questions 162

Unit 3: Functions

Chapter 4 Functions 165


4.1 Introduction 165
4.2 Built-in Functions 165
4.3 Composition of Functions 171
4.4 User Defined Functions 172
Contents vii

4.5 Parameters and Arguments 175


4.6 Function Calls 179
4.7 The return Statement 180
4.8 Python Recursive Function 181
4.9 The Anonymous Functions 181
4.10 Writing Python Scripts 183
Always Remember 185
Key Terms 186
Review Exercises 187
Multiple Choice Questions 192
Short Questions 193
Answers to Multiple Choice Questions 194

Unit 4: Lists, Tuples and Dictionaries

Chapter 5 Strings and Lists 197


5.1 Strings 197
5.2 Lists 209
Always Remember 217
Key Terms 218
Review Exercises 219
Multiple Choice Questions 226
Short Questions 229
Answers to Multiple Choice Questions 232

Chapter 6 Tuples and Dictionaries 233


6.1 Tuples 233
6.2 Dictionaries 244
Always Remember 251
Key Terms 252
Review Exercises 253
Multiple Choice Questions 259
Short Questions 262
Answers to Multiple Choice Questions 264

Unit 5: Files, Modules and Packages

Chapter 7 Files and Exceptions 267


7.1 Text Files 267
7.2 Directories 277
7.3 Exceptions 279
viii Contents

7.4 Exception with Arguments 285


7.5 User-Defined Exceptions 286
Always Remember 288
Key Terms 289
Review Exercises 290
Multiple Choice Questions 295
Short Questions 297
Answers to Multiple Choice Questions 298

Chapter 8 Classes and Objects 299


8.1 Overview of OOP (Object-Oriented Programming) 299
8.2 Class Definition 300
8.3 Creating Objects 302
8.4 Objects as Arguments 305
8.5 Objects as Return Values 306
8.6 Built-in Class Attributes 307
8.7 Inheritance 308
8.8 Method Overriding 312
8.9 Data Encapsulation 312
8.10 Data Hiding 314
Always Remember 315
Key Terms 316
Review Exercises 317
Multiple Choice Questions 323
Short Questions 325
Answers to Multiple Choice Questions 326

Appendix C: Fundamental Standard Library Modules 327


PrefACe

Developments in the field of digital electronics and the huge amount of data generated during the last
few decades ushered in the second Industrial Revolution which is popularly referred to as the Information
Revolution. Information technology played an ever-increasing role in this new revolution. A sound knowledge
of how computers work, process and analyze data has, therefore, become indispensable for everyone who
seeks employment not only in the area of IT, but also in any other fields. Rightly so, many institutions and
universities in India have introduced a subject covering Problem Solving and Python Programming for their
undergraduate students. This book caters to those needs of the undergraduate students.

Why learn Python?


Python is a high-level, interpreted, reflective, dynamically typed, open-source, multi-paradigm, and general-
purpose programming language. It is quite powerful and easy. It offers no special tools or features that let
you do things that you cannot do with other languages, but its elegant design and combination of certain
features make Python a pleasure to use.

What’s Special in this Book?


The book ensures a smooth and successful transition to a skilled expert in Python. This book uses a simple-
to-complex and easy-to-learn approach throughout the book. The concept of ‘learning by-solving’ has been
stressed in all the chapters of the book. Each feature of Python is treated in-depth followed by a complete
program example to illustrate its use. Wherever necessary, concepts are explained pictorially to facilitate
better understanding. It presents a contemporary approach to programming, offering a combination of theory
and practice.
Each of the 8 chapters follow a common structure with a range of learning and assessment tools for
instructors and students.

Salient Features of the Book


The salient features of the book include the following:
● Bottom-up approach of explaining concepts has been adopted in the book.
x Preface

● Algorithms and flowcharts have been discussed extensively in an appendix.


● Codes with Comments have been provided throughout the book to illustrate the use of various features
of Python.
● Supplementary Information and important notes that complement, but stand apart from the text, have
been included in special boxes under the head Notes.
● Always Remember consists of important summary points at the end of every chapter to help the readers
recollect the topics covered with ease.
● Check Your Understanding helps the readers evaluate their learning after every section within the
chapters of the book.
● Important Key Terms within the chapter have been listed at the end.
Review Exercises comprising Multiple choice questions along with answer keys, short questions and
programming exercises are provided at the chapter end to help readers test their conceptual understanding.

Organization of the Book


The book spans across eight chapters spread over 5 Units. The first two chapters introduces the learner to
digital computers–the basic structure, programming languages, operating systems, problem solving strategies
and conventional introduction to programming. The next six chapters present a more-or-less the conventional
introduction to programming. The readers learn about variables, types, statements, conditionals, loops,
functions, recursion, classes and inheritance. In all the chapters, first the basic ideas are explained, and
then the reader is led through a process of experimentation that helps them find and test the limits of their
understanding.

Publisher’s Note
Remember to write to us. We look forward to receiving your feedback, comments, and ideas to enhance
the quality of this book. You can reach us at info.india@mheducation.com. Please mention the title and
authors’ name as the subject. In case you spot piracy of this book, please do let us know.
Unit 1
Introduction to Computing and
Algorithmic Problem Solving

Chapter 1: Introduction to Digital Computer


Chapter 2: Problem Solving Strategies
Appendix A: Practice Exercises with Algorithm and Flow Chart
Appendix B: Problem Solving Exercises with Algorithms & Pseudocode
IntroductIon to
1 dIgItal computer

1.1 IntroductIon
In earlier days, the term “digital computer” was used to refer a person who drew mathematical tables and
solved complex calculations. In less than a human lifetime, computers have changed from massive, expensive
and unreliable calculators to the dependable and versatile machines that are now omnipresent in society.
Computers were once the size of rooms and used to take a day to change the program and now, it is just a
double click away. Computers help the impossible become possible. They have become a necessary tool in
today’s society. Without computers, it is hard to do pretty much anything. Computers process information in
1’s and 0’s (usually referred to as On and Off respectively). This operation identifies instructions in Binary
Code. This is the language understood by the computer to complete a command. By 1953, it was estimated
that there were almost 100 computers in the world.
It is believed that the first computer was invented in Berlin, Germany, in 1936.
● The Z1 was invented in 1936 by Konrad Zuse in Germany. This was a programmable machine that

was able to remember numbers. This process is now referred to as memory.


● IBM followed suit and introduced the Harvard Mark 1 which was completed at Harvard University in

1944. It was a large calculator. This computer was able to calculate many different types of numbers.
● With the advancement of technology and research, major companies like IBM, Apple, and Intel have

contributed to the explosion of the personal computers as we know today. For example, Apple 1 was
released in 1976 which was having memory of 4 KB expandable to 8 KB. The Macintosh was released
in 1984 which was having memory of 64 KB expandable to 256 KB.
● CSIRAC was the first computer to play digital music in 1949.

● UNIVAC 1 was used by CBS to predict the results of the 1952 presidential elections in USA.

● On December 2, 1954 IBM’s NORC calculated PI 3089 digits.

● In 1958, Jack Kilby invented the Integrated Circuit.

● COBOL (Common Business Oriented Language), one of the oldest programming languages, was

developed by Grace Murray Hopper in 1959,


● In 1962 Space War, the first computer game was written by MIT student Steve Russell.

● In 1975, the first personal computer Altair 8800 was invented.

● In 1976, Intel & Zilog introduced new microprocessors


4 Problem Solving and Python Programming

● Single - board computer known as apple -1 was designed by Steve Wozniak some more important
developments and was marketed by his friend Steve Jobs.
● In 1980 IBM introduced its Personal Computers (PC). The first IBM PC was known as IBM Model

5150, was based on a 4.77 MHz Intel 8088 microprocessor


● In 19993, Pentium microprocessor was released by Pentium followed by the release of Microsoft

window's NT
● In 1994 Sony entred the home gaming market with release of play station console.

● In 2006, Amazon web services launched cloud-based services.

A Personal Computer (PC) is a digital computer designed for the usage by one person at a time. PCs
can be classified into desktop computers, workstations and laptop computers. Today, PCs have five major
applications which are as follows:
1. Internet Browser: Internet browser is a software application used to access the Internet. For example,
Internet Explorer, Firefox, Opera, etc., are all Internet browsers.
2. Data Compression Software: Data compression software is used to reduce file size. ZIP is widely used
as the data compression software on personal computers.
3. Windows Media Player: Windows Media Player is used to create music libraries for listening music.
4. Image Editing Software: Image editing software is used to develop good quality pictures. Examples of
such software include Photoshop, Microsoft Publisher and Picasa.
5. Audio Editing Software: Audio editing software is used to edit audio files and also to add audio effects.

Check Your Understanding


1. What is a computer?
Ans. A computer is an electronic device capable of executing programs written in different languages.
2. What is the use of data compression software?
Ans. Data compression software is used to reduce file size.

Note The first personal computer was Altair 8800. Later IBM introduced IBM PC.

Computers have become an integral part of the society because of the following characteristics they
possess:
● A computer can perform millions of calculations in a second.

● A computer works with precision every time.

● A computer can store billions of bytes of information. For example, the capacity of a terabyte =

2,00,000 songs.
● A computer can work continuously without getting tired.

● A computer can be used to perform various tasks simultaneously.

● A computer will remember the information stored for as long as required.


Introduction to Digital Computer 5

1.2 Von neumann concept


In early computers, the data and instructions were not stored in the same memory. However, such storage
became possible in the Von Neumann architecture, also known as “stored program” architecture because
it could store the program and instruction data in the same memory. In the Von Neumann architecture,
computers can perform complex operations within less time. Besides performing calculations, they can
manage to do a sequence of calculations as well. The basic structure of Von Neumann architecture consists
of the memory, processing unit and the control unit.
The characteristics of Von Neumann architecture are as follows:
1. The hardware system comprises the following:
● Memory: In Von Neumann architecture, there is a main memory system – Random Access
Memory (RAM) which holds the data or program.
● Arithmetic Logic Unit (ALU): As the name suggests, this is useful in arithmetic and logical
calculations such as addition, subtraction, division and comparisons.
● Control Unit: In the central processing unit (CPU), there is a control unit (CU) managing
the process of data or program. The execution of the program is done by the Control Unit. For
example, the fetch-decode-execution.
Input-Output System: Using this system, an input is given and output is generated after

execution. The information can be stored by using compact disk (CD), floppy, etc.
2. Data or programs are stored into the main memory.
3. Processing of instructions is sequential.

Note A process describes how the processor takes the data or program, decodes it and
finally executes it. The fetch-decode-execute cycle is also known as the Von Neumann
execution cycle.

Check Your Understanding


1. Who developed the basic architecture of computers?
Ans. John Von Neumann
2. What do the following terms stand for?
CPU, ALU, CU, RAM
Ans. CPU: Control Processing Unit
ALU: Arithmetic Logic Unit
CU: Control Unit
RAM: Random Access Memory

1.2.1 A Simple Model of the Computer


A Computer system has three basic components which are as follows:
6 Problem Solving and Python Programming

1. Processor: It is also known as the Central Processing Unit (CPU). The processor is the brain of the
computer. It takes data in the form of input and processes this input using arithmetic or logical operations in
the ALU, thereby transforming it into the output.
2. Memory (Storage): Memory refers to the data storage, permanent or temporary. Computer memory
understands only two bits, 0 and 1. The temporary memory is called RAM and the permanent memory is
called Read Only Memory (ROM).
3. Input/Output: It refers to the communication mechanism. Input and output devices are significant portions
of the computer accessories. Input devices provide data to the computer as input from the external source
while output devices generate information for the user after processing the input.

Input Process Output

Storage

Figure 1.1 Model of Computer

TIP
Before buying a computer, one should check the processor speed. To determine the processing
speed of the CPU, the clock speed is checked. The CPU can perform a certain number of
clock cycles per second. The computer’s clock speed is measured in gigahertz (GHz). One
GHz equals to one billion cycles per second. A higher clock speed indicates that the CPU
can execute more operations per second.

Note The very first commercially produced and sold computer in 1951 was UNIVAC.

1.2.2 Components of the Digital Computer


A digital computer performs calculations and solves complex problems. Thus, it must be equipped with the
following components:
1. Input Devices: These are the devices through which the information is provided to the computer. There
are different types of input devices, such as keyboard, mouse, scanner, touch pad, etc.
2. Output Devices: These are the devices through which the output is being provided to the user. There are
different types of output devices, such as printer, speakers, screen, etc.
3. Processing Unit: CPU is the brain of the computer. It takes data in the form of input and processes it,
thereby transforming the data into output. A CPU basically consists of the following:
Introduction to Digital Computer 7

● Arithmetic Logic Unit (ALU): The ALU performs both arithmetic and logical operations including
addition, subtraction, division and bits manipulation.
● Registers: Registers hold values in the CPU. Each register has a unique name and is capable of
holding a byte or word of data.
● Control Unit: The Control Unit controls the operation of the CPU, the Memory and the input-output
components based on a sequence of instructions in the Memory.
4. External Memory: The External Memory is a physical device used to store programs (set of instructions)
or data temporarily or permanently for use in a computer or some other digital electronic device. It is
classified into two categories which are as follows:
● Primary Memory: The primary memory is also known as main memory. The program is loaded in
the main memory before it can be executed. The information within the Primary Memory can be lost
when power to the computer is turned off. Thus, the Primary Memory is volatile by nature.
● Secondary Memory: The secondary memory is a non-volatile, low-speed memory. The information
within this memory will not be lost even if the computer is turned off due to power failure. Examples
of secondary storage include hard disk, DVD, floppy drive, etc.
5. Bus: In a computer, all the components described above are connected by cables and each cable can only
send one bit at a time. These cables are called bus and are responsible for the movement of data from input
devices to output devices.

Keyboard

Control Unit Mouse


Main
Memory Input
Devices

ALU
Display
Registers Secondary
Memory
Printer
Storage Output
Devices
Central Processing Unit Bus
(CPU)

Figure 1.2 Components of Computer

Computers have become a huge part of our life nowadays. We use them every day to complete different
tasks. They are basically composed of two main things-the software and the hardware. The software has all
the instructions and information needed for the computer to run. This includes the operating system and the
programs or applications. The hardware consists of all the physical elements that make the computer work.
This includes the CPU, RAM, ROM, Cache etc.
8 Problem Solving and Python Programming

Let us imagine a restaurant. Every day a keeper comes to open the restaurant and makes sure everything is
ready and working well. Here, the keeper and the computer is called read-only memory or ROM which can
be modified. To keep everything running properly in a restaurant we need an administrator, this is the central
processing unit or CPU. It is called a microprocessor in cell phones and it contains the arithmetic logic unit
or ALU and the control unit or CU. The ALU in a computer is the manager who takes care of the numbers
and logical part. The control unit is the head chef who organises the incoming information and gets everyone
task. Let us see a customer making an order. The order acts as the input data. The waiter or data bus then
carries this information to the kitchen, and then goes to the head chef who decides where it should go further.
The kitchen represents the mother board inside, where there is a fridge and you keep everything that is used
frequently for easy access. This is called random access memory or RAM in a computer. Cache will be like
a small recipe book in which the computer keeps the frequently used instructions. There is also a warehouse
for rest of the information stored and this works as a hard disk. We can also get the things delivered through
the back door which acts as an optical disc in the computer. These are called the secondary storage devices.
Let us imagine, we also have a timer in the kitchen. Every time the timer starts, everyone starts preparing
a dish and has to get it done by the time gets over, so this keeps everything synchronised. In a computer, it
is called the internal clock.
We get an order, the buses carry it and it goes through the control unit in the CPU which supervises that
it reaches the right destination. If we need something that has been recently used, we can easily get it from
RAM, and if not, then the computer has to look for it in the secondary storage devices. The data is processed
now, and it is time for the chefs to turn into some delicious food that we can eat. This is the task of the video
card converting data into images. This is how our computer works.

Check Your Understanding


1. In which form does CD-ROM store information?
Ans. Digital form
2. What is the main difference between primary and secondary storage?
Ans. Primary memory is volatile while secondary memory is non-volatile in nature.
3. What is the working of Bus?
Ans. The Bus is responsible for movement of data from input devices to output devices.

1.3 Storage
The term Storage refers to memory that retains computer programs and data. There are basically two
categories of storage: primary and secondary.

1.3.1 Primary Storage


It is also known as the temporary storage since it is a short-term memory. There are three types of primary
storage:
1. RAM (Random Access Memory): The RAM is a very important part of the computer. It stores the data
accessed by the CPU. The RAM is the place where the programs or data in current use can be kept. This
memory is volatile in nature as the information within it is lost when power to the computer is turned off.
RAM is also known as working memory or main memory.
Introduction to Digital Computer 9

Figure 1.3 Random Access Memory

2. ROM (Read Only Memory): The Read Only Memory gets its name from the fact that the computer can
only read information from it but cannot write any information on it. A part of the operating system is
stored in ROM. When the computer system is turned on, the CPU executes instructions stored in ROM.
The information stored in ROM cannot be changed and will not be lost even if the computer is turned off.

Figure 1.4 Read Only Memory

3. Cache Memory: Cache memory stores the data recently processed by the CPU. The size of cache is very
small and execution is very fast. In order to process an application, processor first searches the cache memory
and then, the RAM.

Figure 1.5 Cache Memory


10 Problem Solving and Python Programming

1.3.2 Secondary Storage


Secondary storage is also known as the permanent storage. It is not constantly accessible to a computer
system. When required, secondary storage devices and media can be accessed by plugging or inserting them
into a computer. Examples of secondary storage include the hard drive, DVD, memory card etc. Secondary
storage is like long-term memory since the data remains stored in the secondary storage device even after
the computer is shut down.
The various types of secondary storage are:
1. Hard disks: Hard Disk or Hard Disk Drive (HDD) stores and provide relatively quick access to large
amounts of data on an electromagnetically charged surface or set of surfaces.
2. Floppy Disc: A floppy disc consists of a plastic case inside which there is a very thin piece of plastic coated
with microscopic iron particles. Floppy discs store very less data—a maximum of 1.44 MB.

Figure 1.6 Floppy Disc

3. Flash Drive: A flash drive can be inserted into a USB port for data retrieval and data storage. It is small
in size and portable. Nowadays, flash drive comes in many shapes.

Figure 1.7 Flash Drive


Introduction to Digital Computer 11

4. Memory Card: A memory card is a very small data storage medium. It is portable and can be used in
remote computing devices.

Figure 1.8 Memory Card

5. Compact Disc: A compact disc is a kind of optical disc used to store digital data. Data can be accessed
faster here compared to the floppy discs, but it is still slower than the hard discs. A compact disc stores the
same data as a floppy disc does.

Figure 1.9 Compact Disc


12 Problem Solving and Python Programming

Note An early method used to store data or information in the computer was the Punch
card. The machine Analytical Engine invented by Charles Babbage had a punched card
system to store and retrieve information.

1.3.3 Register
It contains the address of the memory location where data resides. Register is highly accessible by the CPU.
Speed of the CPU is determined by the number of registers it has.
Memory hierarchy is the arrangement of the storage in a computer. Each level of memory hierarchy is
distinguished by the response time. It is illustrated in Figure 1.10.

Regs Small, fast, expensive

Cache

Main Memory

Disk/Virtual Memory

Tape, Remote Access, etc. Large, slow, cheap

Figure 1.10 Memory Hierarchy

Check Your Understanding


1. How can memory be measured?
Ans. A byte is the unit of memory of a computer. The smallest unit of memory is bit.
1 byte = 8 bits
1 kilobyte = 1,024 bytes
1 megabyte = 1,024 kilobytes
1 gigabyte = 1,024 megabytes
1 terabyte = 1,024 gigabytes

1.4 programmIng LanguageS


A computer language is used to make a computer understand what the user wants to say. When a user writes
a program, he/she uses the computer language.
A program, written in a programming language, is a set of instructions by which the computer comes
to know what is to be done. It is a coding language used by programmers to write the instructions that a
computer can understand.
Introduction to Digital Computer 13

There are three types of computer languages as illustrated in Figure 1.11.


● High-level Language
● Assembly Language
● Machine Language

1.4.1 High-level Language


Symbolic languages are very tedious to work with because each machine instruction needs to be coded
individually. High-level languages on the other hand uses English-like languages allowing the programmer
to focus on application problems instead of focusing on the intricacies of the particular computer. High-
level languages are converted into machine level language using a converting software called compiler. It
is a computer programming language that does not requires great efforts from the programmer. It is called
high-level language because it is close to the user. The first high-level language used was FORTRAN, which
was followed by COBOL.

1.4.2 Assembly Language


Assembly language is a low-level programming language. It is more machine friendly and requires more
efforts from the programmer. Assembly (or symbolic) language closely resembles machine language.
Symbols and mnemonics are used in this language to represent various machine language instructions.
Assembly language is directly converted into binary language and is machine-dependent.
This language is known as symbolic language because of the symbols it employs. Since the computer
does not understand symbolic language, a program called assembler is used to translate the symbolic code
into machine language, and is the reason why it is called assembly language.

1.4.3 Machine Language


Machine language consisting of 0s and 1s, was the earliest mode of programming language. The computer
understands only 0’s and 1’s because it is made of switches, transistors, and other electronic devices which
can only be in the state of either on or off. The off state is represented by 0 and on state by 1. A machine
language is a low-level computer programming language and is more machine friendly. This language is
known as machine language because it is close to the machine.

Programming Languages

Low-Level Languages High-Level Languages

Machine Assembly
Language Language

Figure 1.11 Programming Languages


14 Problem Solving and Python Programming

Check Your Understanding


1. What do you mean by a programming language?
Ans. A programming language is a coding language used by the programmers to write instructions
that a computer can understand and act on.

TIP
If you want to learn programming languages, first choose a language that you want to
learn. After that, you need to learn the core concepts of that language. Install the software
that is required to compile the program. Now, create your first program.

1.5 tranSLatorS
A translator is a computer program that can instantly translate between any languages. It converts program
language to machine level language for the debugging and execution of the programs. While the computer
understands only binary code i.e. 1’s and 0’s, it is not easy for humans to read and write in such code. So,
the translators are used to translate a computer program into binary code. There are three types of translator
programs, namely Compiler, Assembler, and Interpreter.

1.5.1 Compiler
A compiler is very important in giving the application a performance boost. The compiler of a language is
a computer program that converts the source code of an application written in the computer programming
language to the target language with its binary form.
The compiler checks for syntax errors in a source code of a program. If no error is found, the program
is declared to be successfully compiled. If the program does not contain any syntax error, the compiler
translates the source code of the program into the machine language of the computer, so that the computer
is able to understand the instructions given to it.
Source files are the program files created by a programmer. They contain information and instructions
written by the programmer, which are checked by the compiler during the process of compilation. These
source files are compiled by a compiler and run with an executable file.

1.5.2 Assembler
To translate the assembly language into machine language, a translator is needed. This translator is also
called an assembler. Each assembly language is unique to the particular computer architecture. In assembly
language, we use some mnemonic such as ‘add’, ‘sub’, ‘mul’ etc. for all the operations.
For example, if we want to add 4 and 3, then in assembly language, we will write Add 4 3 where Add
is a mnemonic and both 4 and 3 are the arguments of the operand. Now, the assembler will map this to the
binary code.
Introduction to Digital Computer 15

1.5.3 Interpreter
Like a compiler, an interpreter also translates high-level language into low-level machine language. An
interpreter reads the statement and first converts it into an intermediate code and executes it, before reading
the next statement. It translates each instruction immediately one by one. This is a rather slow process
because the interpreter has to wait while each instruction is being translated.
The interpreter stops execution at the time of error occurrence and reports it, whereas a compiler reads
the whole program even if it encounters several errors.

Check Your Understanding


1. What is the difference between a compiler and an interpreter?
Ans: An interpreter translates each instruction one by one, while a compiler reads the whole program
first and then translates it into the machine language.

1.6 Hardware and Software


Computer systems have become an essential part of our life. Most of our work is done with the help of
computer system in a fast and efficient manner. Hardware refers to the tangible objects that can be run
using software. Software refers to a set of instructions to the computer. Without hardware, software cannot
work and vice versa. For example, a car without a driver is like hardware without software. Software tells
hardware what to do and how to do it. To reiterate, the computer system is made up of two major components:
Hardware and Software that are essential for functioning of the system.

1.6.1 Hardware
Hardware are the physical components of the computer system. The hardware components consist of several
parts like input devices, Central Processing Unit (CPU), primary storage, output devices and auxiliary
storage devices.
1. Input Devices: These are the devices such as keyboards that are used to enter the program and data. Mouse
and audio input also fall in the category of input devices.
2. CPU: It processes all the instructions given to the computer and is also used for doing arithmetic
calculations and comparisons, and for controlling the movement of data.
3. Primary Storage: It is the main memory of the computer system. In primary storage, programs and data
are stored temporarily for processing. The data in the primary device is erased when the computer is turned
off.
4. Output Devices: Devices such as monitor or printer are used to get the output.
5. Auxiliary Storage: Programs and data are stored permanently in auxiliary storage. It is also known as
secondary storage and used for both input and output. This storage is very useful as the data remains stored
even when the computer is turned off.
16 Problem Solving and Python Programming

1.6.2 Software
Computer software is a collection of programs used to manage the entire file system of the computer. It is
also necessary for the running of computer hardware. The working of the computer hardware depends on
the computer software. Computer software is classified into two categories, namely, System software and
Application software.
1. System Software: The system software provides interface between the user and the hardware (components
of the computer). It also manages the system resources, enabling the working of all hardware components
(hard disk, RAM, CD drive, etc.) of the computer. Computer hardware resources are managed through this
system software with the help of programs.
These programs fall into following three types:
● Operating System: It provides the interface between the user and computer hardware, managing
all files and folders, and providing ease of access to the database. The operating system makes the
computer perform efficiently.
● System Support Software: It provides all the services of the operating system and system utilities.
For example, disk format program is the system utility made to do the formatting of the storage. Other
services include data encryption and bit lock for locking storage devices.
● System Development Software: It works as a language translator that converts program language to
machine level language for debugging and execution of the programs.
2. Application Software: The application software runs under the system software. It helps the user to solve
problems. It can be further classified into general-purpose software and application-specific software.
● General-Purpose Software: It refers to software meant to be used for more than one application.
For example, Word Processor.
● Application-Specific Software: As the name suggests, it refers to software generally used for
a specific, intended purpose. For example: a general account ledger used by the accountants for
managing accounts.
The examples of application software are as follows:
a) Microsoft Internet Explorer
b) VLC Media Player
c) Adobe Reader X

Note Auxiliary storage is very useful since when the computer is turned off, the data
remains in the secondary storage, ready for the next time we need it.

Check Your Understanding


1. What is System Software?
Ans: System software is a part of software. It helps the computer function properly. It also controls
the computer hardware operations.
2. What is Hardware?
Ans: Computer hardware is the collection of all the parts that can be physically touched. For example:
motherboard, CPU, RAM, etc.
Introduction to Digital Computer 17

1.7 operatIng SyStemS


An operating system is a software environment in which the program runs. Most of the operating systems
are described as a combination of the software and the underlying hardware. The operating system works as
an interface between hardware and user. It controls file and database access besides providing the interface
to communication systems such as internet protocol. The working together of the various hardware and
software can only be achieved by the operating system. It is the mother of the computer without which
computer is nothing more than blank box. The functioning of every component of the computer depends on
the operating system.
Some commonly used operating systems are Windows 98, Windows server 2000, Windows XP, Windows
Vista, Linux, Ubuntu, UNIX, Macintosh (for apple computer), Windows 7, and Windows 8.
The main functions of an operating system includes:
1. The main objective of the operating system is to ensure the efficient working of the computer system
and to stimulate various hardwares.
2. The operating system performs basic tasks, such as taking input from the keyboard, displaying output
on the screen, managing files and operation on files on disk drives, and managing other devices
including keyboard, mouse and printers.
3. The operating system can enable users to do multitasking. Multitasking refers to the situation where
two or more than two programs can run simultaneously on a single operating system.
4. The operating system also allows users to do multithreading. Multithreading refers to the situation
where two or more parts of the single program can run concurrently on single operating Systems.
5. The users can interact with the operating system with the help of commands.
Figure 1.4 shows the operating system and the range of tasks it performs. Without an operating system,
the computer system becomes useless.

Operating System

Drives
(C:, D:, E: etc.) Monitor

Mouse Application or Program

Keyboard Printers

Figure 1.12 Operating Systems and Related Task


18 Problem Solving and Python Programming

ALWAYS REMEMBER
● The Von Neumann architecture is also known as “stored-program” architecture because in this architecture,
the program data and instruction data are stored in the same memory.
● The basic structure of Von Neumann architecture consists of the memory, the processing unit and the
control unit.
● In the central processing unit (CPU) there is a control unit that manages the process of data or program.
● Input devices are used to give data to the computer as input from the external source.
● Output devices are used to convey the information after processing to the user.
● Primary storage is also known as temporary storage and is used for storing data and programs temporarily.
● Secondary storage is also known as permanent storage. Examples of secondary storage include the hard
drive, DVD and memory card.
● The computer understands only machine language. All instructions are written in 1s and 0s form.
● When a high-level language is translated into machine language, there are two ways to translate it:
compiled or interpreted.
● Hardware is the physical component of the computer system. It consists of several parts including input
devices, CPU, primary storage, output devices and auxiliary storage devices.
● Computer software is used to manage the entire file system of the computer and is necessary for the
running of computer hardware.
● The operating system can allow users to do multitasking, by allowing two or more than two programs to
be run simultaneously on a single operating system.
● The compiler checks for syntax error in a source code of a program.
● The interpreter stops execution when an error occurs and reports it, whereas a compiler reads the whole
program even if it encounters several errors.

KEY TERMS
✓ ARITHMETIC LOGIC UNIT (ALU): It is useful in arithmetic and logical calculations, such as addi-
tion, subtraction, division and comparisons.
✓ ASSEMBLER: It translates the assembly language to machine language.
✓ BIT: Bit is the smallest storing space in the computer. In a computer, bit represents two states: either
“on” or “off”. It represents two numerical digits “0” and “1”.
✓ BYTE: A group of 8 bits form a byte. A computer’s capacity is measured in terms of bytes.
✓ BROWSER: A browser is a software used to access the Internet. For example, Internet Explorer, Mozilla,
Opera, etc.
✓ CENTRAL PROCESSING UNIT (CPU): It takes data in the form of input and processes the input by
some arithmetic or logical operations using ALU, transforming the data into output.
✓ COMPUTER: A computer is an electronic device that is able to execute programs written in different
languages.
Introduction to Digital Computer 19

✓ COMPILER: A compiler is a software program that converts high-level language into low-level lan-
guage understood by the processor.
✓ INTERPRETER: Just like a compiler, an interpreter also translates high-level language into low-level
machine language. It translates each instruction immediately one by one.
✓ OPERATING SYSTEM: Operating system works as an interface between the hardware and the user.
✓ PROGRAM: A program, written in programming language, is a set of instructions by which computer
comes to know what is to be done.
✓ STORAGE DEVICE: Storage devices are used to store the digital data and programs which can be ac-
cessed by the computer system.
✓ PRIMARY STORAGE: Primary storage is also known as temporary storage. It is used for storing data
and programs temporarily.
✓ SECONDARY STORAGE: Secondary storage is not constantly accessible by a computer system.
When required, secondary storage devices and media can be accessed by plugged or inserting them into
a computer.
✓ SOFTWARE: A software is a collection of programs. Computer software is used to manage the entire
file system of the computer and is also necessary for the running of computer hardware.
✓ HARDWARE: Hardware is the physical component of the computer system.

REVIEW EXERCISES
Multiple Choice Questions
1. Which was the first microcomputer?
a. Altair 8800 b. Altair 8600
c. Altair 8400 d. Altair 8000
2. Which of the following comprises Von Neumann architecture?
a. Arithmetic logic unit, control unit b. Memory, processing unit, control unit
c. Integrated Circuits, Monitor, Mouse d. Processing unit, control unit
3. Which of the following are the components of the Central Processing Unit (CPU)?
a. Control Unit, Monitor b. Arithmetic logic unit, Memory
c. Control Unit, Memory d. Arithmetic logic unit, Control Unit
4. Which storage device is permanent?
a. Tertiary b. Primary
c. Secondary d. None of the above
5. Which of the following languages is Assembly language?
a. Machine language b. Medium-level programming language
c. Low-level programming language d. High-level programming language
6. Which of the following programs can be used to convert high-level language into machine-level
language?
a. Assembler b. Compiler
c. Translator d. Interpreter
20 Problem Solving and Python Programming

7. What works as an interface between the hardware and the user?


a. Operating System b. Software
c. Computer d. Memory
8. Where are the saved files stored in the computer?
a. Cache b. RAM
c. Hard disk d. ALU
9. Which component of computer is considered as its Brain?
a. Microprocessor b. Monitor
c. Keyboard d. CPU
10. Which type of software is system software?
a. General purpose software b. Operating System
c. Application software d. All of the above
11. If two or more parts of the single program can run concurrently on single operating systems, what will
it be known as?
a. Multithreading b. Multitasking
c. Multiprocessing d. Multiprogramming
12. Which of the following types of software is application software?
a. Compiler b. Assembler
c. Word processor d. All of the above
13. RAM stands for?
a. Read Access Memory b. Random Access Memory
c. Read Arithmetic Memory d. Random Arithmetic Memory
14. What is a register?
a. Set of paper tapes b. Set of capacitor
c. Part of auxiliary memory d. Temporary storage unit within the CPU
15. An error in computer data is called?
a. CPU b. Chip
c. Bug d. Storage device
16. The secondary storage devices can only store data but they cannot perform?
a. Logic operation b. Arithmetic operation
c. Fetch operation d. Either of the above
17. Which of the following is not a computer language?
a. Low level language b. Medium level language
c. High level language d. Machine language
18. From where the term ‘computer’ is derived?
a. English b. Greek
c. Latin d. Sanskrit
19. Main storage is also known as?
a. Memory b. Mother board
c. CPU d. Register
20. Which American computer company is called Big Blue?
a. Apple b. Microsoft
c. Lenovo d. IBM
Discovering Diverse Content Through
Random Scribd Documents
Mr. Bowers stared at Helen in undisguised astonishment. She must
have had a very brilliant offer to warrant her in making such a
proposal.
“Did I understand that you have had no other engagement offered
you?” he inquired, abruptly.
“No, sir. I do not wish to sing any more in public.”
“It will pay you better than anything else you can do.”
“I ought to explain that I have had a fortune left me, or rather papa
has, and under our new circumstances it would be inconvenient for
me to come to the theatre every evening.”
“Indeed, Miss Ford!” said Mr. Bowers, his tone changing. “I
congratulate you. I hope, for your sake, it is a large fortune.”
“Mr. Sharp tells me that it will be a few hundred thousand dollars,”
said Helen, simply, without the least trace of exultation in her tone.
“A few hundred thousand dollars!” exclaimed Mr. Bowers, in
profound astonishment. “Pray, take a seat, my dear Miss Ford. Hang
my stupidity, why didn’t I think to offer you one before?”
And Mr. Bowers bustled about, and offered Helen a seat with as
much deference as if she were a duchess. It was easy to see that
she had risen immeasurably in his estimation.
“Did the property come from a relation?” he asked.
“Yes, sir; from my grandfather.”
“Was his name the same with yours, Miss Ford?”
“No, sir. His name was Rand.”
“Not the late Gerald Rand?”
“Yes, sir.”
“Why he was one of our most substantial citizens—lived on Fifth
Avenue. And to think I should have had his granddaughter singing in
my theatre! Well, wonders will never cease.”
“If it wouldn’t inconvenience you too much to release me,” said
Helen, returning to her petition; “I like to be with papa in the
evening. He is lonely without me.”
“By all means, Miss Ford, I would oblige you even were the
inconvenience ten times as great,” said Mr. Bowers, obsequiously.
“Thank you, sir; you are very kind. I shall be willing to sing for you
the rest of the week, so as to give you time to find some one to fill
my place.”
“Will you?” asked the manager, eagerly, seeing at once how he
might turn Helen’s accession of fortune to profitable account; “you
will indeed confer a great favor upon me by so doing. It will take me
some time to fill your place, and I cannot hope to obtain a substitute
who will become such a favorite with the public.”
“Thank you, sir,” said Helen, rising to go. “Then I will go to
rehearsal.”
“Thank you rather, my dear Miss Ford,” said the manager, rising from
his seat and opening the door for her. “I shall not forget your
kindness.”
Helen could not help wondering a little at the change in the
manager’s manner, and, unversed as she was in the ways of the
world, she could not help seeing that it was the result of her change
of circumstances.
Meanwhile the manager was not idle. The morning papers contained
the following paragraph, the authorship of which may at least be
suspected.
Romance in Real Life. We understand that Miss Helen Ford, the young vocalist
whose charming melodies have made her such a popular favorite, has just come
into possession of a splendid fortune, inherited from her grandfather, Gerald Rand,
Esq., the well-known capitalist, whose death was recently noticed in our columns.
Miss Ford has kindly agreed to sing as usual through the present week, when she
will leave the stage forever.
The effect of this paragraph may be imagined. That evening
hundreds were turned away from the theatre, which was crowded to
its utmost capacity. Never had such an audience been seen within its
walls. When Helen appeared on the stage, quite unaware of the
paragraph which had produced this effect, she was received with
long-continued applause. The vast audience seemed inspired with a
sudden enthusiasm.
Helen was surprised, but did not lose her self-possession. She sang
with her usual sweetness, and was immediately encored. Again she
sang, and this time was called before the curtain. Several bouquets
were thrown her, which she picked up, and hastily withdrew.
If Helen had been older, she would have understood the meaning of
this ovation. As it was, she only wondered.
Behind the curtain she met the manager, smiling, and rubbing his
hands in evident glee.
“My dear Miss Ford,” he said, “this is indeed a triumph.”
“The house is very full,” said Helen.
“And hundreds turned away; never was such a house seen.”
“I am very glad of it,” said Helen.
“So am I; let me see, this is Tuesday evening. Friday you shall have
a benefit. One third of the receipts. It is only fair, since you have
drawn this immense audience.”
Helen would have declined the offer, but for a sudden thought.
When she first became connected with the theatre she noticed a thin
fragile girl, who danced between the plays. The exertion was
evidently too great for her, for she was often seized with a violent fit
of coughing after withdrawing from the stage. For a fortnight Helen
had missed her. On inquiry, she learned that Alice (this was her
name) was sick. “Poor girl,” added the prompter, who was her
informant, “it is a great misfortune, for she has an invalid sister who
is dependent upon her for support. I am afraid she won’t get along
very well, for her salary was small, and now it is cut off altogether.”
It occurred to Helen that she could give the proceeds of her benefit
to Alice. She accordingly thanked Mr. Bowers, and accepted his
proposal.
The week was a series of triumphs. Every evening the doors of the
theatre were besieged, and every evening hundreds were turned
away.
Friday evening,—the evening of her benefit,—Helen found the house
fuller, if possible, than before, the manager had taken the
opportunity, in consequence of the great demand for seats, to raise
temporarily the price of admission. As he anticipated, this did not in
the least diminish the throngs who crowded for admittance.
On Saturday morning he handed Helen a check for five hundred
dollars, as her share of the proceeds.
Helen’s eyes sparkled with joy, as she thought of the happiness
which this sum would bring to the poor ballet girl.
She lost no time in seeking her out.
It was indeed a poor place, Helen would have been afraid of
venturing into such a locality if she had not been accompanied by
Herbert Coleman.
Up a rickety staircase she climbed, and was shown, by an untidy
woman, into a room wholly destitute of comforts, where on a pallet
reclined Alice and her sister, both sick.
“Is that you, Miss Ford?” asked Alice, her face lighting up. “How very
kind you are to come and see me!”
“I am very sorry to find you so sick,” said Helen.
“I don’t think I am very sick,” said Alice. “But this is but a poor place,
and I cannot get any one to take care of my sister Jennie. She has
been an invalid for years.”
“There are better times in store,” said Helen, cheerfully, “First we
must have you moved to a better room. Next you must have a
nurse.”
“But,” said Alice, hesitatingly, “we are very poor. I never had
anything but my salary to depend upon, and now that is cut off.”
Helen stooped and whispered a few words in her ear.
“Five hundred dollars!” repeated Alice, in astonishment, “that is a
fortune. Who has been so generous?”
“Never mind!” said Helen, smiling. “You see, then, that you are not
so poor as you imagined. Now do you think, if I sent a carriage for
you in the course of the afternoon, you can move?”
“Yes,” said Alice, in a tone of deep thankfulness. “No one can tell
how much I detest this horrible place. I think it will make me well
only to move.”
Over the wasted face of her sister there stole an expression of deep
and thankful joy.
“I think you are an angel,” she said, looking up into Helen’s beautiful
face, radiant with sympathy.
Helen blushed.
“How pleasant it is to be able to make others happy!” she said,
softly, to Herbert.
“Do you know, Helen,” said the young artist, “I am half tempted to
agree with your patient there.”
“Brother Herbert,” said Helen, quickly, “you must not speak so. I am
only doing what you would do in my place. I don’t like to be praised
for only doing what is pleasant to me.”
Before night Alice and her sister were installed in a comfortably-
furnished room, with a nurse in attendance, who was directed to do
whatever was needful for the comfort and relief of her patients.
CHAPTER XLV.
TO CONCLUDE.

Four years slipped by.


Let us note, briefly, the changes which they brought, and then
farewell!
To Helen they were years of quiet happiness, of steady
improvement. There were many deficiencies in her education to be
made up. With the aid of private instructors, the best of their kind,
she strove earnestly to acquire the knowledge for which she had
long thirsted. Her father was unwilling to send her away to school,
since this must deprive him of her society, on which he had learned
to depend. Nor was Helen less unwilling to leave the father who had
called forth from her so rare and beautiful a devotion. Year by year
her mind has expanded, while her rare loveliness has, if possible,
been enhanced. Helen, at nineteen, is even more charming than at
fifteen.
There are some who have found this out, and Helen has had
repeated offers of marriage. All these she has gently but firmly
refused. Not one has succeeded in touching her heart.
Among her suitors was one whom she treated with less ceremony. A
young man, who had nearly run through a large fortune, paid
assiduous court to Helen, whom he had met in society, and in spite
of her coldness made a declaration of love.
Helen looked up from the carpet on which her eyes had been fixed,
and said, quietly, “Do you remember, Mr. Grover, where we first
met?”
“At Mrs. Grosvenor’s party,” answered the young man, somewhat
surprised.
“You are mistaken. That was only three months since. Our first
meeting dates back four years.”
“Thank you for remembering it. Yet I can hardly believe you correct.
Your face is not one to be forgotten. Are you quite sure?”
“Yes, I remember you perfectly.”
There was something in Helen’s manner which the young man could
not quite fathom. It made him uneasy, for Helen’s grave tone
rendered it doubtful whether the recollection was a pleasant one.
“May I ask where, and under what circumstances, we met?” he
inquired.
“I was, at that time, singing at the —— Theatre,” returned Helen,
composedly. “You followed me in the street when on my return
home, and sought to force your company upon me. But for the
opportune arrival of a friend, I should have been obliged to submit
to the insult.”
“Good heavens!” ejaculated Albert Grover, “are you the young singer
who made such a sensation? I cannot understand it.”
“Fortunes have changed with me,” said Helen. “Otherwise, I can well
understand that you would never have honored me with your
proposal of this morning. I think, Mr. Grover, you will hardly require
any other answer.”
She left the room with dignity, leaving her suitor crestfallen, and
entirely satisfied of the hopelessness of his suit.
Meanwhile, where was Herbert Coleman?
Shortly after Mr. Ford’s accession to fortune, he sent for the young
artist at Helen’s instigation, and questioned him delicately as to his
plans and wishes. Herbert acknowledged frankly his conviction, that
a residence in Italy, the cradle of art, would be of inestimable
advantage to him in his professional career.
“I have thought of that,” said Mr. Ford, “and as Providence has
blessed me with abundant means I have determined to enable you
to gratify your desire. I do not wish to compromise your
independence, and therefore I will not offer to give you the requisite
sum. I should be glad to have copies of some of the masterpieces of
Italian art. I am willing to invest five thousand dollars in this way. I
will give you the commission. This will enable you to spend three
years abroad. Here is a check for a thousand dollars. The balance I
authorize you to draw upon me for as you need it.”
“Sir,” said Herbert, with joyful emotion, “your generosity overwhelms
me. I cannot express to you how happy you have made me. I hope
that I shall prove deserving of such kindness.”
“You must thank Helen,” said Mr. Ford. “She suggested this to me;
though I think she will do me the justice to acknowledge that she
did not find me very difficult to persuade.”
“Dear Helen,” said the young artist, turning to the young girl whose
beaming face expressed how heartily she sympathized in his joy, “I
am not surprised to hear this. It is so like you.”
“Don’t say any more, Herbert,” said Helen, softly. “That repays me.”
Herbert’s residence in Italy has been protracted somewhat beyond
the three years originally intended. He has already sent home
several paintings, originals, as well as copies, which prove
conclusively that he has not mistaken his vocation. He has
corresponded regularly with Helen, and she is eagerly expecting his
return in the next steamer. They have tacitly dropped the old
designations of brother and sister. Knowing what we do of their
feelings towards each other, we need not be surprised if they are
bound some day by a nearer tie. Mr. Ford, I am assured, will
interpose no objection, feeling that genius and nobility of soul far
outweigh the mere accident of riches.
Mr. Ford has long since given up his invention as impracticable. He
has gathered about him a rich library in which he spends the hours
formerly given to science. A year since he laid out the plan of a large
work in the department of mechanics upon which he is hard at work.
It will probably require some years to complete it.
Mr. Sharp still acts as the business agent of Mr. Ford, and through
his influence has obtained other business, so that he is now in
receipt of a very comfortable income. Justice compels me to state
that in spite of his not very creditable antecedents, he serves Mr.
Ford with ability and fidelity, and exhibits a good judgment in his
management of money matters, which perhaps could hardly have
been expected. He is not entirely rid of his “idiosyncrasies,” but
these are now of a harmless nature. He no longer runs up bills which
he is unable to liquidate, and has ceased to exercise his professional
sharpness on the newsboys.
Martha Grey still finds a home with Helen, and is her tried and
confidential friend. She is no longer obliged to labor hard for a
scanty remuneration. Her “lines have fallen in pleasant places.”
Privation and discomfort have been succeeded by ease and luxury. A
month since she was surprised by a proposal of marriage from Mr.
Sharp. She refused him gently, telling him that she should never
marry. I do not think she will. She has never recovered from an early
disappointment, which, without robbing her of happiness, has made
it impossible for her to love again. Mr. Sharp has resigned himself to
his rejection with commendable philosophy. There is reason to
believe that he was actuated less by a romantic attachment, than by
the thought that Martha, as the intimate friend of Helen, would not
come to him a portionless bride. He has already so far recovered
from his disappointment, that he is paying devoted attentions to a
wealthy widow, who seems disposed to smile upon his suit, whose
“idiosyncrasies” of temper are such, that success would indeed be
disastrous. I have had some qualms of conscience, in rewarding Mr.
Sharp with such a measure of worldly prosperity, feeling that he
ought rather to have been punished than recompensed; but if he
should persevere in his present suit, and eventually succeed, I feel
that the sternest advocate of “poetical justice” may well be satisfied.
Mrs. Morton still keeps her boarding-house, and still meets with a
fair share of patronage. Helen occasionally calls upon her. She has
not forgotten her kindness in the days when she stood in need of a
friend. M’lle Fanchette is still one of her lodgers. She does not grow
old, having been twenty-seven for the last fifteen years. She brings
her charms to bear upon each successive lodger whom she regards
as eligible, but no one has yet had the courage to propose. There is
reason to believe that she will remain Mademoiselle to the end of
this chapter.
Margaret and Jacob Wynne! I name Margaret first, for hers is the
nobler nature. Jacob’s brief imprisonment had a most salutary
influence upon him. He no longer upbraids without reason, nor
arouses her quick jealousy by his neglect. Mr. Ford (after all we
prefer the old name) throws considerable business into his hands,
and this, with what he obtains from other quarters, gives him a
comfortable support. It would be difficult to recognize in Margaret,
with her quiet look, and subdued demeanor, the wild, wayward,
desperate woman, who made her way through the fierce storm to
her mother’s dwelling.
Immediately after the division of the estate, Lewis Rand went to
Europe, where he has remained ever since. His feelings are so
imbittered against his cousin, that he has refused to answer a letter
containing overtures of reconciliation. He makes his head-quarters at
Paris, where he lives in elegant style, and receives the homage
which wealth always commands. But does he find in his riches the
full satisfaction which he anticipated? I answer, no. He finds, too
late, that happiness must be earned; it can never be bought. To
those who, like Helen, consecrate their lives to the noblest objects,
and study to promote the happiness of all around them, the blessing
comes unsought. For the love that stimulates to good deeds, is like
mercy “twice blest; it blesseth him that gives and him that takes.”
And so, reader, farewell! What remains in store for Helen Ford,
whether of joy or of sorrow, it is not mine to read. Let us hope that
her life may brighten continually till its close; that her years, whether
few or many, may be made happy by the consciousness of duty well
performed; that she may dispense liberally unto others of the good
gifts with which God has crowned her, and make her life a
benefaction to humanity!
HORATIO ALGER, JR.

The enormous sales of the books of Horatio Alger, Jr., show the
greatness of his popularity among the boys, and prove that he is one
of their most favored writers. I am told that more than half a million
copies altogether have been sold, and that all the large circulating
libraries in the country have several complete sets, of which only two
or three volumes are ever on the shelves at one time. If this is true,
what thousands and thousands of boys have read and are reading
Mr. Alger’s books! His peculiar style of stories, often imitated but
never equaled, have taken a hold upon the young people, and,
despite their similarity, are eagerly read as soon as they appear.
Mr. Alger became famous with the publication of that undying book,
“Ragged Dick, or Street Life in New York.” It was his first book for
young people, and its success was so great that he immediately
devoted himself to that kind of writing. It was a new and fertile field
for a writer then, and Mr. Alger’s treatment of it at once caught the
fancy of the boys. “Ragged Dick” first appeared in 1868, and ever
since then it has been selling steadily, until now it is estimated that
about 200,000 copies of the series have been sold.
—“Pleasant Hours for Boys and Girls.”

A writer for boys should have an abundant sympathy with them. He


should be able to enter into their plans, hopes, and aspirations. He
should learn to look upon life as they do. Boys object to be written
down to. A boy’s heart opens to the man or writer who understands
him.
—From “Writing Stories for Boys,” by Horatio Alger, Jr.

RAGGED DICK SERIES.

6 vols. By Horatio Alger, Jr. $6.00

Ragged Dick.
Fame and Fortune.
Mark the Match Boy.
Rough and Ready.
Ben the Luggage Boy.
Rufus and Rose.

TATTERED TOM SERIES—First Series.

4 vols. By Horatio Alger, Jr. $4.00

Tattered Tom.
Paul the Peddler.
Phil the Fiddler.
Slow and Sure.

TATTERED TOM SERIES—Second Series.

4 vols. $4.00

Julius.
The Young Outlaw.
Sara’s Chance.
The Telegraph Boy.

CAMPAIGN SERIES.

3 vols. By Horatio Alger, Jr. $3.00

Frank’s Campaign.
Charlie Codman’s Cruise.
Paul Prescott’s Charge.

LUCK AND PLUCK SERIES—First Series.

4 vols. By Horatio Alger, Jr. $4.00

Luck and Pluck.


Sink or Swim.
Strong and Steady.
Strive and Succeed.

LUCK AND PLUCK SERIES—Second Series.

4 vols. $4.00

Try and Trust.


Bound to Rise.
Risen from the Ranks.
Herbert Carter’s Legacy.

BRAVE AND BOLD SERIES.

4 vols. By Horatio Alger, Jr. $4.00

Brave and Bold.


Jack’s Ward.
Shifting for Himself.
Wait and Hope.

VICTORY SERIES.

3 vols. By Horatio Alger, Jr. $3.00

Only an Irish Boy.


Adrift in the City.
Victor Vane, or the Young Secretary.

FRANK AND FEARLESS SERIES.

3 vols. By Horatio Alger, Jr. $3.00

Frank Hunter’s Peril.


Frank and Fearless.
The Young Salesman.
GOOD FORTUNE LIBRARY.,

3 vols. By Horatio Alger, Jr. $3.00

Walter Sherwood’s Probation.


A Boy’s Fortune.
The Young Bank Messenger.

HOW TO RISE LIBRARY.

3 vols. By Horatio Alger, Jr. $3.00

Jed, the Poorhouse Boy.


Rupert’s Ambition.
Lester’s Luck.

COMPLETE CATALOG OF BEST BOOKS FOR BOYS AND GIRLS


MAILED ON APPLICATION TO THE PUBLISHERS
THE JOHN C. WINSTON CO., PHILADELPHIA
J. T. TROWBRIDGE.
Neither as a writer does he stand apart from the great currents of
life and select some exceptional phase or odd combination of
circumstances. He stands on the common level and appeals to the
universal heart, and all that he suggests or achieves is on the plane
and in the line of march of the great body of humanity.
The Jack Hazard series of stories, published in the late Our Young
Folks, and continued in the first volume of St. Nicholas, under the
title of “Fast Friends,” is no doubt destined to hold a high place in
this class of literature. The delight of the boys in them (and of their
seniors, too) is well founded. They go to the right spot every time.
Trowbridge knows the heart of a boy like a book, and the heart of a
man, too, and he has laid them both open in these books in a most
successful manner. Apart from the qualities that render the series so
attractive to all young readers, they have great value on account of
their portraitures of American country life and character. The
drawing is wonderfully accurate, and as spirited as it is true. The
constable, Sellick, is an original character, and as minor figures
where will, we find anything better than Miss Wansey, and Mr. P.
Pipkin, Esq. The picture of Mr. Dink’s school, too, is capital, and
where else in fiction is there a better nick-name than that the boys
gave to poor little Stephen Treadwell, “Step Hen,” as he himself
pronounced his name in an unfortunate moment when he saw it in
print for the first time in his lesson in school.
On the whole, these books are very satisfactory, and afford the
critical reader the rare pleasure of the works that are just adequate,
that easily fulfill themselves and accomplish all they set out to do.—
Scribner’s Monthly.
THE JOHN C. WINSTON CO.’S POPULAR
JUVENILES.

JACK HAZARD SERIES.

6 vols. By J. T. $7.25
TROWBRIDGE

Jack Hazard and His Fortunes.


The Young Surveyor.
Fast Friends.
Doing His Best.
A Chance for Himself.
Lawrence’s Adventures.

CHARLES ASBURY STEPHENS.


This author wrote his “Camping Out Series” at the very height of his
mental and physical powers.
“We do not wonder at the popularity of these books; there is a freshness and
variety about them, and an enthusiasm in the description of sport and adventure,
which even the older folk can hardly fail to share.”—Worcester Spy.
“The author of the Camping Out Series is entitled to rank as decidedly at the head
of what may be called boys’ literature.”—Buffalo Courier.

CAMPING OUT SERIES.


By C. A. STEPHENS.
All books in this series are 12mo. with eight full page illustrations.
Cloth, extra, 75 cents.
Camping Out. As Recorded by “Kit.”
“This book is bright, breezy, wholesome, instructive, and stands above the
ordinary boys’ books of the day by a whole head and shoulders.”—The Christian
Register, Boston.
Left on Labrador; or, The Cruise of the Schooner Yacht “Curlew.” As
Recorded by “Wash.”
“The perils of the voyagers, the narrow escapes, their strange expedients, and the
fun and jollity when danger had passed, will make boys even unconscious of
hunger.”—New Bedford Mercury.
Off Geysers;
to the or The Young Yachters in Iceland. As Recorded by
“Wade.”
“It is difficult, to believe that Wade and Read and Kit and Wash were not live boys,
sailing up Hudson Straits, and reigning temporarily over an Esquimaux tribe.”—The
Independent, New York.
Lynx Hunting: From Notes by the Author of “Camping Out.”
“Of first quality as a boys’ book, and fit to take its place beside the best.”—
Richmond Enquirer.
Fox Hunting. As Recorded by “Read.”
“The most spirited and entertaining book that has as yet appeared. It overflows
with incident, and is characterized by dash and brilliancy throughout.”—Boston
Gazette.
On theAmazon; or, the Cruise of the “Rambler.” As Recorded by
“Wash.”
“Gives vivid pictures of Brazilian adventure and scenery.”—Buffalo Courier.
THE RENOWNED STANDARD JUVENILES
BY EDWARD S. ELLIS

Edward S. Ellis is regarded as the later day Cooper. His books will
always be read for the accurate pen pictures of pioneer life they
portray.

LIST OF TITLES

DEERFOOT SERIES
Hunters of the Ozark.
The Last War Trail.
Camp in the Mountains.

LOG CABIN SERIES


Lost Trail.
Footprints in the Forest.
Camp Fire and Wigwam.
BOY PIONEER SERIES
Ned in the Block-House.
Ned on the River.
Ned in the Woods.

THE NORTHWEST SERIES


Two Boys in Wyoming.
Cowmen and Rustlers.
A Strange Craft and Its Wonderful Voyage.

BOONE AND KENTON SERIES


Shod with Silence.
In the Days of the Pioneers.
Phantom of the River.

WAR CHIEF SERIES


Red Eagle.
Blazing Arrow.
Iron Heart, War Chief of the Iroquois.

THE NEW DEERFOOT SERIES


Deerfoot in the Forest.
Deerfoot on the Prairie.
Deerfoot in the Mountains.

TRUE GRIT SERIES


Jim and Joe.
Dorsey, the Young Inventor.
Secret of Coffin Island.

GREAT AMERICAN SERIES


Teddy and Towser; or, Early Days in California.
Up the Forked River.

COLONIAL SERIES
An American King.
The Cromwell of Virginia.
The Last Emperor of the Old Dominion.

FOREIGN ADVENTURE SERIES


Lost in the Forbidden Land.
River and Jungle.
The Hunt of the White Elephant.
PADDLE YOUR OWN CANOE SERIES
The Forest Messengers.
The Mountain Star.
Queen of the Clouds.

ARIZONA SERIES
Off the Reservation; or, Caught in an Apache Raid.
Trailing Geronimo; or, Campaigning with Crook.
The Round-Up; or, Geronimo’s Last Raid.

OTHER TITLES IN PREPARATION

PRICE $1.00 PER Sold separately and in set


VOLUME
Complete Catalogue of Famous Alger Books, Celebrated Castlemon
Books and Renowned Ellis Books mailed on application.

THE JOHN C. WINSTON CO. PHILADELPHIA, PA.

You might also like