computing informatics l 10 16[1]
TRANSCRIPT
-
8/12/2019 Computing Informatics L 10 16[1]
1/112
1
Computing & Informatics L-10
Microprocessors
Memory
Semiconductor Memory
Memory Controller
Magnetic Memory
Optical Disks
PCMCIA cards and slots
-
8/12/2019 Computing Informatics L 10 16[1]
2/112
-
8/12/2019 Computing Informatics L 10 16[1]
3/112
3
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.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.
Computing & Informatics L-10
-
8/12/2019 Computing Informatics L 10 16[1]
4/112
4
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.Pentium IV 32 bit microprocessor and 64 bit on Pentium 4 HT
microprocessor. Operating frequency up to2.8 GHz.
Computing & Informatics L-10
-
8/12/2019 Computing Informatics L 10 16[1]
5/112
5
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
Computing & Informatics L-10
ROM Memory
Static
Memory
Memory
RAM Memory
Primary (Main) Memory
Masked ROM
Auxiliary (Secondary) Memory
Dynamic
MemoryPROM EROM EEROM
-
8/12/2019 Computing Informatics L 10 16[1]
6/112
6
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 storageof 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 mainmemory. Write through and write back cache schemes are used in
computers.
Computing & Informatics L-10
-
8/12/2019 Computing Informatics L 10 16[1]
7/112
7
Memory
The diagrams shown below represents the memory hierarchies as per the speed of operation.
Computing & Informatics L-10
CPU
PrimaryMemory
SecondaryMemory
CacheMEM
PrimaryMemory
SecondaryMemory
CPU
-
8/12/2019 Computing Informatics L 10 16[1]
8/112
8
Semiconductor Memory
Semiconductor are of two types: Random access Memory RAMand Read only memory ROM.
The read write memory is commonly called RAM.RAMs
RAM is volatile memory, the information exist in the memory tillthe 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 invery short time (few milliseconds). Hence these are to berefreshed periodically.
For this purpose RAM controller are used.
Computing & Informatics L-10
-
8/12/2019 Computing Informatics L 10 16[1]
9/112
9
Semiconductor Memory
Static RAM uses Flip flops whereas Dynamic RAM uses gateswith capacitor so it requires less transistors per memory.
Extended Data Output RAM (EDO-RAM): any memory accessstores bytes of data into latches. Latches holds next 256 bytes of
information. SDRAM (Synchronous DRAM): these RAM chips uses the same
clock rate as the CPU, so it remains ready to transfer data whenneeded by the CPU.
DRAM (Dual-Ported RAM: allows to access two memorylocations simultaneously, also called video RAM (VRAM orWRAM windows RAM)
SIMM & DIMM: single inline & double inline modules are small printed ckt cards on which several DRAM chips are placed.
Computing & Informatics L-10
-
8/12/2019 Computing Informatics L 10 16[1]
10/112
10
Semiconductor MemoryROMs
ROM is non-volatile memory, the information exist in thememory even if the the power goes off. Used fro permanentstorage 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 programmer.
EPROM: in erasable PROM stored data can be erased byexposing it it to high intensive SW ultraviolet light.
EEPROM: electrically erasable PROM can be erased andreprogrammed 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.
Computing & Informatics L-10
-
8/12/2019 Computing Informatics L 10 16[1]
11/112
11
Memory Controller
A dynamic RAM (DRAM) requires refreshing ckt to refresh thecontent, for this purpose DRAM controllers are evolved.
Intel 8203: 64K DRAM controller capable of directly addressing anddriving up to 64 devices without external drivers. Provides
multiplexed address, address strobes, refresh logic, and refresh /access arbitration.Intel 8207: is dual port DRAM controller. It interfaces 16K, 64K and
256K DRAMs. Can directly address 2 MB without any externaldrivers. A dual port interface permits two different busses toaccess memory independently.
Intel 82C08: CHMOS DRAM controller. Can interface 64K and256K DRAMs. Can directly address 1MB. Capable of performingthe task of memory refreshing employing battery backup.
Computing & Informatics L-10
-
8/12/2019 Computing Informatics L 10 16[1]
12/112
12
Magnetic Memory
It is permanent type memory. It is non-volatile. Used as secondaryand backup memory.
Data is stored on the magnetic coating film by electrical pulses ofsuitable 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( the magnetic regions are vertical to the disk surface).
Types of Magnetic memory: Magnetic Disk (Hard Disks andFloppy 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.
Computing & Informatics L-10
-
8/12/2019 Computing Informatics L 10 16[1]
13/112
13
Magnetic Memory
The number of bytes stored in each sector is same. So all tracksstore same number of data.
These disks are semi random devices. Track is selected in randomfashion but data is written or read in serial fashion.
The time required to move the R/W head to the addressed sectoris access time (time to move head to the track is seek time + timerequired to bring the starting position of the sector is latencytime).
Disk Controller (DC) are required to convert instruction receivedfrom 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
Computing & Informatics L-10
-
8/12/2019 Computing Informatics L 10 16[1]
14/112
14
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 To increase capacity several hard disks are mounted on common
drive to constitute disk pack.RAID Systems:
Redundant Arrays of Inexpensive Disks (RAID) system disksoperate 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.
Computing & Informatics L-10
-
8/12/2019 Computing Informatics L 10 16[1]
15/112
15
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. 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.
Computing & Informatics L-10
-
8/12/2019 Computing Informatics L 10 16[1]
16/112
16
PCMCIA Cards and Slots
PCMIA stands for Personal Computer Memory Card InternationalAssociation. These are smart cards becoming standard feature fordesktop 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
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.5mm thick and have 68 pin connector. Type-IV has 166mm thick. These cards and slots supports hot insertion.
Computing & Informatics L-10
-
8/12/2019 Computing Informatics L 10 16[1]
17/112
17
Computing & Informatics L-11
Input Output Devices
Keyboard
Mouse
Monitor
Printer
Other I/O devices
Software
-
8/12/2019 Computing Informatics L 10 16[1]
18/112
18
Input and Output Devices
The input/ output devices (I/O) and secondary storage units ofcomputer 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. 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.
Computing & Informatics L-11
-
8/12/2019 Computing Informatics L 10 16[1]
19/112
19
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 thecomputer.
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.
Computing & Informatics L-11
-
8/12/2019 Computing Informatics L 10 16[1]
20/112
20
Mouse
A mouse is a pointing device. It is used to select a displayed menuon 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. The pulses transmitted by the mouse (generated by shaft encoder
for every incremental movement of the wheel) determine the thedistance 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.
Computing & Informatics L-11
-
8/12/2019 Computing Informatics L 10 16[1]
21/112
21
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
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 away that these beams struck the corresponding colour phosphor
dot arranged in a special manner.
Computing & Informatics L-11
-
8/12/2019 Computing Informatics L 10 16[1]
22/112
22
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 horizontalscan line.
When it reaches right hand side the beam is turned of and retracerapidly left side to the starting point of second line and traces thesecond 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 todeflect the beam left or right and up or down.
The beam can be directed to any point on the screen.
Computing & Informatics L-11
-
8/12/2019 Computing Informatics L 10 16[1]
23/112
23
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 arestored in a display RAM or video RAM.
According to the character to be displayed the content of RAMchanges.
A row counter and a character counter are employed to addressthe ASCII code of character in the display.
A CRT controllers contains the necessary electronic CKT tocontrol CRT display. Several controller ICs like Intel 8275, 8276,
822706 etc. are available.
Computing & Informatics L-11
-
8/12/2019 Computing Informatics L 10 16[1]
24/112
24
Printer s
Printers are commonly used out put device. These are classifiedas: 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 againsta ribbon to print) and Non-impact printer (uses thermal,chemical, electrostatic, laser beam, inkjet technology for printing)
A character Printer prints one character of text at time. They arelow 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.
Computing & Informatics L-11
-
8/12/2019 Computing Informatics L 10 16[1]
25/112
25
Printer s
An ink jet printers uses dot matrix approach to print text andgraphics. Most printers use multiple jets vertically aligned on acartridge.
A solid colour printer use inks which are solid ar room
temperature. At the time of printing inks are melted and flow tothe reservoirs in the print head. 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 containingtext graphics on a photo sensitive drums. The drum is coated with negatively charged photoconductive
material.
Computing & Informatics L-11
-
8/12/2019 Computing Informatics L 10 16[1]
26/112
26
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 graywindow, about inches wide. One merely slides his fingers tipacross the window to move the curser.
Computing & Informatics L-11
-
8/12/2019 Computing Informatics L 10 16[1]
27/112
27
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 recordedon 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 thescreen. It is popular on laptops
Computing & Informatics L-11
-
8/12/2019 Computing Informatics L 10 16[1]
28/112
28
Software
A program is sequence of instruction. A set of programs written for a computer is called software. Software are of two typesSystem software : the software needed to execute the user s program
is system S/W. It consist of operating system, assembler,complier, interpreter, debugging programs text editors etc.
Application software : the programs written for specific operationsmakes 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 Users program . The operating system is collection of programs that controls the
overall operation of a computer.
Computing & Informatics L-11
-
8/12/2019 Computing Informatics L 10 16[1]
29/112
29
Software
The software which are helpful to users in developing, writing,debugging and documenting programs are referred as utilityprograms.
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 storagedevice. 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 istool for writing the application program. Language are of two types: Low level Language and High Level
Language.
Computing & Informatics L-11
-
8/12/2019 Computing Informatics L 10 16[1]
30/112
-
8/12/2019 Computing Informatics L 10 16[1]
31/112
31
Software
Each microprocessor has its own instruction set andcorresponding machine codes. To solve the difficulty in writing programs in machine language
assembly language have developed.
In assembly language the programs are written in alphanumericsymbol code known as mnemonics. 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.
Computing & Informatics L-11
-
8/12/2019 Computing Informatics L 10 16[1]
32/112
32
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. 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.
Computing & Informatics L-11
-
8/12/2019 Computing Informatics L 10 16[1]
33/112
33
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. 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.
Computing & Informatics L-11
-
8/12/2019 Computing Informatics L 10 16[1]
34/112
34
SoftwareProgramming 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. Itis very close to the hardware of the CPU.
Third Generation, 3GL : High Level Languages are the thirdgeneration 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-11
f
-
8/12/2019 Computing Informatics L 10 16[1]
35/112
35
Computing & Informatics L-12
Operating Systems
MS-DOS
UNIX
WINDOWS
Utility Programs
f
-
8/12/2019 Computing Informatics L 10 16[1]
36/112
36
Operating System It is an organized collection of software consisting of procedures
for operating a computer and providing an environment forexecution of programs.
The objective of an OS is to make system convenient to use andutilize computer computer hardware in efficient manner.
OS acts as an interface between users and the hardware of acomputer 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 OSOperating system Commands: in this method user may interact with
OS directly by means of operating system commands.
Computing & Informatics L-12
C i & I f i L 12
-
8/12/2019 Computing Informatics L 10 16[1]
37/112
37
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
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.
Computing & Informatics L-12
C i & I f i L 12
-
8/12/2019 Computing Informatics L 10 16[1]
38/112
38
Operating SystemMulti Programming:
It allows more than one job (program) to utilize the CPU time atany 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 insteadof sitting idle.
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 programsrunning on the computer.
This improves the computation time as well as the resourceutilization.
Computing & Informatics L-12
Computing & Informatics L 12
-
8/12/2019 Computing Informatics L 10 16[1]
39/112
39
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. 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 multi-
user operating system.
Computing & Informatics L-12
Computing & Informatics L-12
-
8/12/2019 Computing Informatics L 10 16[1]
40/112
40
Operating SystemMulti 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 acomputer 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 effectivemanner.
Computing & Informatics L-12
Computing & Informatics L 12
-
8/12/2019 Computing Informatics L 10 16[1]
41/112
41
Operating SystemNetwork Operating systems
Each computer has its own OS instead of running part of globalsystem 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 filefrom one system to another with explicit transfer commands. NOS allows users to access the various resources of the network
host.
Controlling access so that users with proper authorization areallowed 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.
Computing & Informatics L-12
-
8/12/2019 Computing Informatics L 10 16[1]
42/112
Computing & Informatics L 12
-
8/12/2019 Computing Informatics L 10 16[1]
43/112
43
Operating System StructureLayered structure approach
In layered structure number of layers (levels), each built uponlower 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. 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 theseoperations are implemented.
Computing & Informatics L-12
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
Computing & Informatics L-12
-
8/12/2019 Computing Informatics L 10 16[1]
44/112
44
Operating System StructureKernel 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.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.
Computing & Informatics L-12
Computing & Informatics L 12
-
8/12/2019 Computing Informatics L 10 16[1]
45/112
45
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 When power is turned on BIOS takes control, it checks for
available H/w, then it reads from disk a small portion of OS andloads it into memory.
This Boot program the pulls the rest of OS from the disk stored inmain memory and completes the booting process.
BIOS is responsible for low level services.
Computing & Informatics L-12
Computing & Informatics L-12
-
8/12/2019 Computing Informatics L 10 16[1]
46/112
46
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
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. Filemanagement is supposed to hide all device specific aspects of filemanipulation from user and provide them with an adstract of asimple, uniform space of named files.
File organization is a simple byte sequence. OS does not impose anystructure on file organization.
Computing & Informatics L 12
Computing & Informatics L 12
-
8/12/2019 Computing Informatics L 10 16[1]
47/112
47
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. 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 forOS services to the standard set of requests used by UNIX.
Computing & Informatics L-12
Computing & Informatics L 12
-
8/12/2019 Computing Informatics L 10 16[1]
48/112
48
UNIXComputing & Informatics L-12
Hardware
TestProcessing
USER
Terminal
DriversForegroundBackground
Editors
Pipes
Shell
Utilities
Type
settling
Compiler
Unix to Unixcopy UCP
Device Driver
Memory manager
Kernel
USER
Computing & Informatics L 12
-
8/12/2019 Computing Informatics L 10 16[1]
49/112
49
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. asgraphical symbols.
The different versions of Windows are Windows-3, Windows-3.1,Windows-3.11, Windows-95, Windows-98, Windows-2000 orWindows-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 operatingsystem.
The internet online environment is more closely associated withWindows 98 desktop computers.
Computing & Informatics L-12
Computing & Informatics L 12
-
8/12/2019 Computing Informatics L 10 16[1]
50/112
50
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 otherthan Intel s.
Windows supports TCP/IP/IPX/SPX data link control formainframes.
Windows-NT provides Client server working mode, which is usedin networking of computing systems.
The Windows XP embedded OS is used in devices such as handheld computers, TV set-top-boxes and automated industrialmachines.
Computing & Informatics L-12
Computing & Informatics L-12
-
8/12/2019 Computing Informatics L 10 16[1]
51/112
51
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. 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-12
Computing & Informatics L-13
-
8/12/2019 Computing Informatics L 10 16[1]
52/112
52
Computing & Informatics L-13
Programming Languages
Types of languages
Components of programming languages
Input and output statement
Assignment statement and Print statement
Subroutine and functions
Algorithm and flow-chart
Computing & Informatics L-13
-
8/12/2019 Computing Informatics L 10 16[1]
53/112
53
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 touse. 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.
p g
fComputing & Informatics L-13
-
8/12/2019 Computing Informatics L 10 16[1]
54/112
54
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. 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.
p g
Components of programming Languageomput ng n ormat cs -
-
8/12/2019 Computing Informatics L 10 16[1]
55/112
55
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. 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 beequal 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 Languageomput ng n ormat cs -
-
8/12/2019 Computing Informatics L 10 16[1]
56/112
56
Co po e ts o p og a g a guage 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 sametype 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 andcolumn value.
Expression: every computer language specify as in which various
arithmetic operators are used and evaluated in given expression.
-
8/12/2019 Computing Informatics L 10 16[1]
57/112
Computing & Informatics L-13
-
8/12/2019 Computing Informatics L 10 16[1]
58/112
58
Input and Output statement
Input statements are normally used for supplying values to a listof 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.
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.
Computing & Informatics L 13
Computing & Informatics L-13
-
8/12/2019 Computing Informatics L 10 16[1]
59/112
59
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
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.
Computing & Informatics L 13
Computing & Informatics L-13
-
8/12/2019 Computing Informatics L 10 16[1]
60/112
60
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. 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.
Computing & Informatics L 13
Computing & Informatics L-13
-
8/12/2019 Computing Informatics L 10 16[1]
61/112
61
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.
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.
Co put g & o at cs 3
Computing & Informatics L-13
-
8/12/2019 Computing Informatics L 10 16[1]
62/112
62
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 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.
p g
Computing & Informatics L-13
-
8/12/2019 Computing Informatics L 10 16[1]
63/112
63
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 ofexecuting previously mentioned instructions only or by a man who
may not even have knowledge of the problem but capable of
performing some operations only. 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.
p g
Algorithm and flow-chartComputing & Informatics L-13
-
8/12/2019 Computing Informatics L 10 16[1]
64/112
64
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.
Algorithm to swap the value of X and Y or interchange the values ofX and Y.
1. Let a variable T.
2. T = X
3. X = Y
4. Y=T
Algorithm and flow-chartComputing & Informatics L-13
-
8/12/2019 Computing Informatics L 10 16[1]
65/112
65
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.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-chartComputing & Informatics L-13
-
8/12/2019 Computing Informatics L 10 16[1]
66/112
66
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 anode 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.
Get the valueof variable
I/P & O/P box
A = A+1
Process Box
Is A>BDecision Box
StopStart/ Stop
Box
Algorithm and flow-chartComputing & Informatics L-13
-
8/12/2019 Computing Informatics L 10 16[1]
67/112
67
go t a d ow c a t Flow chart for average of three numbers.
Start
Get valuesof X,Y, Z
ComputeSUM = X+Y+Z
ComputeAVE = SUM/3
Stop
Computing & Informatics L-14
-
8/12/2019 Computing Informatics L 10 16[1]
68/112
68
p g
The C Languages
Data types
Input and output statement
Assignment statement
The C LanguagesComputing & Informatics L-14
-
8/12/2019 Computing Informatics L 10 16[1]
69/112
69
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 canalso 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.
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 is1 comment line 2 link Section 3 Definition Section
4 Global declaration section 5 Main () 6 {
7 Declarative statement 8 executable statement 9 }
The C LanguagesComputing & Informatics L-14
-
8/12/2019 Computing Informatics L 10 16[1]
70/112
70
The C Languages As example the first program in C is as.
/* This introductory program in C*/# include
Main ()
{
Printf ( Learn C Programming);
}
The second line # include is preprocessor directivewhich ensures reading an header file stdio.h. it is a command tothe processor pass of compilation to perform a specific task.
The third line is beginning of C program main function.
Data TypesComputing & Informatics L-14
-
8/12/2019 Computing Informatics L 10 16[1]
71/112
71
yp 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 worddefined in the C should not be used for any identifiers.
Constant: it is an identifier whose value does not change in program. The four categories are Integers, Real,Character andString.
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. Strin is se uence of characters.
Data TypesComputing & Informatics L-14
-
8/12/2019 Computing Informatics L 10 16[1]
72/112
72
yp 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.
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 assignedto a variable.
Data TypesComputing & Informatics L-14
-
8/12/2019 Computing Informatics L 10 16[1]
73/112
73
yp 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, k) ? L : k here if L>k then Val will be = to l else Val = K.
Data TypesComputing & Informatics L-14
-
8/12/2019 Computing Informatics L 10 16[1]
74/112
74
yp 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, thesefunctions are called mathematical functions.
In order to use these library functions it is necessary to use headerfiles. 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 statementComputing & Informatics L-14
-
8/12/2019 Computing Informatics L 10 16[1]
75/112
75
p p 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 be stored.
Example: scanf(%d %s %f, &integer1, string1,&integer2);
This statement will store a decimal type integer data to integer1 (avariable defined in the program), string to variable String1 andfloating 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 statementComputing & Informatics L-14
-
8/12/2019 Computing Informatics L 10 16[1]
76/112
76
p p 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 charactersfor 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 valueof integer3.
Each format must start with % sign.
Assignment statementComputing & Informatics L-14
-
8/12/2019 Computing Informatics L 10 16[1]
77/112
77
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 isoperator 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.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 operatesonce to the operand and then result is assigned to variable to theleft. Like A=1 B++A now A=2 and B=2 but B=A++ will be B=1and A+2.
Similarly the decrement operator is A or A.
Computing & Informatics L-15
-
8/12/2019 Computing Informatics L 10 16[1]
78/112
78
Information system for decision making
Data management
Database management technology
Office automation system-LAN, WAN
Information system for decision makingComputing & Informatics L-15
-
8/12/2019 Computing Informatics L 10 16[1]
79/112
79
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 outputgenerated as per the requirement.
In the system feedback and control is used and such system iscalled cybernetic system.
Feed back is a part of output used for modifying the input toimprove the output.
An information is a processed data or abstracted data from theavailable raw data.
Information system is set of interrelated components that collectthe input and process it to provide the desired information
(output) with the help of feedback and control system.
Information system for decision makingComputing & Informatics L-15
-
8/12/2019 Computing Informatics L 10 16[1]
80/112
80
A computer based information system has five basic componentshardware 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 asthey are required to operate the system.
Data is basically raw facts and observations. It is a valuableorganized resource. 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 andoperational 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 adefinite procedure.
Information system for decision makingComputing & Informatics L-15
-
8/12/2019 Computing Informatics L 10 16[1]
81/112
81
Information system for decision making Normally the decision making consist of four stages intelligence,
design choice and implementation.
Structured
Unstructured
Semi-structured
Operational Knowledge Management Strategic
TPS
Officesystem
KWS
MIS
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 makingComputing & Informatics L-15
-
8/12/2019 Computing Informatics L 10 16[1]
82/112
82
A decision support system is system that provides tools to mangersto assist them in solving semi structured and unstructured problems.
A DSS is not intended to make decision but rather than to assist fordecision making.
Characteristics of DDS are they support semi structured orunstructured decision making. They are flexible enough to respondto the changing needs of decision maker and they are easy to use.
The component of a DSS are hardware, software and data isnecessary to provide interactive decision support.
Decisionmaker
Managementwork station
Interactivedecisionsupport
Database
ManagementDialogue generationand management
DSS generatorModel Management
database
Model base
Data managementComputing & Informatics L-15
-
8/12/2019 Computing Informatics L 10 16[1]
83/112
83
g 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 specialmanner suitable to use it in efficient manner.
Data is generally organized in a hierarchy that begins with
smallest data used by computer (bit). 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 collectionof integrated and related files.
Data managementComputing & Informatics L-16
-
8/12/2019 Computing Informatics L 10 16[1]
84/112
84
g 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
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 onerecord 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 managementComputing & Informatics L-15
-
8/12/2019 Computing Informatics L 10 16[1]
85/112
85
g 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: Improvedstrategic use of corporate data, reduced data redundancy, easiermodification and updating data and program independence, better
protection, standardization of data access etc.
Database approach has some disadvantages like increased costand specialized staff and increased vulnerability etc.
Data modeling and database models are key considerations forany 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 toshow 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 managementComputing & Informatics L-15
-
8/12/2019 Computing Informatics L 10 16[1]
86/112
86
g 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 tomany relationship like in hierarchical model.
The both models suffer from the deficiency that once therelationship is established the modification is difficult.
In relational model all data elements are placed in twodimensional tables called relations that are logical equivalent tothe 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 technologyComputing & Informatics L-15
-
8/12/2019 Computing Informatics L 10 16[1]
87/112
87
A database management system (DBMS) is a group of programsused 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 businessapplications.
To retrieve data from the dataware house data mining tools arerequired.
A DBMS also acts as a user interface by providing a view of thedatabase. A subschema is file that contains the description of
subset of the database and identifies which user can view andmodify 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.
-
8/12/2019 Computing Informatics L 10 16[1]
88/112
Office automation system-LAN, WANComputing & Informatics L-15
-
8/12/2019 Computing Informatics L 10 16[1]
89/112
89
y , 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 accuratecommunication within the office as well as with their client so thata fully automated system can be developed.
Basically three kinds of computer networks Internet, Intranet and
Extranet are classified. 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/IPclient server network, hypermedia management system, HTML,
network management and security technology etc.
Office automation system-LAN, WANComputing & Informatics L-15
-
8/12/2019 Computing Informatics L 10 16[1]
90/112
90
y , 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 orExtranet.
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 devicessuch as printers and to provide teleconferencing etc.
The computer networks must have security measures againstviruses and unauthorized access.
The computer network must have reliability, less failure, lessaverage down time, protection from catastrophe, suitable hardwaresoftware & transmission media.
The network cost and traffic load and fixed cost & runtime cost are
important parameters to sorted out before a network is established.
-
8/12/2019 Computing Informatics L 10 16[1]
91/112
Office automation system-LAN, WANComputing & Informatics L-15
-
8/12/2019 Computing Informatics L 10 16[1]
92/112
92
yTransmission mode:
Simplex is way of communication in which direction of data flow isin one way only in a single channel.
Duplex is way of communication in which direction of data flow isin both direction in a single channel.
Half Duplex permits transmission in both direction but in a onedirection at time.
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 notdirectly.
In tree topology the equipment are connected in a hierarchicalmanner.
Office automation system-LAN, WANComputing & Informatics L-15
-
8/12/2019 Computing Informatics L 10 16[1]
93/112
93
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. 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 MetropolitanArea Network (MAN).
Computer networks that covers large geographical areas that maycomprise a country a continent or even whole world is wide area
Network (WAN).
Computing & Informatics L-16
-
8/12/2019 Computing Informatics L 10 16[1]
94/112
94
C language
Control Structure
Array
Control StructureComputing & Informatics L-16
-
8/12/2019 Computing Informatics L 10 16[1]
95/112
95
Decision making and looping is one of the basic construct of any programming language.
In C language the IFTHEN..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 statementmentioned in Then clause is executed otherwise Else is executed.
If (condition expression)
{ Statement set1; }Else
{ statement set2; }
Control Structurel f h b
Computing & Informatics L-16
-
8/12/2019 Computing Informatics L 10 16[1]
96/112
96
/* 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);
}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
Computing & Informatics L-16
-
8/12/2019 Computing Informatics L 10 16[1]
97/112
97
#include #includevoid 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);
}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 StructureComputing & Informatics L-16
-
8/12/2019 Computing Informatics L 10 16[1]
98/112
98
While statement: is provided for repeated execution ofstatements. The statements are executed until the condition is
fulfilled. While (condition expression){Statement set;
}/* this is a program to calculate m to thepower n*/#include#includemain(){int m,n,count;Float pow;
Control StructureComputing & Informatics L-16
-
8/12/2019 Computing Informatics L 10 16[1]
99/112
99
/*body of program*/printf("This program gives the M to powerN\n");printf("Please give value of M and N\n");scanf("%d %d",&m,&n);count=1;pow = m;while(count
-
8/12/2019 Computing Informatics L 10 16[1]
100/112
100
The out put of the program will be as follows:
This program gives the M to power NPlease give value of M and N2 5 *(press enter here)*
The 2 to the power 5 is = 32 On second run:This program gives the M to power NPlease give value of M and N
11 6
The 11 to the power 6 is=1771561.000000
-
8/12/2019 Computing Informatics L 10 16[1]
101/112
Control StructureComputing & Informatics L-16
-
8/12/2019 Computing Informatics L 10 16[1]
102/112
102
For statement: it is also provided for repeated execution ofstatements. The statements are executed until the condition isfulfilled.
for (expression1; expression2; expression3){Statement set;}
So in the program to calculate the m to the power n will be as :for (count=1;count
-
8/12/2019 Computing Informatics L 10 16[1]
103/112
103
switch statement: this statement in C provides the multiple branch selection. It checks for value of an expression against a listof integer or character. If the match is successful, the group ofstatement is executed
Switch (expression){
case constant 1:Statement set2;
break;case constant 2:Statement set2;
break;case constant 3:
Statement set3;
break;..Default:Statement set3;}
Control StructureB k d G h d i C
Computing & Informatics L-16
-
8/12/2019 Computing Informatics L 10 16[1]
104/112
104
Break and Goto statement: these statements are used in C tochange the flow of execution. The break is used in conjunctionwith switch case however this statement can be used todiscontinue the loop.
Main(){
int I=1;While (I
-
8/12/2019 Computing Informatics L 10 16[1]
105/112
ArraysComputing & Informatics L-16
-
8/12/2019 Computing Informatics L 10 16[1]
106/112
106
All the arrays declaration define the maximum size of an arraythus 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 totalnumbers of entries specified in the list of values defines the
maximum size of array.Int student[ ] = {12,13 12, 14};
It is not possible to process an array in a single shot. If anoperation is to be done on array, it must be element basis. This isusually done using For loop, Do-while etc. on element basis.
In the next slides the multiplication of two matrix is explainedusing the arrays.
Arrays/* The program for the multiplication of two matrix */
Computing & Informatics L-16
-
8/12/2019 Computing Informatics L 10 16[1]
107/112
107
#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");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*/
Computing & Informatics L-16
-
8/12/2019 Computing Informatics L 10 16[1]
108/112
108
p y pif(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
-
8/12/2019 Computing Informatics L 10 16[1]
109/112
109
/ o S ow t e st /
printf("The First Matrix is \n");
for(i=0;i
-
8/12/2019 Computing Informatics L 10 16[1]
110/112
110
pfor(i=0;i
-
8/12/2019 Computing Informatics L 10 16[1]
111/112
111
The output of the program is as follows: program for multiplication of two matrixThe coloumn of FIRST Matrix should be equal to row of SECOND Matrix
Give the no of rows in the First Matrix2Give the no of coloumn in the First Matrix2Give the no of rows in the Second Matrix2
Give the no of coloumn in the Second Matrix3Give the give the elements of first MatrixGive the 1 row & 1 coloumn elementof first Matrix1Give the 1 row & 2 coloumn elementof first Matrix3Give the 2 row & 1 coloumn elementof first Matrix2Give the 2 row & 2 coloumn elementof first Matrix4
ArraysGive the give the elements of Second Matrix
Computing & Informatics L-16
-
8/12/2019 Computing Informatics L 10 16[1]
112/112
gGive the 1 row & 1 coloumn elementof Second Matrix1Give the 1 row & 2 coloumn elementof Second Matrix
3Give the 1 row & 3 coloumn elementof Second Matrix5Give the 2 row & 1 coloumn elementof Second Matrix2Give the 2 row & 2 coloumn elementof Second Matrix4
Give the 2 row & 3 coloumn elementof Second Matrix6The First Matrix is
1 32 4
The Second Matrix is
1 3 52 4 6
The Multiplied or Output Matrix is