Friday, March 27, 2009

computing & informatics: short notes

Microprocessors
Intel 8085

• 8 bit microprocessor, implemented in NMOS Technology.
• 40 Pin LSI chip. 3, 5 and 6 MHZ are employed.
• 80 basic instructions and 246 opcode.
• 8 bit data bus and 16 bit address bus.
Computing & Informatics L-10
2
Intel 8086
• 16 bit microprocessor, implemented in HMOS Technology.
• 40 Pin LSI chip. 5, 8 and 10 MHZ are employed.
• 16 bit data bus and 20 bit address bus lines corresponds to 1MB
memory.
• 16 low order address lines are multiplexed with data line and 4
high order address lines are multiplexed with status signal.
Microprocessors
Intel 80386
• 32 bit microprocessor.
• 386Sl version developed for laptop computers.
• Designed to consume low power.
• 32 bit data bus and 32 bit address bus.
Computing & Informatics L-10
3
Intel 80486
• 32 bit microprocessor, implemented in CHMOS Technology.
• It contains 32 bit CPU, a floating point processor, 8 Kb or 16 KB
cache. 168 pin grade array or 196-lead plastic quad flat package.
• Different versions of 486 works between 25 – 100 MHz clock.
• Can directly address 4 GB memory.
Microprocessors
Pentium with Multimedia extension (MMX)
• Operating frequency 200 MHz.
• Two cache 16 KB each.
• The MMX pipeline uses intensive parallel processing of data.
• The Celeron, Pentium II and Pentium III also uses MMX.
Computing & Informatics L-10
4
Pentium IV
• 32 bit microprocessor and 64 bit on Pentium –4 HT
microprocessor.
• Operating frequency up to2.8 GHz.
Memory
• Essential component of computer, stores data, programs and
results.
• Three kinds of memory in modern computers:
Semiconductor Magnetic Optical memories
• Types of memories
Main memory Secondary (Auxiliary) memory

ROM Memory
Static
Memory
Memory
RAM Memory
Primary (Main) Memory
Masked ROM
Auxiliary (Secondary) Memory
Dynamic
Memory
PROM EROM EEROM
Memory
• The semiconductor memory is employed as main memory or
primary memory of the computer.
• RAM ROM IC are used as the main memory of computer.
• The magnetic and optical memory are used as secondary memory.
• Secondary memory is employed for bilk storage or mass storage
of programs data and other information.
• Backup memory is used to store the copy of the important
programs such as OS, compliers etc. floppy disk CDs and
magnetic disks are used as back up memory.
• The cache memory is placed in between CPU and the main
memory. It is semiconductor memory, and is faster than main
memory. Write through and write back cache schemes are used in
computers.

• The diagrams shown below represents the memory hierarchies as
per the speed of operation.
Computing & Informatics L-10
C
P
Primary
Memory
Secondary
Memory
7
U
Cache
MEM
Primary
Memory
Secondary
Memory
C
P
U
Semiconductor Memory
• Semiconductor are of two types: Random access Memory RAM
and Read only memory ROM.
• The read write memory is commonly called RAM.
RAMs
• RAM is volatile memory, the information exist in the memory till
Computing & Informatics L-10
8
the power is on.
• Two types of RAM are: Static RAM and Dynamic RAM.
• Static RAM stores information as long as power is on.
• In case of Dynamic RAM the the information stored is lost in
very short time (few milliseconds). Hence these are to be
refreshed periodically.
• For this purpose RAM controller are used.
Semiconductor Memory
• Static RAM uses Flip flops whereas Dynamic RAM uses gates
with capacitor so it requires less transistors per memory.
• Extended Data Output RAM (EDO-RAM): any memory access
stores bytes of data into latches. Latches holds next 256 bytes of
information.
• SDRAM (Synchronous DRAM): these RAM chips uses the same
Computing & Informatics L-10
9
clock rate as the CPU, so it remains ready to transfer data when
needed by the CPU.
• DRAM (Dual-Ported RAM: allows to access two memory
locations simultaneously, also called video RAM (VRAM or
WRAM windows RAM)
• SIMM & DIMM: single inline & double inline modules are small
printed ckt cards on which several DRAM chips are placed.
Semiconductor Memory
ROMs
• ROM is non-volatile memory, the information exist in the
memory even if the the power goes off. Used fro permanent
storage of data. They are cheaper as compared to RAM.
• PROM: programmable ROM. Its content can be decided by the
user. The user can store permanent programs using PROM
Computing & Informatics L-10
10
programmer.
• EPROM: in erasable PROM stored data can be erased by
exposing it it to high intensive SW ultraviolet light.
• EEPROM: electrically erasable PROM can be erased and
reprogrammed on board easily on a byte by byte basis.
• Flash memory: it is EEPROM but uses one transistor per cell.
• Nonvolatile RAM: high speed RAM & EEPROM are packed in
one chip to form non volatile RAM.
Memory Controller
• A dynamic RAM (DRAM) requires refreshing ckt to refresh the
content, for this purpose DRAM controllers are evolved.
Intel 8203: 64K DRAM controller capable of directly addressing and
driving up to 64 devices without external drivers. Provides
multiplexed address, address strobes, refresh logic, and refresh /
access arbitration.
Computing & Informatics L-10
11
Intel 8207: is dual port DRAM controller. It interfaces 16K, 64K and
256K DRAMs. Can directly address 2 MB without any external
drivers. A dual port interface permits two different busses to
access memory independently.
Intel 82C08: CHMOS DRAM controller. Can interface 64K and
256K DRAMs. Can directly address 1MB. Capable of performing
the task of memory refreshing employing battery backup.
Magnetic Memory
• It is permanent type memory. It is non-volatile. Used as secondary
and backup memory.
• Data is stored on the magnetic coating film by electrical pulses of
suitable polarity to the magnetizing coil of a read /write head.
• Two techniques: longitude recording (magnetic region is oriented
parallel to the disk surface along the track) and Vertical recording
Computing & Informatics L-10
12
( the magnetic regions are vertical to the disk surface).
• Types of Magnetic memory: Magnetic Disk (Hard Disks and
Floppy Disk and Magnetic Tapes.
• Magnetic Disk is a surface device. Stores data on its surface.
• Surfaces is divided into concentric tracks and each track is
divided into sectors.
Magnetic Memory
• The number of bytes stored in each sector is same. So all tracks
store same number of data.
• These disks are semi random devices. Track is selected in random
fashion but data is written or read in serial fashion.
• The time required to move the R/W head to the addressed sector
is access time (time to move head to the track is seek time + time
Computing & Informatics L-10
13
required to bring the starting position of the sector is latency
time).
• Disk Controller (DC) are required to convert instruction received
from software to electrical pulses to operate disk.
• DC also issue commands to perform R/W operation. Data
separation error detection also taken care by DC
Magnetic Memory
Hard Disk:
• On line storage device connected permanently to computer.
• Made up of Aluminum. With thin coating of magnetic material over
it.
• Read write head and disks are kept in sealed, air filtered enclosure
Computing & Informatics L-10
14
• To increase capacity several hard disks are mounted on common
drive to constitute disk pack.
RAID Systems:
• Redundant Arrays of Inexpensive Disks (RAID) system disks
operate in parallel and stores the same information.
• Improves the storage reliability by eliminating the risk of data lost.
• Large files is stored in many disks by breaking the file into groups.
Optical Memory
• Information is written in the disks using the laser beam.
• Provides the larger capacity. And has longer life.
• Slow access time of the drive.
• No chance of head crash, since head does not touch disk.
Computing & Informatics L-10
15
• Three types CD ROM (prerecorded data can be read out)
WROM ( write once and read many times)
Erasable optical Disk (write many and read many times)
• Now DVD (Digital Versatile Disks) are also coming which has
more capacity to store data than a CD.
• It contains more layers.
PCMCIA Cards and Slots
• PCMIA stands for Personal Computer Memory Card International
Association. These are smart cards becoming standard feature for
desktop and portable machines.
• PCMCIA slots (socket) are designed to fit into floppy drive
mounting bays.
• These slots can be used for exchanging data using PCMCIA
Computing & Informatics L-10
16
cards.
• Type-I type has 34 pin connector 3.3 mm thick, whereas type-II
cards are 5 m thick and have 68 pins and type-III cards are 10.5
mm thick and have 68 pin connector. Type-IV has 166mm thick.
• These cards and slots supports hot insertion.
Computing & Informatics L-11
• Input Output Devices
• Keyboard
• Mouse
• Monitor
17
• Printer
• Other I/O devices
• Software
Input and Output Devices
• The input/ output devices (I/O) and secondary storage units of
computer are called peripherals.
• Data and instruction are entered through input devices.
• An input device converts input data and instruction into suitable
binary form which can be accepted by the computer.
Computing & Informatics L-11
18
• Some input devices are Keyboard, Mouse, light pen, joy stick,
track ball, touch screen, graphic tablet etc.
• The out put devices receive information from the computer and
provide them to user.
• The computer sends information to O/p device in binary form.
The O/p device converts into a form which is used by by user,
• Some O/p devices are Monitor, Printer, speakers, LCD display
etc.
Keyboard
• Programs and data are entered into a computer through Keyboard.
• It is similar to a typewriter. It contains alphabets, digits, special
characters and some control Keys.
• When a key is pressed a signal is produced which is detected by
keyboard encoder and encoder sends a binary code to the
computer.
Computing & Informatics L-11
19
• The binary code may be an ASCII EBCDIC or Hex code.
• The binary code send by encoder is taken from a look up table.
• Computers use standard keyboards having Qwerty type layout.
• For faster typing keys are arranged to give a different layout
known as Dvorak layout.
• Construction of keys can be Mechanical Keyswitch, Capacitive
Keyswitch or Hall Effect Keyswitch.
Mouse
• A mouse is a pointing device. It is used to select a displayed menu
on option on the CRT.
• It is held in on hand and moved across a flat surface.
• Movement is detected by the two rotating wheels on the underside
of the mouse.
Computing & Informatics L-11
20
• The pulses transmitted by the mouse (generated by shaft encoder
for every incremental movement of the wheel) determine the the
distance moved.
• The mechanical mouse explained above picks up drift.
• An Opto-mechanical mouse has been developed.
• It contains a ball which rolls on two shafts. The shafts turn optical
shaft angle encoders to convert motions to electrical signals.
Monitor
• A CRT (Cathode Ray Tube ) display unit or monitor is a
commonly used out put device.
• It can display the data information received from computer in
alphanumeric character and graphs.
• Though CRT is basically O/p device but it can perform limited
input operations when used in conjunction with light pen.
• The CRT is similar to TV screen. It is vacuum tube . An electron
Computing & Informatics L-11
21
beam is produced and directed towards the front of the CRT.
• A coating of phosphor material is made up in the inner side of
screen. It emits light when struck by an electron beam.
• To produce colour display three phosphor red blue and green are
used. Three different beams for each colour is produced in such a
way that these beams struck the corresponding colour phosphor
dot arranged in a special manner.
Monitor
• Raster Scan and Vector display methods are used in the CRT to
produce the out put.
• In raster scan method the electron beam is first directed at the top
left hand corner and then it is moved along the first horizontal
scan line.
• When it reaches right hand side the beam is turned of and retrace
rapidly left side to the starting point of second line and traces the
Computing & Informatics L-11
22
second line in same manner.
• In the last line scan when beam reaches in the right hand side
bottom corner then it goes back to starting point (top left hand).
• In vector scan (random scan) method deflecting plates are used to
deflect the beam left or right and up or down.
• The beam can be directed to any point on the screen.
Monitor
• A character is displayed on the screen by light dots. A matrix of
dots is used for this purpose.
• The size of the dot-matrix may be 5x7, 7x9 or 7x12.
• Character generator ROM, stores the dot pattern for the each
character.
• The ASCII or EBCDIC codes of the character to be displayed are
stored in a display RAM or video RAM.
Computing & Informatics L-11
23
• According to the character to be displayed the content of RAM
changes.
• A row counter and a character counter are employed to address
the ASCII code of character in the display.
• A CRT controllers contains the necessary electronic CKT to
control CRT display. Several controller ICs like Intel 8275, 8276,
822706 etc. are available.
Printers
• Printers are commonly used out put device. These are classified
as: Character Printer, Line Printer and Page Printer.
• The other classification based on the technology on
manufacturing are: Impact printer (uses electromechanical
mechanism that causes hammers or pins to strike against against
a ribbon to print) and Non-impact printer (uses thermal,
Computing & Informatics L-11
24
chemical, electrostatic, laser beam, inkjet technology for printing)
• A character Printer prints one character of text at time. They are
low speed printers. Character to be printed are sent serially to the
printer.
• In a dot matrix impact type character printers a character is
printed by printing selected number of dots from a matrix of dots.
• The line printer prints one line at time.
Printers
• An ink jet printers uses dot matrix approach to print text and
graphics. Most printers use multiple jets vertically aligned on a
cartridge.
• A solid colour printer use inks which are solid ar room
temperature. At the time of printing inks are melted and flow to
the reservoirs in the print head.
Computing & Informatics L-11
25
• Laser jet printers are page printers in which entire page is
processed at a time.
• They use laser beam to produce an image of the page containing
text graphics on a photo sensitive drums.
• The drum is coated with negatively charged photoconductive
material.
Other Input and Output Devices
Light pen
• A light pen is a pointing device, used to select a displayed menu
option on the CRT. It is photosensitive pen like device.
• It can also be used for graphics work
Joystick

• It is also a pointing device, used to move the curser position on a
CRT screen. Its function is similar to that of a mouse.
Track pad
• It is one of the latest pointing device it looks like a small gray
window, about inches wide. One merely slides his fingers tip
across the window to move the curser.
Other Input and Output Devices
Scanners
• It is a kind of input device. These are capable of enetring
information directly into the computer.
Optical scanners
• The Optical scanners are capable of reading information recorded
Computing & Informatics L-11
27
on paper employing light sources and light sensors.
Touch screen
• Some computers have touch screen which is sensitive to user’s
touch. One can use finger to point the command displayed on the
screen. It is popular on laptops
Software
• A program is sequence of instruction.
• A set of programs written for a computer is called software.
• Software are of two types
System software: the software needed to execute the user’s program
is system S/W. It consist of operating system, assembler,
Computing & Informatics L-11
28
complier, interpreter, debugging programs text editors etc.
Application software: the programs written for specific operations
makes the application software. Programs like sales order,
inventory, pay bills are examples of application S/W.
• A program which is prepared by programmer to solve certain
problem is known as User’s program.
• The operating system is collection of programs that controls the
overall operation of a computer.
Software
• The software which are helpful to users in developing, writing,
debugging and documenting programs are referred as utility
programs.
• There are two types of utility programs file management and
program development.
• The firm ware is used for the S/W stored in read only storage
Computing & Informatics L-11
29
device. These programs are never expected to change.
• The way of writing the programs in a computer system depends
upon the programming language used. Programming language is
tool for writing the application program.
• Language are of two types: Low level Language and High Level
Language.
Software
• A language in which each statement is directly translated into
single machine code is known as Low level language.
• Examples of low level language are machine level and the
assembly languages of various processors.
• High level languages are written in form which is easy to
understand and normally in the English like statement.
Computing & Informatics L-11
30
• The instruction written in HL language are called statement. The
statement more clearly resembles English and mathematics as
compared to mnemonics in assembly language.
• Machine language: programs written in the form of 0s and 1s is
called machine language programs.
• There is a specific binary code for each instruction. These binary
code differs from computer to computer.
Software
• Each microprocessor has its own instruction set and
corresponding machine codes.
• To solve the difficulty in writing programs in machine language
assembly language have developed.
• In assembly language the programs are written in alphanumeric
symbol code known as mnemonics.
Computing & Informatics L-11
31
• The programming in assembly language is easier and fester as
compared to machine language programming.
• Assembler: A program which translate an assembly language
program into a machine language program is called assembler.
• An assembler which runs a computer for which it produces object
code (machine code) is called self assembler.
Software
• A cross assembler is an assembler that run on a computer other
than for which it produces machine codes.
• One-Pass Assembler: an assembler which reads the assembly
language program only once.
• Two-Pass Assembler: an assembler which reads the assembly
language program twice.
Computing & Informatics L-11
32
• The computation time of assembly language program is les as
compared to High Level Language.
• Assembly language programs runs faster to produce the desired
result as compared to High Level Language.
• Assembly language programs can not used on any other computer
as compared to High Level Language.
• Assembly language program contains more instruction as
compared to High Level Language.
Software
• A complier is a program which translate a high level language
into machine language.
• It is more intelligent than an assembler.it check for all kinds of
limits, ranges, errors etc.
• Its program execution time is more.it has low sped and low
efficiency of memory utilization.
Computing & Informatics L-11
33
• If a complier runs on computer for which it produces the object
code, then it is called self or resident complier.
• If a complier runs on computer other than that for which it
produces the object code, then it is called cross complier.
• An Interpreter is a program which translates statements of a high
level language into machine codes.
• It translate one statement at a time.
• A complier is faster than an interpreter.
Software
Programming language generations
• First Generation, 1GL: machine languages is known as first
generation Language.
• Second Generation, 2GL: an assembly language is second
generation Language. Assembly language is machine oriented. It
is very close to the hardware of the CPU.
Computing & Informatics L-11
34
• Third Generation, 3GL: High Level Languages are the third
generation Language. These are procedure-oriented languages.
The programmer must tell what to do as well how to do.Fortran,
Pascal, Cobol and C are examples of these languages.
• Fourth Generation, 4GL: Non-procedural or object oriented
languages are the fourth generation Language. In this language
programmer has to tell only what to do.Java, C++, ORACLE and
SYBASE are example of these languages.
Computing & Informatics L-12
• Operating Systems
• MS-DOS
• UNIX
• WINDOWS
35
• Utility Programs
Operating System
• It is an organized collection of software consisting of procedures
for operating a computer and providing an environment for
execution of programs.
• The objective of an OS is to make system convenient to use and
utilize computer computer hardware in efficient manner.
• OS acts as an interface between users and the hardware of a
Computing & Informatics L-12
36
computer system.
• OS directly controls computer computer system resources.
• Two ways to interact with OS:
System Call: provides the interface between a running program and
the OS
Operating system Commands: in this method user may interact with
OS directly by means of operating system commands.
Operating System
• OS may process its tasks serially (sequentially) or concurrently
(several task simultaneously.
• The OS may employ serial processing, batch processing, multi
programming or multi tasking.
Serial processing:
• In serial processing all the Datas or programs are processed
Computing & Informatics L-12
37
serially one by one.
• This result in low utilization of resources.
Batch Processing:
• Jobs with similar requirements are batched together and run
through the computer as a group.
• Batching similar jobs improve utilization of system resources
quite a bit.
Operating System
Multi Programming:
• It allows more than one job (program) to utilize the CPU time at
any moment.
• When OS picks one program and start executing, during
execution the program may need some I/O operation to complete.
In that time OS will simply switch to some other program instead
of sitting idle.
Computing & Informatics L-12
38
• This offers a more efficient approach to increase system
performance.
Multi Tasking:
• In multi tasking a program is divided onto different independent
tasks and this tasks runs on computer as independent programs
running on the computer.
• This improves the computation time as well as the resource
utilization.
Operating System
• The operating system can be broadly classified as:
Batch Processing Operating systems:
• Batch operating system allow little or no interaction between
users and executing program.
• Process scheduling, memory management, file management and
I/O management are quite simple.
Computing & Informatics L-12
39
• Jobs are typically processed in first come first serve basis.
• The difficulties with this OS is non interacting environment and
of line debugging.
Multi Programming Operating systems
• MOS has a significant potential for improving system throughput
and resource utilization.
• Different forms of MOS are multitasking, multiprocess and multiuser
operating system.
Operating System
Multi Programming Operating systems
• A running state of program is called process or task.
• Multi programming supports multiple concurrent process to reside
in primary memory simultaneously.
• Multi tasking operating system allows two or more active process
simultaneously.
• Multi user operating system allows simultaneous access to a
Computing & Informatics L-12
40
computer system through two or more terminals.
• Multiprogramming implies multiprocessing multi tasking but
multiprocess or multi tasking does not imply multiprogramming.
Network Operating systems
• A NOS is a collection of S/w and associated protocols that allows
a set of autonomous computers which are interconnected by a
network to be used together in a convenient and cost effective
manner.
Operating System
Network Operating systems
• Each computer has its own OS instead of running part of global
system wide operating system.
• Each user normally works on its own system on same or different
environment.
• User are aware of where each of files are kept and must move file
from one system to another with explicit transfer commands.
Computing & Informatics L-12
41
• NOS allows users to access the various resources of the network
host.
• Controlling access so that users with proper authorization are
allowed to access particular resources.
• Making the use of remote resource appear to be identical to the
use of local program.
• Providing up-to-the minute N/w documentation on-line.
Distributed Operating systems
Operating System
Distributed Operating systems
• A DOS operating system is one that looks to its users like an
ordinary centralized operating system but runs on the multiple
identical CPUs.
• The key is transparency.
• This allows programs to run on several processors at the same
time, thus requiring more complex processor scheduling
Computing & Informatics L-12
42
algorithms in order to achieve maximum utilization of CPU time.
• DOS are considered to be more reliable than uniprocessor system.
• The OS performs even if certain parts of system (H/W) is
malfunctioning.
• Incremental growth is possible on this operating system.
• Large systems are made by using the small processor, hence
provides the price performance advantage over traditional system.
Operating System Structure
Layered structure approach
• In layered structure number of layers (levels), each built upon
lower level, makes the operating system.
• The bottom layer is hardware and top layer is user interface.
• The main advantage of this is modularity which helps in
debugging and verification of system easily.
Computing & Informatics L-12
43
• The layers are designed in a way that it uses operating and
services only if a layer
below it. A higher layer
need not know how these
operations are implemented.
Layer 5 User program
Layer 4 Buffering for I/O devices
Layer 3 Device driver
Layer 2 Memory manager
Layer 1 CPU scheduling
Layer 0 Hardware
Operating System Structure
Kernel approach
• Kernel is part of OS which directly makes interface with hardware
• It provides mechanism for creation and deletion of processes.
• It provides processor scheduling
• It provides mechanism for synchronization of processes.
• It provides mechanism for interprocess communication.
Computing & Informatics L-12
44
Virtual Machine
• It is a concept which creates an illusion of real machine.
• It is created by a virtual machine system that makes real machine
appear to be several real machine.
Client Server Model
• In this model a user process (client process) sends an request to a
server process, which then does the work and send the answer.
MS-DOS
• The operating system for PCs are designed as a single user single
task operating system.
• This has two parts BIOS(Basic Input Output System) and DOS
(Disk Operating System).
• The BIOS is stored in ROM and DOS in floppy disks.
Booting Process
Computing & Informatics L-12
45
• When power is turned on BIOS takes control, it checks for
available H/w, then it reads from disk a small portion of OS and
loads it into memory.
• This Boot program the pulls the rest of OS from the disk stored in
main memory and completes the booting process.
• BIOS is responsible for low level services.
MS-DOS
• DOS provides many user services like:
• Directory management which allows user to create search and
deletion of directories.
• Memory and file management for allocation and de-allocation of
memory and allow user to create edit write read the files.
• Command interpreter to interpret commands issued by the user.
• Executive functions which provides programs to load and execute
Computing & Informatics L-12
46
user program retrieve error codes, correct and rerun the program.
• Some utility programs for house keeping cores.
File management it is one of the most useful services of an OS. File
management is supposed to hide all device specific aspects of file
manipulation from user and provide them with an adstract of a
simple, uniform space of named files.
File organization is a simple byte sequence. OS does not impose any
structure on file organization.
UNIX
• Unix is multi user OS which facilitates time sharing and was written
in C language in 1973.
• The interface provided to user is simple but yet powerful.
• The file system used by UNIX is hierarchical which allows efficient
implementation and easy use.
• UNIX considers all files to be a continuous sequence of characters.
Computing & Informatics L-12
47
• UNIX treats peripherals devices as if they are files.
• UNIX supports a scripting language called shell which allows
complex jobs to be performed using several built in programs.
• UNIX assumes on Knowledge of machine architecture from the user.
• UNIX can support any programming language that has a compiler or
an interpreter provided it has an interface that maps user request for
OS services to the standard set of requests used by UNIX.
UNIX
Computing & Informatics L-12
Test
Processing
Pipes
Shell
Utilities
Type
settling
Kernel
48
Hardware
USER
Terminal
Drivers
Foreground
Background
Editors
Compiler
Unix to Unix
copy UCP
Device Driver
Memory manager
USER
WINDOWS
• It is designed for home use.
• It is a graphical user interface of Microsoft Corporation. The GUI
provides picture oriented interface.
• Windows presents programs, procedure, files, commands etc. as
graphical symbols.
• The different versions of Windows are Windows-3, Windows-3.1,
Computing & Informatics L-12
49
Windows-3.11, Windows-95, Windows-98, Windows-2000 or
Windows-Millennium, Windows-NT and Windows-XP.
• Windows 95 is a mixed 16 bit and 32 bit multitasking OS.
• Windows 98 is a faster and easy to use OS.it si a 32 bit operating
system.
• The internet online environment is more closely associated with
Windows 98 desktop computers.
WINDOWS
• Windows 98 provides plug and play facility. It is also a
multitasking operating system.
• Windows-NT is 32 bit multi user OS. It provides multitasking
features. It can run on microprocessors of other companies other
than Intel’s.
• Windows supports TCP/IP/IPX/SPX data link control for
Computing & Informatics L-12
50
mainframes.
• Windows-NT provides Client server working mode, which is used
in networking of computing systems.
• The Windows XP embedded OS is used in devices such as hand
held computers, TV set-top-boxes and automated industrial
machines.
Utility Programs
• The utility programs are software tools to help programmers in
developing, writing, debugging and documenting programs.
• They cane either file management or program development
utilities.
• File management utilities are part of OS. The program
development utilities help user in writing and testing programs.
Computing & Informatics L-12
51
• Editor: a program which permits programmer to enter modify
and store source program or text.
• File manager a program which permits to create, copy, update or
delete files on the disks.
• Loader a program that loads machine codes of program into
system Memory.
• Linker a program that links smaller programs to form a single
program.
Computing & Informatics L-13
• Programming Languages
• Types of languages
• Components of programming languages
• Input and output statement
52
• Assignment statement and Print statement
• Subroutine and functions
• Algorithm and flow-chart
Programming Languages
• A program is set of instruction that are arranged in a sequence that
guides the computer to solve a problem.
• The process of writing a program is called programming.
• Many programming languages are available for writing various types
of application, system software.
• System programming are designed to make the computer easier to
Computing & Informatics L-13
53
use. An example is operating system.
• At present c C++ languages are widely used to develop system S/w.
• Application Programs are designed for specific computer
applications such as payroll processing, inventory control etc.
• For writing application programs, the programmer does not need to
control the basic circuitry of a computer system.
• One can chose any languages for writing a program according to
need.
Types of Languages
• Machine language: A first generation language written in binary form
consist of two parts operation code and second is operand.
• Assembly language: Second generation language written in
mnemonics form (symbol format), needs an assembler for translation
into machine code.
Computing & Informatics L-13
54
• High Level Language: Third generation language written in English
like language, easy to write programs needs compiler for translation
to machine code.
• Fourth generation Language: 4GL is a high level language that
requires significantly fewer instruction to accomplish a task uses the
object oriented approach.
Components of programming Language
• To write a program in programming language the various concept
such as representation of Datas, methods of expressing mathematical
and logical relationship among data elements differs language to
language but this are necessary parts of language.
• Variables, Constants, Data type, and expressions are the smallest
components of a programming language.
Computing & Informatics L-13
55
• Variable: a character or group of characters assigned by the
programmer to a single memory location and used in the program.
• Constant: it has fixed value in the sense that its value cannot be
equal to any other value other than already assigned in the program.
• Data Type: defines a set of related values/ integers, numbers
character and a specific set of specific operation that can be
performed on those values.
Components of programming Language
• Data Type: different type of data types are integers, character,
strings etc.
• Array: an array is a collection of same type of data (either string or
numeric), all of which are referenced by the same name.
• Array: Normally two types of array are used.
• One dimensional Array A(X): it is a list of related data of same
Computing & Informatics L-13
56
type referred to by the same variable name.
• Two Dimensional Array A (X,Y): it is used to represent the Datas
which are determined by two factors. It is defined by the rows and
column value.
• Expression: every computer language specify as in which various
arithmetic operators are used and evaluated in given expression.
Components of programming Language
• An expression may contain operators such as (), ^, -, *, /, +,.
• The operators mentioned above are called mathematical operators.
• In a programming languages the logical operators are also used to
perform the logical operations.
• Some of relational operators are = equal to, <> not equal to, < les
Computing & Informatics L-13
57
than, > greater than, <= les than equal to, >= greater than equal to.
• Every operators used in programming language has order of priority
for solving the expression among themselves.
• The logical operators are NOT, AND, OR, XOR, these four logical
operators are sufficient to express any logical condition.
Input and Output statement
• Input statements are normally used for supplying values to a list
of variables through an input device such as key board.
• During execution of input statement the program halt or waits for
the response from the user.
Computing & Informatics L-13
58
• Output statements are used for providing the output of result of
expressions or output of programs on monitor (normally) or in the
output devices.
• Some times the output may given file or printed in a paper
through printers.
Assignment statement and print statement
• This is the most used statement for assigning value to an identifier
(i.e. variables).
• The syntax is : variable = expression (like X = A+B)
• This is a way to display values of specified list of variables on
Computing & Informatics L-13
59
display screen.
• The syntax is printf(“ XXXXX”);
• Print statement is also an output statement.
• computer languages normally provides very rich facilities for
making the display as attractive as possible.
Conditional and looping statement
• This is one of the most important program structure that enables a
modern programmer to develop well structured programs.
• It accommodates statements corresponding to alternate tasks to be
performed depending upon truth value of the condition.
Computing & Informatics L-13
60
• It has three components a conditional expression the truth value of
which determines the action and an optional clause which
determines the other task to be performed if value is not truth.
• It is used to provide loop structure in the program. The purpose of
a loop is to repeat certain task until no more repletion is
desired.the for , while are most used loop statement.
Subroutine and functions
• While writing a program sometimes it is needed to repeat a group
of statement at several points.
• Subroutine is group of statement that can be referred to at
different points in a program. It is group of statement that can be
executed from different points in program.
Computing & Informatics L-13
61
• Function is rule or set of rules that assign one and only one value
of X to give value Y. For Y = f(X) here Y is a function of X.
• Library functions are supplied by the language by default. The
code for this functions does not appear in program. It is inserted
by the computer when program is translated into machine code.
Algorithm and flow-chart
• A computer works under instruction from the user.
• For solving any problem on a computer, the necessary instructions
describing a scheme of solution for the problem are to be arranged
and supplied by the user.
• The steps of of basic operations by following which a solution to a
Computing & Informatics L-13
62
problem can be obtained constitutes what is called an algorithm.
• Once an algorithm for a problem is prepared, it can be used
repeatedly for solving as many as instances of problem.
• A pictorial description of algorithm is used and is called Flow-chart.
• It also represent a clear graphical description of interdependence of
different steps of operation used in algorithm.
Algorithm and flow-chart
• The steps of operations used in an algorithm should be elementary
that they can easily be performed by a computer, capable of
executing previously mentioned instructions only or by a man who
may not even have knowledge of the problem but capable of
performing some operations only.
Computing & Informatics L-13
63
• Very precise description for operations used in the steps of an
algorithm are necessary to avoid any sort of confusion.
• Algorithm must always halt after a finite time for the input values
supplied to it.
• Algorithm must be very simple and descriptive in nature.
Algorithm and flow-chart
• Examples: find the Average of any three numbers.
1. Get the values of three numbers.
2. Compute the sum of the numbers.
3. Divide the sum by 3 to obtain the average.
4. Print the average value.
5. Stop.
Computing & Informatics L-13
64
• Algorithm to swap the value of X and Y or interchange the values of
X and Y.
1. Let a variable T.
2. T = X
3. X = Y
4. Y=T
Algorithm and flow-chart
• Algorithm to find the whether the given triangle is right angled.
1. Get the values of A, B, C.
2. SA = A*A, SB = B*B, SC = C*C
3. M = SA.
4. If SB > M then M = SB.
5. If SC > M then M = SC.
Computing & Informatics L-13
65
6. S = 0
7. If SA <> M then S = S + SA.
8. If SB <> M then S = S + SB.
9. If SC <> M then S = S + SC.
10. If S = M then print the triangle is right angled.
11. If S <> M then print “triangle is not right angled”
12. Stop.
Algorithm and flow-chart
• In flow charts the operations to be followed is represented by using
nodes labeled with the symbols of operation and directed arcs.
• All nodes in a flow chart are not identical in shape. The shape of a
node is determined by the type of operation it represent.
• Usually nodes are four types Input/Output boxes, Process boxes,
Decision boxes and Start /Stop boxes.
Computing & Informatics L-13
66
Get the value
of variable
I/P & O/P box
A = A+1
Process Box
Is A>B
Decision Box
Stop
Start/ Stop
Box
Algorithm and flow-chart
• Flow chart for average of three numbers.
Computing & Informatics L-13
Start
Get values
of X,Y, Z
67
Compute
SUM = X+Y+Z
Compute
AVE = SUM/3
Stop
Computing & Informatics L-14
• The C Languages
• Data types
• Input and output statement
• Assignment statement
68
The C Languages
• C is a middle level language as it can function like a low level
programming language to speed up processing as well as it can
also work like high level language.
• Program written in C contains one or more function.
• A C program must contain a function called main and programs
begin with main function.
Computing & Informatics L-14
69
• The comments may also be incorporated for description purpose.
The comment must be bounded by /* comments*/
• The comment are omitted during compilation by compiler.
• Basic block structure in C is
1 comment line 2 link Section 3 Definition Section
4 Global declaration section 5 Main () 6 {
7 Declarative statement 8 executable statement 9 }
The C Languages
• As example the first program in C is as.
/* This introductory program in C*/
# include
Main ()
{
Computing & Informatics L-14
70
Printf (“ Learn C Programming”);
}
• The second line # include is preprocessor directive
which ensures reading an header file stdio.h. it is a command to
the processor pass of compilation to perform a specific task.
• The third line is beginning of C program main function.
Data Types
• Character Set: four group namely letters a to z A to Z,digits,
special character, white space are allowed in C.
• Identifiers: the word or names used to refer the variable,
constant, function names are called as identifiers. A Key word
defined in the C should not be used for any identifiers.
• Constant: it is an identifier whose value does not change in
Computing & Informatics L-14
71
program. The four categories are Integers, Real,Character and
String.
• Integer constant refers to sequence of digits.
• Real constant is numeric constant with sign of decimal point or
exponent or combination of both.
• Character constant is any symbol or value that is the part of valid
list.
• String is sequence of characters.
Data Types
• Variables: A variable is the meaningful name assigned represent
a data object.
• Variable name must start with a letter.
• Variable name can not begin with digit.
• It can not contain punctuation mark math symbol or other special
symbol.
Computing & Informatics L-14
72
• Reserved words name can not be used for variable name.
• ANSI restrict variable to be of 32 character.
• Variables are created to store the value of data object in the
program. Result of an computational statement may be assigned
to a variable.
Data Types
• Relational Operator: it is used to compare the value of two
variable for various such as greater than, les than etc.
> is greater than, >= is greater than equal to, < is less than, <= is less
than equal to, = = equal to, != not equal to.
• Logical Operator: an expression, which combines two or more
relation operator is called logical expression. These expression
Computing & Informatics L-14
73
results ion true or false.
&& is logical AND, !! Logical OR, ! is logical NOT.
• Conditional Operator: it is used in place of if-then-else
construct.
Exp1 ? Exp2 : Exp3, here Exp1is evaluated first if its found true then
Exp2 is evaluated otherwise Exp3 is evaluated.
Val = (l>k) ? L : k here if L>k then Val will be = to l else Val = K.
Data Types
• Library Functions: the library functions are the well defined
functions for performing the specific task in a program.
• The compiler evaluates these functions.
• In C some mathematical functions are also allowed, these
functions are called mathematical functions.
• In order to use these library functions it is necessary to use header
Computing & Informatics L-14
74
files. The header files are logical collection of various functions.
• If the header files are not included the functions can not be used.
• Some of the common header files are stdio.h, math.h, conio.h etc.
• The library functions are not the part of the language but these are
supplied with the compiler.
Input and Output statement
• Input instruction is provided for getting necessary input from the
user of the program.
• Scanf: this function is used to input a set of values.
scanf(FS, list of arguments)
Here FS is known as format string and list of argument contains the
variable in to which the value or data from the standard input will
Computing & Informatics L-14
75
be stored.
Example: scanf(“%d %s %f”, &integer1, string1,&integer2);
This statement will store a decimal type integer data to integer1 (a
variable defined in the program), string to variable String1 and
floating point value to integer2 variable from the standard input.
Each format must start with % sign & each numeric variable must
preceded by & sign.
Input and Output statement
• Output statement or instruction is provided for giving necessary
output to the user of the program.
• printf: this function is used to print any combination of string,
number or character to the standard output of computer (monitor).
printf(“FS”, list of arguments)
Here FS is known as format string and contains the format characters
Computing & Informatics L-14
76
for the corresponding variables.
Example: printf(“sum of %d and %d is = %d \n”, integer1, integer2,
integer3);
This statement will give the output as sum of 3 and 4 is=7
Where 3 is value of integer1,4 is value of integer2 and 7 is the value
of integer3.
Each format must start with % sign.
Assignment statement
• Assignment operators are used to assign the result of
computational statements.
• The assignment statement A O E; where a is variable and O is
operator and E is expression.
Example: X = P+Q*R+Z-T;
Here after evaluation of P+Q*R+Z-T expression the resultant value
will be assigned to variable X.
Computing & Informatics L-14
77
Shorthand operator X+=3 is equal to X=X+3; X*=X is equal to
X=X*X, X/=B+C is equal to X=X?(B+C)and X-=2 is X=X-2.
• Increment operator A++ or ++A increments the value of variable
A by one. The difference is that a prefix operator first operates
once to the operand and then result is assigned to variable to the
left. Like A=1 B++A now A=2 and B=2 but B=A++ will be B=1
and A+2.
• Similarly the decrement operator is A– or –A.
Computing & Informatics L-15
• Information system for decision making
• Data management
78
• Database management technology
• Office automation system-LAN, WAN
Information system for decision making
• A system is a group of interrelated component working together
towards a common goal in an organized manner.
• A system has three parts input, output and process.
• Input is given to the system (like raw material, Datas etc.), the
given input is processed in processing element where the output
generated as per the requirement.
• In the system feedback and control is used and such system is
Computing & Informatics L-15
79
called cybernetic system.
• Feed back is a part of output used for modifying the input to
improve the output.
• An information is a processed data or abstracted data from the
available raw data.
• Information system is set of interrelated components that collect
the input and process it to provide the desired information
(output) with the help of feedback and control system.
Information system for decision making
• A computer based information system has five basic components
hardware software Data people and network.
• Hardware is physical computer equipment used to input output and
processing, software is a computer program that includes the
processing instructions to govern the operation of computer.
• People are the most important element in the most of systems as
they are required to operate the system.
• Data is basically raw facts and observations. It is a valuable
organized resource.
Computing & Informatics L-15
80
• Network are used to connect the computers and equipment in a
building around a country or around the world.
• Decision making can be classified by organizational level
corresponding to the strategic, management, knowledge and
operational levels of the organization.
• Unstructured decisions are those in which decision maker must
provide judgment evaluation and insights into problem definitions.
• Structured decisions are repetitive and routine and involve a
definite procedure.
Information system for decision making
• Normally the decision making consist of four stages intelligence,
design choice and implementation.
Computing & Informatics L-15
Structured
Semi-
Operational Knowledge Management Strategic
TPS
Office
MIS
81
Unstructured
Semistructured
system
KWS
DSS
ESS
TPS- Transaction processing system MIS- Management information system
KWS- Knowledge work station DSS- Decision support system
ESS- Executive support system
Information system for decision making
• A decision support system is system that provides tools to mangers
to assist them in solving semi structured and unstructured problems.
• A DSS is not intended to make decision but rather than to assist for
decision making.
• Characteristics of DDS are they support semi structured or
unstructured decision making. They are flexible enough to respond
to the changing needs of decision maker and they are easy to use.
• The component of a DSS are hardware, software and data is
necessary to provide interactive decision support.
Computing & Informatics L-15
82
Decision
maker
Management
work station
Interactive
decision
support
Database
Management
Dialogue generation
and management
DSS generator
Model Management
database
Model
base
Data management
• Data management is the most important aspect for an organization
since it provides the ability to complete most business activities.
• Data management is a way of keeping the raw facts in special
manner suitable to use it in efficient manner.
• Data is generally organized in a hierarchy that begins with
smallest data used by computer (bit).
Computing & Informatics L-15
83
• Character data is basic building block of information.
• Characters are put together to form a field. A collection of related
fields is record.
• A collection of related records is a file.
• At the highest level of this data hierarchy is data base, a collection
of integrated and related files.
Data management
• An entity is a generalized class of people, places or things for
which data is collected stored and maintained.
• An attribute is a characteristics of of an entity.
• A collection of fields about a specific object is a record. A Key is
a field or set of records that is used to identify the records.
• Normally there are two ways to mange the data.
• In Traditional approach separate data files are created and
Computing & Informatics L-16
84
stored for each application program.
• One of the flaws of traditional file oriented approach is data
duplication i.e. Data redundancy. When a change is made in one
record it is not necessary that same will be done in other record.
• Data redundancy therefore conflicts with data integrity.
• In traditional approach another flaws is program-data dependence.
Data management
• Database approach utilizes the Datas in a more efficient way. A
pool of related data is shared by multiple application programs.
• Some of the advantages of Database approach are: Improved
strategic use of corporate data, reduced data redundancy, easier
modification and updating data and program independence, better
protection, standardization of data access etc.
• Database approach has some disadvantages like increased cost
Computing & Informatics L-15
85
and specialized staff and increased vulnerability etc.
• Data modeling and database models are key considerations for
any organization to choose the right approach.
• A data model is a diagram of entities and their relationship.
Entity-relationship (ER) diagrams use basic graphical symbols to
show the organization of and relationship between data.
• The structure in most database follows one of the three logical
database models hierarchical, network and relational.
Data management
• In a hierarchical database model, the data is organized in a top
down or inverted tree structure.
• In network model an owner-member relationship instead of one to
many relationship like in hierarchical model.
• The both models suffer from the deficiency that once the
relationship is established the modification is difficult.
• In relational model all data elements are placed in two
Computing & Informatics L-15
86
dimensional tables called relations that are logical equivalent to
the files.
• The process of taking complex set of data and converting it into a
set of simple tables is called data normalization.
• Basic data manipulations include selecting, projecting and
joining.
• The data cleanup is used to develop the accuracy, flexibility,
relevancy, simplicity, verifiability in the data.
Database management technology
• A database management system (DBMS) is a group of programs
used as an interface between a database and application programs
or a database and the user.
• A dataware house is multidimensional database and is capable of
storing very large amount of data generated from business
applications.
• To retrieve data from the dataware house data mining tools are
Computing & Informatics L-15
87
required.
• A DBMS also acts as a user interface by providing a view of the
database. A subschema is file that contains the description of
subset of the database and identifies which user can view and
modify the data items in that subject.
• A data definition language (DDL) is collection of instruction and
commands used to define and describe data and data relationship
in a specific database.
Database management technology
• The important aspect of DBMS is storing and retrieving the data
from database.when database stores a data it utilizes the logical
access path (LAP).
• Data manipulation language (DML) is collection of commands
that are used to manipulate the database.
• Structured query language (SQL) lets programmers learn one
powerful query language and use it on systems from PCs to the
largest mainframe computers.
Computing & Informatics L-15
88
• SQL uses standardized and simplified procedures for retrieving
storing and manipulating data in a database system.
• Database administration DBA is very important face of DBMS
since the key issues like security, authorization, networking or
communication data from one user to other user is controlled by
DBA.
• Some popular DBMS are coral's Paradox, FoxPro, Microsoft
access, ORACLE etc.
Office automation system-LAN, WAN
• Office automation system simply helps in making an automated
office having multiple functions to be performed.
• Presently business organizations are in the need of fast and accurate
communication within the office as well as with their client so that
a fully automated system can be developed.
• Basically three kinds of computer networks Internet, Intranet and
Extranet are classified.
Computing & Informatics L-15
89
• Internet: a world wide system of computer network which is helpful
to any office for providing connectivity with out side world.
• The internet provides a synthesis of computing and communication
capabilities that adds valued to every part of the business cycle.
• An Intranet is a network within the organization. It uses
information technology like web browser, and servers, TCP/IP
client server network, hypermedia management system, HTML,
network management and security technology etc.
Office automation system-LAN, WAN
• An extranet is a network that links selected resources of the intranet
of an organization with its regular customers.
• Computer networks are required to facilitate Internet, Intranet or
Extranet.
• The computer networks are used to provide the file transfer
between two systems, electronic mail (E-mail), execute a program
on another computer, remote login, to share peripherals devices
Computing & Informatics L-15
90
such as printers and to provide teleconferencing etc.
• The computer networks must have security measures against
viruses and unauthorized access.
• The computer network must have reliability, less failure, less
average down time, protection from catastrophe, suitable hardware
software & transmission media.
• The network cost and traffic load and fixed cost & runtime cost are
important parameters to sorted out before a network is established.
Office automation system-LAN, WAN
• The function of a communication network is to interconnect DTE
(data terminal Equipment).
• DTE is a general term to identify the end user machine which is
usually a terminal or computer.
• Some example of DTEs are ATM, mobile phone a workstation for
air traffic control, a personal computer at home or office.
• The communication between DTEs depends or based upon the
Computing & Informatics L-15
91
Channel configuration, Transmission mode, Network topology
design, Categories of networks.
Channel configuration:
• Point to point channel configuration provides a dedicated link
between two communication devices.
• Point to multi point channel provides a communication between
single transmitter to may receivers.
Office automation system-LAN, WAN
Transmission mode:
• Simplex is way of communication in which direction of data flow is
in one way only in a single channel.
• Duplex is way of communication in which direction of data flow is
in both direction in a single channel.
• Half Duplex permits transmission in both direction but in a one
direction at time.
Computing & Informatics L-15
92
Network topology Design:
• The topology means the form. Network may have any one of the
following forms.
• Star topology each device is connected to a central device called
hub the communication between to DTE is by using Hub only not
directly.
• In tree topology the equipment are connected in a hierarchical
manner.
Office automation system-LAN, WAN
Network topology Design:
• In Bus topology the equipment are connected with each other using
a common bus.
• Ring topology a ring of connected equipment is formed.
• In mesh topology the each equipment is connected to each
equipment using a dedicated link.
Categories of network.
Computing & Informatics L-15
93
• Computer networks that are confined to a localized are I.e. an office
are known as local area network LAN.
• Computer network based on DQDB (distributed queue dual bus)
mechanism designed to extend over an entire city is Metropolitan
Area Network (MAN).
• Computer networks that covers large geographical areas that may
comprise a country a continent or even whole world is wide area
Network (WAN).
Computing & Informatics L-16
C language
• Control Structure
94
• Array
Control Structure
• Decision making and looping is one of the basic construct of any
programming language.
• In C language the IF…THEN..ELSE, WHILE, DO..WHILE,
FOR, BREAK and SWITCH are control structures statements.
• If Then Else statement: is provided for decision making. If the
out come of expression in If is true then the group of statement
Computing & Informatics L-16
95
mentioned in Then clause is executed otherwise Else is executed.
If (condition expression)
{ Statement set1; }
Else
{ statement set2; }
Control Structure
/* largest of three numbers */
# include
Main ()
{
int a,b,c;
printf (“Please enter all the three A, B and C number\n”);
scanf (“%d %d %d”,&a, &b, &c);
if (a>b)
{
if(a>c)
{ printf(“Largest number is %d\n”, a);
}
Computing & Informatics L-16
96
else
{ printf(“Largest number is %d\n”, c);
}
}
else
{
if (c>b)
{ printf(“Largest number is %d\n”, c);
}
else
{ printf(“Largest number is %d\n”, b);
}
}
}
Control Structure
#include
#include
void main()
{
int a,b,c;
char X;
clrscr();
printf (" please enter all the three numbers A B and C\n");
scanf("%d %d %d",&a,&b,&c);
if(a>b)
{
if(a>c)
{
printf("largest number is %d\n",a);
}
Computing & Informatics L-16
97
else
{
printf("largest number is %d\n",c);
}
}
else
{
if (c>b)
{
printf("largest number is %d\n",c);
}
else
{
printf("largest number is %d\n",b);
}
}
getch();
}
Control Structure
•While statement: is provided for repeated execution of
statements. The statements are executed until the condition is
fulfilled.
While (condition expression)
{
Statement set;
}
Computing & Informatics L-16
98
/* this is a program to calculate m to the
power n*/
#include
#include
main()
{
int m,n,count;
Float pow;
clrscr();
Control Structure
/*body of program*/
printf("This program gives the M to power
N\n");
printf("Please give value of M and N\n");
scanf("%d %d",&m,&n);
count=1;
pow = m;
while(countComputing & Informatics L-16
99
{
pow=pow*m;
count++;
}
printf("\n The %3d to the power
%3dis=%4d\n",m,n,pow);
getch();
return 0;}
Control Structure
• The out put of the program will be as follows:
This program gives the M to power N
Please give value of M and N
2 5 *(press enter here)*
The 2 to the power 5 is = 32
Computing & Informatics L-16
100
• On second run:
This program gives the M to power N
Please give value of M and N
11 6
The 11 to the power 6 is=1771561.000000
Control Structure
•Do-while statement: is also provided for repeated execution of
statements. The statements are executed until the condition is
fulfilled.The difference with while statement is that condition is
evaluated after execution of statements.
Do
{
Statement set;
Computing & Informatics L-16
101
} While (condition expression)
So in the last program the condition with do-while will be as:
do
{
pow=pow*m;
count++;
}
while(countControl Structure
•For statement: it is also provided for repeated execution of
statements. The statements are executed until the condition is
fulfilled.
for (expression1; expression2; expression3)
{
Statement set;
Computing & Informatics L-16
102
}
So in the program to calculate the m to the power n will be as :
for (count=1;count{
pow=pow*m;
}
Control Structure
•switch statement: this statement in C provides the multiple
branch selection. It checks for value of an expression against a list
of integer or character. If the match is successful, the group of
statement is executed
Switch (expression)
{
caseconstant 1:
Statement set2;
break;
Computing & Informatics L-16
103
caseconstant 2:
Statement set2;
break;
case constant 3:
Statement set3;
break;
.
.
Default:
Statement set3;
}
Control Structure
•Break and Goto statement: these statements are used in C to
change the flow of execution. The break is used in conjunction
with switch case however this statement can be used to
discontinue the loop.
Main()
{
int I=1;
While (I<100)
{
Computing & Informatics L-16
104
printf(“ the number = %d\n”,I);
I++
If (I==20) break;
}
}
•Use of go to
Goto LABLE;
Statement set1;
.
.
LABLE: statement set 3;
Arrays
• An array is a collection of variables of same type that are
represented by common name.
• A specific element of an array is accessed by an index.
• A one dimensional array is defined by its type followed by an
identifier with a expression.the O/p of expression must be +ve.
int salary[10]
Computing & Informatics L-16
105
char name[25]
float amount[12]
float Matrix[3][4]
• As indicated above the elements of an array can be initialized as
the other variables at the time of declaration.like:
Int height[5] = {123,124,122,121,112};
Static char name[3] ={‘s’,’e’,’g’};
Arrays
• All the arrays declaration define the maximum size of an array
thus they are called static array.
• In C flexibility is provided for not defining the size of an array.
• A programmer may leave the size of an array unspecified.the total
numbers of entries specified in the list of values defines the
maximum size of array.
Computing & Informatics L-16
106
Int student[ ] = {12,13 12, 14};
• It is not possible to process an array in a single shot. If an
operation is to be done on array, it must be element basis. This is
usually done using For loop, Do-while etc. on element basis.
• In the next slides the multiplication of two matrix is explained
using the arrays.
Arrays
/* The program for the multiplication of two matrix */
#include
#include
#define M 5
void main()
{
int i,j,r1,r2,c1,c2,x;
int a[M][M],b[M][M],c[M][M];
clrscr();
printf("program for multiplication of two matrix\n");
Computing & Informatics L-16
107
printf("The column of FIRST Matrix should be equal to row of SECOND
Matrix\n");
printf("Give the no of rows in the First Matrix\n");
scanf("%d",&r1);
printf("Give the no of column in the First Matrix\n");
scanf("%d",&c1);
printf("Give the no of rows in the Second Matrix\n");
scanf("%d",&r2);
printf("Give the no of column in the Second Matrix\n");
scanf("%d",&c2);
Arrays
/* To check the possibility of multiplication*/
if(c1!=r2)
{
printf("The Multiplication is not Possible sorry^^^\n");
}
else
{
/* To read the first MATRIX*/
printf("Give the give the elements of first Matrix\n");
for(i=0;i{
for(j=0;j{
Computing & Informatics L-16
108
printf("Give the %d row & %d column element of first
Matrix\n",i+1,j+1);
scanf("%d",&a[i][j]);
}
}
/* To read the second MATRIX*/
printf("Give the give the elements of Second Matrix\n");
for(i=0;i{
for(j=0;j{
printf("Give the %d row & %d column element of Second
Matrix\n",i+1,j+1);
scanf("%d",&b[i][j]);
}
}
Arrays
/* To Show the First MATRIX*/
printf("The First Matrix is \n");
for(i=0;i{
for(j=0;j{
printf("%5d",a[i][j]);
}
printf("\n");
}
/* To Show the SECOND MATRIX*/
Computing & Informatics L-16
109
printf("The Second Matrix is \n\n");
for(i=0;i{
for(j=0;j{
printf("%5d",b[i][j]);
}
printf("\n");
}
/* now the multiplication*/
for(i=0;i{
for(j=0;jArrays
/* now the multiplication*/
for(i=0;i{
for(j=0;j{
c[i][j]=0;
for(x=0;x{
c[i][j]=c[i][j]+a[i][x]*b[x][j];
}
}
}
Computing & Informatics L-16
110
/* To Show the OUTPUT MATRIX*/
printf("The Multiplied or Output Matrix is \n\n");
for(i=0;i{
for(j=0;j{
printf("%8d",c[i][j]);
}
printf("\n");
}
}
printf("\n THANK YOU\n");
getch();
}
Arrays
• The output of the program is as follows:
program for multiplication of two matrix
The coloumn of FIRST Matrix should be equal to row of SECOND Matrix
Give the no of rows in the First Matrix
2
Give the no of coloumn in the First Matrix
2
Give the no of rows in the Second Matrix
2
Give the no of coloumn in the Second Matrix
Computing & Informatics L-16
111
3
Give the give the elements of first Matrix
Give the 1 row & 1 coloumn elementof first Matrix
1
Give the 1 row & 2 coloumn elementof first Matrix
3
Give the 2 row & 1 coloumn elementof first Matrix
2
Give the 2 row & 2 coloumn elementof first Matrix
4
Arrays
Give the give the elements of Second Matrix
Give the 1 row & 1 coloumn elementof Second Matrix
1
Give the 1 row & 2 coloumn elementof Second Matrix
3
Give the 1 row & 3 coloumn elementof Second Matrix
5
Give the 2 row & 1 coloumn elementof Second Matrix
2
Give the 2 row & 2 coloumn elementof Second Matrix
4
Give the 2 row & 3 coloumn elementof Second Matrix
Computing & Informatics L-16
112
6
The First Matrix is
1 3
2 4
The Second Matrix is
1 3 5
2 4 6
The Multiplied or Output

No comments:

Post a Comment

Post a Comment

 
hit counter download
hit counter code download