What is a computer?
A simple minded definition: a computer is a machine that
computes. It has evolved from mechanical devices like the
abacus and slide rule to the machine we know now that stores
data (words, numbers, or pictures), interacts with external
devices (the monitor, printer, speakers), and executes
What is Programming?
A program is a set of instructions that a computer executes to
achieve a certain desired effect - perform a calculation, render
a picture, or produce music. A program is written in a specific
A computer cannot solve a problem by itself. The programmer must
write down in minute details each step the computer has to take
to solve the problem. An algorithm is the set of steps taken to
solve a given problem.
What is an algorithm?
An algorithm is a step-by-step solution to a given problem. An algorithm
has the following properties:
- finiteness - the process terminates, the number of steps are finite
- definiteness - each step is precisely stated
- effective computability - each step can be carried out by a computer
Why everyone should learn computer programming?
- Computers are ubiquitous. Programming is a basic skill like
reading, writing, and arithmetic.
- Programming is a discipline that teaches the science and art
of solving problems.
- Programming is different from using an application package like
Microsoft Word or Excel. It allows you to tap the power of the
computer for your own use.
Anatomy of a computer
- At the heart of the computer is the central processing unit
(CPU). It consists of a single chip that is made out of
millions of transistors. A simple processor (CPU) has the control
circuits for fetching and executing instructions, an arithmetic logic
unit for manipulating data, and registers for storing the processor
status and a small amount of data. The CPU performs program control,
arithmetic operations, and data transfers.
- A computer stores data and program instructions in memory (or main
memory). The computer memory has some number of locations for storing.
Associated with each location in memory is a unique binary number called
the address. If there are n locations, then the address ranges from 0 to
n-1. The primary storage is random-access memory (RAM) and read-only
- Secondary storage is usually a hard disk that consists of rotating
platters, that are coated with magnetic material, and have read/write
- Removable storage is in the form of - floppy disks or diskettes, high
capacity floppies like Zip disk, CDs, and DVDs. To store large amounts
of data sometimes data tapes are used.
- Computers interact with the human user through the keyboard, the
monitor, printer, and speakers.
- The CPU is mounted on a motherboard. The motherboard has
the RAM, and card slots through which cards that control the external
devices are connected. The CPU, RAM, the hard disk, and other devices
are connected through a set of electrical lines called a bus.
Aside: Computer Arithmetic
A computer manipulates binary digits (bits). A bit can be either
0 or 1. A byte is 8 bits. 1 KiloByte is 1024 bytes. 1 MegaByte
is 1024 KiloBytes. 1 GigaByte is 1024 MegaBytes.
- Decimal system
- Binary system
- Conversion from decimal to binary and vice versa
- Binary arithmetic
- Octal system
- Hexadecimal system
How does a computer run a program?
The program is first loaded into RAM. The computer reads the
program one instruction at a time. As instructed the CPU
reads data, manipulates it and stores it back. The CPU may
also interact with the monitor, printer or speakers as