Introduction To Programming Notes

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 12

INTRODUCTION TO PROGRAMMING

INTRODUCTION TO COMPUTERS

 A computer is an electronic device that performs diverse opera ons using instruc ons to process the
informa on in order to achieve the desired results.

Characteris cs of Computers:

i. Speed: Computers process data at an extremely fast rate—millions of instruc ons per second,
hence the speed of a computer is calculated in Megahertz (MHz)

ii. Diligence: A computer, being a machine, does not suffer from the human traits of redness and
lack of concentra on.

iii. The major reason for reliability of the computers is that, at the hardware level, it does not
require any human interven on between its processing opera ons. Moreover, computers have
built-in diagnos c capabili es, which help in con nuous monitoring of the system.

iv. Storage Capability: Computers can store large amounts of data and can recall the required
informa on almost instantaneously.

v. Versa lity: They can perform mul ple tasks simultaneously with great ease.

vi. Resource Sharing: Computers today have the capability to connect with each other, thus data
and informa on can be shared among groups of computers, thus crea ng a large informa on
and knowledge base.

Evolu on of Computers:

i. First Genera on (1940–1956): Vacuum Tubes


a. Relied on binary-coded language (language of ‘0’s and ‘1’s) to perform
opera ons.
b. Able to solve only one problem at a me.
c. Each machine was fed with different binary codes and hence were difficult
to program.
d. lack of versa lity and speed.
e. In addi on, to run on different types of computers, instruc ons must be
rewri en or recompiled.

For example: ENIAC, EDVAC, and UNIVAC.


ii. Second Genera on (1956–1963): Transistors
a. Second genera on computers used transistors, which were superior to
vacuum tubes.
b. Computers became smaller, faster, cheaper, energy-efficient, and more
reliable than their predecessors.
c. Magne c cores were used as primary memory and magne c disks as
secondary storage devices. However, they s ll relied on punched cards for
input and printouts for output.
d. One of the major developments of this genera on includes the progress from
machine language to assembly language.
(Early high-level programming languages, such as COBOL and FORTRAN also
came into existence in this period.)

For example: PDP-8, IBM 1401, and IBM 7090.

iii. Third Genera on (1964 to Early 1970s): Integrated Circuits


a. The development of the IC was the trait of the third-genera on computers.
(An IC consists of a single chip (usually silicon) with many components, such as transistors
and resistors fabricated on it)
b. This development made computers smaller in size, reliable, and efficient.
c. Users interacted with third genera on computers through keyboards and monitors and
interfaced with the opera ng system.
d. Ability to run many different applica ons at a me with a central program that monitored
the memory.
e. For the first me, computers became accessible to mass audience because they were smaller
and cheaper than their predecessors

For example: NCR 395 and B6500.

iv. Fourth Genera on (Early 1970s Till Date): Microprocessors


v.
a. A microprocessor is built onto a single piece of silicon,
known as the chip. It is about 0.5 cm along one side and
no more than 0.05 cm thick.

b. The fourth-genera on computers led to an era of Large-


Scale Integra on (LSI) and VLSI technology. LSI
technology allowed thousands of transistors to be
constructed on one small slice of silicon mate rial.
Whereas VLSI squeezed hundreds of thousands of components onto a single chip.
Ultra large-scale integra on (ULSI) increased that number into millions. This way, computers
became smaller and cheaper than ever before.

c. During this period, magne c core memories were subs tuted by semiconductor memories
which resulted in faster random-access memories.
d. Secondary memories, such as hard disks became economical, smaller, and bigger in capacity.
e. Computers could be linked together to form networks, which eventually led to the
development of the Internet.
f. This genera on also saw the development of the Graphical User Interfaces (GUIs), mouse,
and handheld devices.

Classifica on of Computers:

Applica on of Computers:

i. Science: Scien sts have been using computers to develop theories, to analyse, and test data.

ii. Educa on: Currently, classrooms, libraries, and museums are u lizing computers to make
educa on and learning much more interac ve.

iii. Medicine and Health Care: Doctors are using computers right from diagnosing illness to
monitoring a pa ent’s status during complex surgery.

iv. Engineering/Architecture/Manufacturing: Architects and engineers extensively use computers in


crea ng designs and drawings.

v. Entertainment: They are used to control the images and sounds. Special effects, which
mesmerize the audience.

vi. Communica on

vii. Business Applica on: Computers are used, such as in business forecas ng, to prepare pay bills
and personal records, in banking opera ons and data storage, in the various types of life
insurance business, and as an aid to management.

viii. Publishing: Computers have created a field known as Desktop Publishing (DTP). In DTP, with the
help of a computer and a laser printer, one can perform the publishing job all by oneself.
Basic Computer Organiza on:

a. Hardware:
Hardware refers to all visible devices that are assembled together to build a computer system.
These include various input devices, CPU, output devices, and memory.

- Input Devices
Input devices are electromechanical devices that allow the user to feed informa on
into the computer for analysis, storage, and to give commands to the CPU. for
example, by using a keyboard and a mouse.
- Central Processing Unit
The central processing unit (CPU) referred to as the “brain” of a computer system as
 It converts data (input) into meaningful informa on (output), executes stored
program instruc ons
 Controls all internal and external devices
 Performs arithme c and logic opera ons
 Operates only on binary data
 Controls the usage of main memory to store data and instruc ons, and controls
the sequence of opera ons

The CPU consists of three main subsystems: the Arithme c/Logic Unit (ALU), Athe
Control Unit (CU), and the Registers.
ARITHMETC /LOGIC UNIT (ALU): CONTROL UNIT(CU):
The arithme c/logic unit (ALU) contains electronic circuitry that Control Unit (CU) checks the
executes all arithme c and logical opera ons on the data made correctness of sequence of
available to it opera ons.

The ALU comprises two units: arithme c unit and logic unit. It fetches program instruc on
ARITHMETIC UNIT: LOGIC UNIT: from the primary storage unit,
Responsible for performing the Performs logical opera ons interprets them, and ensures
actual compu ng and carrying based on the instruc ons correct execu on of the
out the arithme c calcula ons, provided to it. program.
such as addi on, subtrac on,
mul plica on, and division. It also controls the
The unit can compare input/output devices and
numbers, le ers, or special directs the overall func oning
characters and can then take of the other units of the
ac on based on the result of computer
the comparison.

Logical opera ons of a logic


unit can test for three
condi ons: equal-to
condi on, less-than
condi on, and greater-than
condi on.

- Output devices:
Output devices take the machine-coded output results from the CPU and convert
them into a form that is easily readable (such as characters, graphical, or audio
visual) by human beings.

The outputs, which can be easily understood and used by human beings, are in the
form of hard copy and so copy. The physical form of output is known as hard copy.
The electronic version of an output, which usually resides in computer memory
and/or on disk, is known as so copy.

b. So ware:
A set of programs that are specifically wri en to provide the user a precise func onality like
solving a specific problem is termed as a so ware.

TYPES OF SOFTWARE-
I. System So ware & Opera ng Systems, Language Translators:
System so ware consists of several programs that are directly responsible for controlling,
integra ng, and managing the individual hardware components of a computer system.

Opera ng system is the first layer of so ware loaded into computer memory; all other
so ware that gets loaded a er it depends on it for various common core services. These
common core services include disk access, memory management, task scheduling, and
user interfacing. In addi on, the opera ng system ensures that different programs
execu ng at the same me do not interfere with each other. It provides a so ware
pla orm on top of which other programs can run. In simple words, the opera ng system
organizes and controls the hardware.

II. Applica on So ware:


It is used to accomplish specific tasks rather than just man aging a computer system.

III. U lity So ware:


Applica on so ware that assists system so ware in doing their work is called u lity
so ware.

Stored program architecture of a computer/Von Neumann architecture:

When both data and instruc ons are kept in the main memory, a computer could get its instruc ons
from the memory and the programs could be setup or changed from within the memory as well,
without having to redesign the computer. The stored program architecture is the basis on which
most of the conven onal and today’s modern computers work known as von Neumann architecture.

The design architecture for the IAS computer (First electronic computer) consisted of four
interconnected components that were:

• Main memory • Arithme c and logic unit (ALU) • Control unit

• Input/Output devices
COMPUTER MEMORY AND STORAGE

 Computer memory: Refers to the electronic holding place for instruc ons and data where the
processor can reach quickly.

Memory Representa on:

• Bit: It is the smallest unit of data on a machine and a single bit can hold only one of two
values: 0 or 1. Bit is represented by a lower-case b.

• Byte: A unit of eight bits is known as a byte. Hence, a byte is able to contain any binary number
between 00000000 and 11111111. It is represented by an upper-case B.

• Kilobyte: In a decimal system, kilo stands for 1000, but in a binary system, kilo refers to 1024.
Therefore, a kilobyte is equal to 1024 bytes. It is usually represented as KB.

• Megabyte: It comprises 1024 kilobytes, or 1,048,576 bytes. However, since this number is hard
to remember, a megabyte can be thought of as a million bytes. Megabyte is the standard unit of
measurement for RAM and is represented as MB.

• Gigabyte: It consists of 1024 megabytes (1,073,741,824 bytes). It is the standard unit of


measurement for hard disks and is o en represented as GB.

• Terabyte: It refers to 1024 gigabytes. O en represented as TB, terabyte memory is usually


associated with super computers only
Memory Hierarchy

1. Internal Processor Memory: Placed within the CPU (processor) or is a ached to a special fast bus,
used for temporary storage of data and instruc ons on which the CPU is currently working and
includes the cache memory.

2. Primary/ Main Memory: Random Access Memory (RAM) and Read Only Memory (ROM) fall under
this category.

3. Secondary/ Auxiliary Memory: Provides backup storage for instruc ons (computer programs) and
data. The instruc ons and data stored on secondary storage devices are permanent in nature. They
can only be removed if the user wants it so or the device is destroyed. Secondary memory can also
be used as overflow memory (also known as virtual memory), when the capacity of main memory is
surpassed.

Random access memory (RAM)

It is the place in a computer where the opera ng system, applica on programs, and data in current use are
kept to be accessed quickly by the computer’s processor.

CHARACTERSTICS-

a. Allows the computer to store data for immediate manipula on, quick access and to keep
track of what is currently being processed
b. RAM is much faster to read from and write to than the other kinds of storage in a computer
like the hard disk or floppy disk
c. RAM stays there only as long as the computer is running. When the computer is turned off,
RAM loses all its contents

Read only memory (ROM):

The special chip located on the motherboard, where the startup instruc ons(firmware/BIOS) are stored, is
called ROM.

CHARACTERSTICS-
a. It is non-vola le in nature, that is, its contents are not lost when the power is switched off as it does
not depend on an electric current to save data, instead, data is wri en to individual cells using binary
code during fabrica on.
b. The data and instruc ons stored in ROM can only be read and used but cannot be altered thereby
making ROM much safer and secure than RAM.
c. ROM performs the necessary BIOS (Basic Input Output System) func on to start the system and then
transfers the control over to the opera ng system.

ADDITIONAL
A micro program called system boot program contains a series of start-up instruc ons to check for the
hardware, that is, I/O devices, memory, and opera ng system in the memory.

Algorithms:

An algorithm is defined as a finite sequence of explicit instruc ons that, when provided with a set of
input values, produces an output and then terminates.

Flowchart:
A flowchart is a pictorial representa on of an algorithm in which the steps are drawn in the form of different
shapes of boxes and the logical flow is indicated by interconnec ng arrows.

BENEFITS OF FLOWCHARTS:

a. Makes logic clear


b. Communica on: Being a graphical representa on of a problem-solving logic, flowcharts are
be er way of communica ng the logic of a system to all concerned.
c. Effec ve Analysis: With the help of a flowchart, the problem can be analysed in an effec ve way.
d. Useful in Coding: The flowcharts act as a guide or blueprint during the analysis and program
development phase.
e. Proper tes ng and debugging: Helps in detec ng the errors in a program, as the developers
know exactly what the logic should do.

LIMITATIONS OF FLOWCHARTS:

a. Complex: The major disadvantage in using flowcharts is that when a program is very large, the
flowcharts may con nue for many pages, making them hard to follow.
b. Costly: Drawing flowcharts are viable only if the problem-solving logic is straigh orward and not
very lengthy.
c. Difficult to Modify: Due to its symbolic nature, any change or modifica on to a flowchart usually
requires redrawing the en re logic again.
d. No Update: Usually, programs are updated regularly. However, the corresponding update of
flowcharts may not take place, especially in the case of large programs.

Program control structures:


Program statements that affect the order in which statements are executed, or that affect whether
statements are executed, are called control structures.

1. Sequence, where informa on flows in a straight line.


2. Selec on (decision or branched), where the decisions are made according to some predefined
condi on.
3. Repe on (looping), where the logic (sequence of steps) is repeated in a loop un l the desired
output is obtained.

Programming languages:

A programming language is a set of instruc ons and syntax used to create so ware programs.

TYPES OF PROGRAMMING LANGUAGES:

1. Machine Language: It is the na ve language of computers. It uses only ‘0’s and ‘1’s to represent
data and the instruc ons.
2. Assembly Language: It corresponds to symbolic instruc ons and executable machine codes and
was created to use le ers instead of ‘0’s and ‘1’s to run a machine.
3. High-level Language: These languages are wri en using a set of words and symbols following
some rules similar to a natural language, such as English. The programs wri en in high-level
languages are known as source programs and these programs are converted into machine-
readable form by using compilers or interpreters.

Note: Together, machine and assembly language are also known as low-level languages.

ASCII (American Standard Code for Informa on Interchange)

American Standard Code for Informa on Interchange, a set of digital codes represen ng le ers,
numerals, and other symbols, widely used as a standard format in the transfer of text between
computers.

Unicode
An international encoding standard for use with different languages and scripts, by which
each letter, digit, or symbol is assigned a unique numeric value that applies across different
platforms and programs.

You might also like