0% found this document useful (0 votes)
7 views85 pages

Computers Notes

Module 1 provides an overview of computer hardware and software, detailing the evolution of computers through five generations, from vacuum tubes to artificial intelligence. It also categorizes computers into four types: supercomputers, mainframe computers, minicomputers, and microcomputers, explaining their characteristics and uses. Additionally, it covers fundamental concepts such as bits, bytes, and character encoding standards like ASCII, EBCDIC, and Unicode.

Uploaded by

mrspike736
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views85 pages

Computers Notes

Module 1 provides an overview of computer hardware and software, detailing the evolution of computers through five generations, from vacuum tubes to artificial intelligence. It also categorizes computers into four types: supercomputers, mainframe computers, minicomputers, and microcomputers, explaining their characteristics and uses. Additionally, it covers fundamental concepts such as bits, bytes, and character encoding standards like ASCII, EBCDIC, and Unicode.

Uploaded by

mrspike736
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 85

C Programming for Problem solving (18CPS13/23) Module 1: C Overview

MODULE 1

Introduction to computer Hardware and software: Computer generations, computer types, bits,
bytes and words, CPU, Primary memory, Secondary memory, ports and connections, input
devices, output devices, Computers in a network, Network hardware, Software basics, software
types.
Overview of C: Basic structure of C program, executing a C program. Constant, variable and data
types, Operators and expressions.

What is a Computer?
A Computer is device that can automatically performs a set of instructions. The computer takes
as input these instructions as a single unit, uses them to manipulate the data, and outputs the
results in user-specified ways. The processing is fast, accurate and consistent, and is generally
achieved without significant human intervention.

Founder of Computer: Charles Babbage

Computer Generations
Computers are such an integral part of our everyday life. Even more so the generation who
have grown from infancy within the global desktop and laptop revolution since the 1980s. The
history of the computer goes back several decades however and there are five definable generations
of computers.
Each generation is defined by a significant technological development that changes
fundamentally how computers operate – leading to more compact, less expensive, but more
powerful, efficient and robust machines.

1940 – 1956: First Generation – Vacuum Tubes


These early computers used vacuum tubes as circuitry and magnetic drums for memory.
As a result, they were enormous, literally taking up entire rooms and costing a fortune to run.

CSE, CITECH 2018-19 Page 1


C Programming for Problem solving (18CPS13/23) Module 1: C Overview
These were inefficient materials which generated a lot of heat, sucked huge electricity
and subsequently generated a lot of heat which caused ongoing breakdowns.
These first generation computers relied on machine language ‘(which is the most basic
programming language that can be understood by computers). These computers were limited to
solving one problem at a time. Input was based on punched cards and paper tape. Output came
out on print-outs. The two notable machines of this era were the UNIVAC and ENIAC machines
– the UNIVAC is the first every commercial computer which was purchased in 1951 by a
business – the US Census Bureau.
Summary:
✓ Vacuum Tubes
✓ Memory --Magnetic drums
✓ Air conditioner
✓ Much Space and Expensive
✓ Programmed using Machine Langauge
✓ ENIAC used 18000 vacuum tubes
• 1800 Sq ft of room space
• 180KW of Power
✓ Machine Language (0’s and 1’s)
✓ Input – Punch cards
✓ Output– paper
Note : ENIAC – Electronic Numerical Integrator and computer

CSE, CITECH 2018-19 Page 2


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

1956 – 1963: Second Generation – Transistors


The replacement of vacuum tubes by transistors saw the advent of the second generation
of computing. Although first invented in 1947, transistors weren‘t used significantly in
computers until the end of the 1950s. They were a big improvement over the vacuum tube,
despite still subjecting computers to damaging levels of heat. However, they were hugely superior
to the vacuum tubes, making computers smaller, faster, cheaper and less heavy on electricity use.
They still relied on punched card for input/printouts.

The language evolved from cryptic binary language to symbolic (assembly‘) languages.
This meant programmers could create instructions in words. About the same time high level
programming languages were being developed (early versions of COBOL and FORTRAN).
Transistor-driven machines were the first computers to store instructions into their
memories – moving from magnetic drum to magnetic core technology‘. The early versions
of these machines were developed for the atomic energy industry.

Summary:
✓ Transistors Replaced Vacuum Tubes
▪ Faster, Smaller and consumed less power
✓ Needs air conditioner
✓ Memory– Magnetic cores, disks
✓ Input– Punch Cards
✓ Output – Paper
✓ Programmed using– Assembly level Language
✓ High level languages: COBOL and Fortran appeared
✓ Stored Program concept –both data and program to reside in memory

CSE, CITECH 2018-19 Page 3


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

1964 – 1971: Third Generation – Integrated Circuits


By this phase, transistors were now being miniaturised and put on silicon chips (called
semiconductors). This led to a massive increase in speed and efficiency of these machines.
These were the first computers where users interacted using keyboards and monitors which
interfaced with an operating system, a significant leap up from the punch cards and printouts.
This enabled these machines to run several applications at once using a central program which
functioned to monitor memory.
As a result of these advances which again made machines cheaper and smaller, a new mass
market of users emerged during the ‗60s.
Summary:
✓ Integrated Circuits ( Transistors, resistors, capacitors and diodes)
✓ Speed and efficiency increased
✓ Smaller, cheaper and energy efficient
✓ Keyboard and monitors were used (replaced punched cards and paper)
✓ Memory– Magnetic hard disk
✓ Started using operating systems (OS) – DOS to control the resources of computer
✓ Programming Languages:
▪ BASIC, C, C++, and Java
o Time sharing (multiple users)

CSE, CITECH 2018-19 Page 4


C Programming for Problem solving (18CPS13/23) Module 1: C Overview
1972 – 2010: Fourth Generation – Microprocessors
This revolution can be summed in one word: Intel. The chip-maker developed the Intel
4004 chip in 1971, which positioned all computer components (CPU, memory, input/output
controls) onto a single chip. What filled a room in the 1940s now fit in the palm of the hand. The
Intel chip housed thousands of integrated circuits. The year 1981 saw the first ever computer (IBM)
specifically designed for home use and 1984 saw the MacIntosh introduced by Apple.
The increased power of these small computers meant they could be linked, creating
networks. Which ultimately led to the development, birth and rapid evolution of the Internet. Other
major advances during this period have been the Graphical user interface (GUI), the
mouse and more recently the astounding advances in lap-top capability and hand-held devices.

Summary:
• Microprocessor
• Large scale integration and Very Large Scale integration technology –entire CPU, its
memory, I/O control circuitry on a single chip)
• Intel introduced 4004 microprocessors in 1971
• Laptops and smart phones offer Giga Bytes of memory
• OS moved from MSDOS to mouse based GUI like windows
• Laptops, smart phones, microwave ovens and washing machines –microprocessors are
used
• Internet
• Windows, Linux for desktops and laptops
• Android for smart phones

CSE, CITECH 2018-19 Page 5


C Programming for Problem solving (18CPS13/23) Module 1: C Overview
2010- : Fifth Generation – Artificial Intelligence
Computer devices with artificial intelligence are still in development, but some of these
technologies are beginning to emerge and be used such as voice recognition.
AI is a reality made possible by using parallel processing and superconductors. Leaning to the
future, computers will be radically transformed again by quantum computation, molecular and
nano technology.

The essence of fifth generation will be using these technologies to ultimately create
machines which can process and respond to natural language, and have capability to learn and
organize.
Summary:
✓ Computers of future is the vision
✓ Artificial Intelligence and natural Languages
✓ VLSI to ULSI
✓ Speech recognition and speech output
✓ Quantum computers: Googles D-Wave 2X computer
o It is 100 million times faster than today's computer
✓ Parallel processing: Quad-core and Octa-core
✓ Neural networks and Expert systems (used in financial institutions for detection of credit
card fraud)

CSE, CITECH 2018-19 Page 6


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

Computer Types
Since the advent of the first computer different types and sizes of computers are offering
different services. Computers can be as big as occupying a large building and as small as a laptop
or a microcontroller in mobile & embedded systems.
The four basic types of computers are as under:
1. Supercomputer
2. Mainframe Computer
3. Minicomputer
4. Microcomputer
Supercomputer
The most powerful computers in terms of performance and data processing are the
Supercomputers. These are specialized and task specific computers used by large organizations.
These computers are used for research and exploration purposes, like NASA uses
supercomputers for launching space shuttles, controlling them and for space exploration purpose.
The supercomputers are very expensive and very large in size. It can be accommodated in large
air-conditioned rooms; some super computers can span an entire building.

CSE, CITECH 2018-19 Page 7


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

Summary:
✓ Huge machine – most powerful & fastest.
✓ Multiple CPU – uses multiple CPUs for parallel data processing
✓ Speed is measured in – FLOPS(floating point operations per second)
✓ “Tianhe-2” – Fastest super computer.
✓ Handle multiple users.
✓ Weather forecasting , analysis of geological data, nuclear simulation, space exploration.
✓ Enormous storage, huge amount of power & heat.

Mainframe Computer
Although Mainframes are not as powerful as supercomputers, but certainly they are quite
expensive nonetheless, and many large firms & government organizations uses Mainframes to
run their business operations. The Mainframe computers can be accommodated in large air-
conditioned rooms because of its size. Super-computers are the fastest computers with large data
storage capacity, Mainframes can also process & store large amount of data. Banks
educational institutions & insurance companies use mainframe computers to store data about their
customers, students & insurance policy holders.

CSE, CITECH 2018-19 Page 8


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

Summary:
✓ These are multi-user machines that can support hundreds or thousands of users using the
feature of time sharing supported by systems like Linux.
✓ Interaction – terminal & keyboard.
✓ Runs multiple program – even with a single CPU.
✓ Speed – MIPS (million instructions per second)
✓ Used – stock exchange transactions
▪ on-line transactions
▪ Government Sectors
▪ Banks
▪ Financial Sectors

Mini Computer
Minicomputers are used by small businesses & firms. Minicomputers are also called as
―Midrange Computers‖. These are small machines and can be accommodated on a disk with not
as processing and data storage capabilities as super-computers & Mainframes.
These computers are not designed for a single user. Individual departments of a large
company or organizations use Mini-computers for specific purposes. For example, a production
department can use Mini-computers for monitoring certain production process.

Summary:
✓ Mid-range computers.
✓ Down sized mainframes.
✓ Servers.

CSE, CITECH 2018-19 Page 9


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

✓ DEC – Digital equipment corporation introduced in 1970s, the mini computer is positioned
between mainframe and a micro-computer

Micro Computer
Desktop computers, laptops, personal digital assistant (PDA), tablets & smartphones are
all types of microcomputers. The micro-computers are widely used & the fastest growing
computers. These computers are the cheapest among the other three types of computers. The
Micro-computers are specially designed for general usage like entertainment, education and
work purposes. Well known manufacturers of Micro-computer are Dell, Apple, Samsung,
Sony& [Link] computers, Gaming consoles, Sound & Navigation system of a car,
Netbooks, Notebooks, PDA‘s, Tablet PC‘s, Smartphones, Calculators are all type of
Microcomputers.

Summary:
• PC – single user machine
• They are used both in the standalone mode (at home) and in a network (in office). Memory –
GB/TB
• Takes form – desktops, notebooks
• Single CPU – high end support – intel core i5,i7 etc…
• Operating system – windows, Mac OS , Linux
• PC supports – word processing
spread sheet handling
internet browsing
handling image, video, audio etc..,
• Variant of PC – workstation.
CSE, CITECH 2018-19 Page 10
C •Programming for Problem solving (18CPS13/23) Module 1: C Overview
• Workstation – powerful processors, high resolution terminal, High quality graphics.
• Scientific application – software development.
• Connected to network – share resources.

Smartphones & Embedded Computer


• The smartphone is a general purpose computer that is also capable of making phone calls.
• The smartphone has a powerful processor, usually with multiple cores like the quad-core
Snapdragon 820).
• It also supports gigabytes of main memory but doesn't have a hard disk for secondary storage.
This requirement is met by flash memory.
• Smartphones today run well-developed operating system (Android or iOS), and can run a wide
range of application (popular called “apps”).
Note: Flash Memory is a kind of memory that retains data in the absence of a power supply.

• Embedded computer – small computer in large systems.


• Small circuit – CPU, nonvolatile memory, I/o handling facilities.
• E.g.: washing machines, microwave oven
• Note: Volatile memory is computer storage that only maintains its data while the device
is powered.
nonvolatile memory is a type of computer memory that can retrieve stored
information even after having been power cycled.

CSE, CITECH 2018-19 Page 11


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

Bits, bytes and words


A bit is a Binary digit. So a bit is a zero or a one. Bits can be implemented in computer
hardware using switches. If the switch is on then the bit is one and if the switch is off then the bit
is zero. A bit is limited to representing two values.
Since the alphabet contains more than two letters, a letter cannot be represented by a bit.
A byte is a sequence of bits. Since the mid 1960's a byte has been 8 bits in length. 01000001 is
an example of a byte. Since there are 8 bits in a byte there are 2 8 different possible sequences for
one byte, ranging from 00000000 to 11111111. This means that a byte can be used to represent
any type of value with no more than 28 = 256 possible values. Since the number of things that
you can enter on a computer keyboard is smaller than 256 (including all keystoke pairs, like shift
or control plus another key), a code for a keystoke is represented with a code within a byte.
Since characters (letters, decimal digits and special characters such as punctuation marks, etc)
can be represented with bytes, a standard is needed to insure that the code that's used on your
computer is the same as the code that is used on mine. There are two standard codes that use one
byte to represent a character, ASCII and EBCDIC. ASCII, the American Standard Code for
Information Interchange, is the code that is most commonly used today. EBCDIC, Extended
Binary Coded Decimal Interchange Code, was used by IBM on its large mainframe computers in
the past. Wikipedia has more than you want to know about ASCII and EBCDIC. Since these
codes are limited to 256 possible combinations, certain character sets, such as Chinese, Arabic,
Japanese,
Klingon and others, cannot be represented using these codes. This problem is solved by
using another code, Unicode, which uses 2 bytes for each character. This extension allows
216 different symbols to be represented, a total of 65,536. The use of Unicode gives more
flexibility in the representation of data. The drawback of using Unicode is that it takes twice as
much space to store the same number of characters.
A word is the number of bits that are manipulated as a unit by the particular CPU of the
computer. Today most CPUs have a word size of 32 or 64 bits. For example, the notebook
computer that I bought in May 2008 contains a core 2 duo 64 bit processor. Data is fetched from
memory to the processor in word size chunks and manipulated by the ALU in word size chunks.
All other things being equal, (and they never are), larger word size implies faster and more
flexible processing.

CSE, CITECH 2018-19 Page 12


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

Summary:
• In decimal system for computing, a digit can have ten values (0 to 9) or states.
• In binary system, a digit can have only two states (0 or 1) is called binary digit (bit)
• Computers understand only binary system (i.e) 0 or 1.
• Byte represents 8 bits
• Byte is the standard unit of measurement of computer memory, data storage and
transmission speed.
• CPU handles data in larger units called words. In 32 bit machine 1 word=32 bits=4 bytes
In 64 bit machine 1 word=64 bits=8 bytes
Word is a even multiple of bytes.
• A bit (short for binary digit) is the smallest unit of data in a computer. A bit has a single
binary value, either 0 or 1.
• Half a byte (four bits) is called a nibble.
• A byte is a unit of data that is eight binary digits long.
o A byte is the unit most computers use to represent a
o character such as a letter, number.
• A word is a unit of data of a defined bit length.
Unit Equivalent to Remarks

1 kilobyte (KB) 1024 bytes Space used by 10 lines of text.

I megabyte (MB) 1024 kilobytes Memory of the earliest PCs

1 gigabyte (GB) 1024 megabytes Storage capacity of a CD-ROM

I terabyte (TB)
1024 gigabytes Capacity of today's hard disks.
1 petabyte (PB)
1024 terabytes Space used for rendering of film Avatar

CSE, CITECH 2018-19 Page 13


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

Inside the Computer

CPU
A central processing unit (CPU) is the electronic circuitry within a computer that
carries out the instructions of a computer program by performing the basic arithmetic, logical,
control and input/output (I/O) operations specified by the instructions. The computer industry
has used the term "central processing unit" at least since the early 1960s. [1] Traditionally, the
term "CPU"

refers to a processor, more specifically to its processing unit and control unit
(CU), distinguishing these core elements of a computer from external components such
as main memory and I/O circuitry.[2]

The form, design, and implementation of CPUs have changed over the course of
their history, but their fundamental operation remains almost unchanged. Principal components
of a CPU include the arithmetic logic unit (ALU) that performs arithmetic and
logic operations, processor registers that supply operands to the ALU and store the results
of ALU operations and a control unit that orchestrates the fetching (from memory) and
execution of instructions by directing the coordinated operations of the ALU, registers and other
CSE,components.
CITECH 2018-19 Page 14
C Programming for Problem solving (18CPS13/23) Module 1: C Overview

This part of the computer system collects the raw data from the input devices and converts
it to useful information which can then be used by the output devices. On some computers,
the CPU can be a single microchip. On bigger systems, the CPU can be formed from a number
of chips working together.

The CPU is made up of three main parts:

Control Unit this part controls the input and output devices
Arithmetic Logic Unit this is the part that does all the working out: it does all the maths
and makes the decisions
Immediate Access Store this is the memory available for programs and data. The
more memory the CPU has - the more programs it can run at the same time; and the
more data it can deal with in one go.
Primary Memory
Primary storage (also known as main memory or internal memory), often referred to
simply as memory, is the only one directly accessible to the CPU. The CPU continuously
reads instructions stored there and executes them as required. Any data actively operated
on is also stored there in uniform manner.
Historically, early computers used delay lines, Williams tubes, or rotating magnetic drums
as primary storage. By 1954, those unreliable methods were mostly replaced by
magnetic core memory. Core memory remained dominant until the 1970s, when
advances in integrated circuit technology allowed semiconductor memory to become
economically competitive.
This led to modern random-access memory (RAM). It is small-sized, light, but quite
expensive at the same time. (The particular types of RAM used for primary storage
are also volatile, i.e. they lose the information when not powered).

Main memory is directly or indirectly connected to the central processing unit via a
memory bus. It is actually two buses (not on the diagram): an address bus and a data bus. The
CPU firstly sends a number through an address bus, a number called memory address, that
indicates the desired location of data.

CSE, CITECH 2018-19 Page 15


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

Then it reads or writes the data in the memory cells using the data bus. Additionally, a memory
management unit (MMU) is a small device between CPU and RAM recalculating the actual
memory address, for example to provide an abstraction of virtual memory or other tasks.

As the RAM types used for primary storage are volatile (uninitialized at start up), a computer
containing only such storage would not have a source to read instructions from, in order
to start the computer. Hence, non-volatile primary storage containing a small startup
program (BIOS) is used to bootstrap the computer, that is, to read a larger program from
non-volatile secondary storage to RAM and start to execute it.

Secondary Memory

Secondary st orage (also known as external memory or auxiliary storage), differs from
primary storage in that it is not directly accessible by the CPU. The computer usually uses
its input/output channels to access secondary storage and transfers the desired data
using intermediate area in primary storage. Secondary storage does not lose the data when the
device is powered down—it is non-volatile. Per unit, it is typically also two orders of magnitude
less expensive than primary storage. Modern computer systems typically have two orders of
magnitude more secondary storage than primary storage and data are kept for a longer time there.
In modern computers, hard disk drives are usually used as secondary storage. The time taken
to access a given byte of information stored on a hard disk is typically a few thousandths of a
second, or milliseconds. By contrast, the time taken to access a given byte of information
stored in random-access memory is measured in billionths of a second, or nanoseconds. This
illustrates the significant access-time difference which distinguishes solid-state memory from
rotating magnetic storage devices: hard disks are typically about a million times slower than
memory. Rotating optical storage devices, such as CD and DVD drives, have even longer access
times. With disk drives, once the disk read/write head reaches the proper placement and the data
of interest rotates under it, subsequent data on the track are very fast to access. To reduce the
seek time and rotational latency, data are transferred to and from disks in large contiguous
blocks.
Most computer operating systems use the concept of virtual memory, allowing
utilization of more primary storage capacity than is physically available in the system. As
the primary memory fills up, the system moves the least-used chunks (pages) to secondary
storage devices (to a swap file or page file), retrieving them later when they are needed. As
CSE, CITECH 2018-19 Page 16
C Programming for Problem solving (18CPS13/23) Module 1: C Overview

more of these retrievals from slower secondary storage are necessary, the more the overall
system performance is degraded.

Summary:
The CPU has evolved from a bulky vacuum tube based unit of the 1940s to a modern 5cm square
chip that is commonly called the microprocessor, or simple processor.
✓ The CPU represented by a single chip in a PC.
✓ CPU needs both fast (primary memory) and slow (secondary memory)memory for its
operation
It comprises the following components
✓ Arithmetic and Logic Unit (ALU)
✓ Control Unit (CU)
✓ Special purpose registers
✓ A clock

Central Processing Unit:


✓ The chip generates lot of heat ,so it is mounted on the motherboard with heat sink and a fan
to dissipate the heat
✓ CPU uses high speed registers to store current instruction and its data.
✓ One of the registers, called the program counter, stores the address in primary memory of
the next instruction to be executed.
✓ The ALU is a super calculator. It performs both arithmetic and logical calculations
✓ The CU does not perform any computational task, using signals CU controls the way in
which data is moved between various components.
✓ Both ALU and CU uses the services of a clock to sequencing and synchronizing their
operations
✓ Program instructions are executed using fetch-decode-execute mechanism.
✓ An instruction is first fetched from primary memory using the address stored in program
counter. Then program counter is incremented to reflect the address of next instruction.
✓ The fetched instruction is decoded to create signals.
✓ Then the converted instruction is then executed by CPU.

CSE, CITECH 2018-19 Page 17


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

✓ The output is copied to another register from there it is copied to primary memory.
✓ The next cycle can now begin.
✓ All these activities need synchronization by the clock.
✓ Clock generates pulses at regular intervals.
✓ CPU cannot execute more than one instruction in one clock pulse even though one
instruction may take several clock pulses to execute.
✓ Faster the clock, faster is the execution
✓ The intel core i7 has a clock speed of 3.4 GHz, which means it emits 3.4 billion pulses in one
second.
✓ Today’s processors have multicore in the [Link]- An octacore chip has eight processors in
the chip.
✓ All these activities need synchronization by the clock.
✓ Clock generates pulses at regular intrevals.
✓ CPU cannot execute more than one instruction in one clock pulse even though one
instruction may take several clock pulses to execute.
✓ Faster the clock, faster is the execution
✓ The intel core i7 has a clock speed of 3.4 GHz, which means it emits 3.4 billion pulses in
one second.
✓ Today’s processors have multicore in the [Link]- An octacore chip has eight processors in
the chip.
MEMORY
 Computer supports multiple types of memory
Two types: Primary memory
Secondary memory
 Primary memory has the following types: housed in motherboard, fastest in CPU itself
✓ RAM-SRAM, DRAM (Volatile)
✓ ROM- PROM,EPROM,EEPROM (non volatile)
✓ Cache memory (L1,L2 and L3) Volatile
✓ CPU registers Volatile

CSE, CITECH 2018-19 Page 18


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

Random Access Memory


✓ RAM (Random Access Memory) is the hardware in a computing device where the operating
system (OS), application programs and data in current use are kept so they can be quickly
reached by the device's processor.
✓ RAM is the main memory in a computer, and it is much faster to read from and write to than
other kinds of storage, such as a hard disk drive (HDD), solid-state drive (SSD) or optical
drive.
✓ Random Access Memory is volatile. That means data is retained in RAM as long as the
computer is on, but it is lost when the computer is turned off.
Read Only Memory
✓ ROM – permanent memory that can be read but not written
✓ ROM contents are written at the time of manufacture.
✓ ROM- non volatile , capacity of ROM- 1, 2 or 4 MB compared to 1, 2 or 4 GB DRAM
✓ ROM stores BIOS- initiates start up process before transferring the control to operating
system
Types of ROM
✓ PROM - left blank at manufacture. Can be written (burn) only once by PROM programmer
as per customer’s choice.
✓ EPROM- obsolete. It can be rewritten but only once. Erased by exposing to UV radiation.
✓ EEPROM- erased and written multiple times, higher than normal voltage is applied to erase

Cache Memory
✓ Holds portion of program that are frequently used by CPU.
✓ Available between CPU and RAM
✓ When executing, CPU first looks for the instruction and data in cache. if found it is cache
hit else it is cache miss.
✓ Modern computers support multiple levels of cache.
✓ CPU contains L1 cache ( small and fast), L2 outside CPU but close to it.
✓ L3 slow than L1 and L2 but faster than RAM
✓ First CPU searches in L1, if not
▪ found searches in L2, if not found
▪ then in L3, if not found takes from RAM
CSE, CITECH 2018-19 Page 19
C Programming for Problem solving (18CPS13/23) Module 1: C Overview

Registers
✓ Registers are a type of computer memory used to quickly accept, store, and transfer data and
instructions that are being used immediately by the CPU.
✓ The registers used by the CPU are often termed as Processor registers.
✓ A processor register may hold an instruction, a storage address, or any data (such as bit
sequence or individual characters).

Secondary Memory:
✓ Hard disk including the portable disk (500 GB to 4 TB).
✓ Magnetic tape (20 TB).
✓ CD-ROM (700 MB-less than 1 GB).
✓ DVD-ROM (4.7 GB and 8.5 GB).
✓ Blu-ray disk (27 GB and 50 GB).
✓ Flash memory based on the EEPROM (1 GB to 128 GB).
✓ The obsoleted floppy disk (1.2 MB and 1.44 MB).

Hard Disk:
✓ Every disk contains a spindle that holds one or more platters made of non-magnetic
material like glass or aluminium (Fig. 1.4). Each platter has two surfaces coated with
magnetic material.
✓ Information is encoded onto these platters by changing the direction of magnetization using
a pair of read-write heads available for each platter surface.
✓ Eight surfaces require eight heads; they are mounted on a single arm and cannot be
controlled individually.
✓ Each surface is composed of a number of concentric and serially numbered tracks.
✓ There are many tracks bearing the same track number as there are surfaces. This can then
visualize a cylinder comprising all tracks bearing the same number on each disk surface.
✓ Thus, there will be as cylinders in the disk as there are tracks on each usable surface.
✓ Each track is further broken into sectors or blocks. So, if each track has 32 blocks and a
disk has eight surfaces, then Up 256 blocks per cylinder.

CSE, CITECH 2018-19 Page 20


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

Fig.: Hard disk

Magnetic Tape
✓ The age-old magnetic tape is still around thanks to the enhancements that have been made to
this device.
✓ The basic technology has not changed though; the tape is made of a plastic film with one side
coated with magnetic material.
✓ The entire mechanism comprising two spools and the tape is encapsulated in a small cassette
or cartridge.
✓ Current technology supports capacities of 1 TB or more, but 200 TB tapes are expected to
be launched in the near future.
✓ Data are read from and written to the tape using a read-write head.
✓ To locate a file, the tape has to be rewound before a sequential search can begin.
✓ Tape backup is most suitable for archiving data of the hard disk that are not expected to be
needed at short notice. The backup is inexpensive and convenient for restoring lost data.

Fig : Magnetic Tape

CSE, CITECH 2018-19 Page 21


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

Optical Disks:
The CD-ROM, DVD-ROM and Blu-Ray.
Non-volatile read-only memory, these disks, comprising mainly the CD-ROM and DVD-ROM,
can hold large volumes of data(700 MB to 8.5 GB).
✓ The Blu-ray disk enhances this capacity to 50 GB. A laser beam in their drives controls the
read and writes operations.
✓ Optical disks are made of carbonate material with a thin layer or two of reflective film.
✓ A laser beam is used to construct pits and lands by burning (writing) selected areas along
its tracks.
✓ CD-R, DVD-R – Data can be recorded only once, CD-RW, DVD-RW – Data can be
recorded multiple times.
✓ The optical drive uses three motors for the following
o functions: operating the tray, spinning the disk and guiding the laser beam.

Flash Memory:

✓ They are portable, need little power and are quite reliable.
✓ The capacities offered by this class of devices are increasing
o exponentially while their prices continue to decline substantially.
✓ The memory stick or pen drive is the most common type of flash memory used on the
computer.
✓ The solid state disk (SSD) a bigger device meant to replace the traditional magnetic hard disk.
Many small laptops (like Chrome books) have the operating system and a small set of programs
stored on this online device.

CSE, CITECH 2018-19 Page 22


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

✓ magnetic card, is used mainly in cameras, but using adapters, they can connect to the USB port
as well.
The most popular form of this device is the micro-SD card.

Floppy Disk :

✓ The floppy diskette was once the only form of portable storage that could be carried in the
pocket.
✓ A read/write head actually makes contact with this disk while it is rotating.
✓ The floppy was available in two sizes (5.25" and 3.5"), offering capacities of 1.2 MB and 1.44
MB respectively.

CSE, CITECH 2018-19 Page 23


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

Ports and Connections

A Computer Port is an interface or a point of connection between the computer and its peripheral
devices. Some of the common peripherals are mouse, keyboard, monitor or display unit, printer,
speaker, flash drive etc.

The main function of a computer port is to act as a point of attachment, where the cable
from the peripheral can be plugged in and allows data to flow from and to the device.
A computer port is also called as a Communication Port as it is responsible for communication
between the computer and its peripheral device. Generally, the female end of the connector is
referred to as a port and it usually sits on the motherboard.

In Computers, communication ports can be divided into two types based on the type or
protocol used for communication. They are Serial Ports and Parallel Ports.

A serial port is an interface through which peripherals can be connected using a serial
protocol which involves the transmission of data one bit at a time over a single communication
line. The most common type of serial port is a D-Subminiature or a D-sub connector that carry
RS-232 signals.

A parallel port, on the other hand, is an interface through which the communication between
a computer and its peripheral device is in a parallel manner i.e. data is transferred in or out in
parallel using more than one communication line or wire. Printer port is an example of
parallel port.

PS/2
PS/2 connector is developed by IBM for connecting mouse and keyboard. It was
introduced with IBM‘s Personal Systems/2 series of computers and hence the name
PS/2 connector. PS/2 connectors are color coded as purple for keyboard and green for
mouse.

CSE, CITECH 2018-19 Page 24


C Programming for Problem solving (18CPS13/23) Module 1: C Overview
Parallel Port
Parallel port is an interface between computer and peripheral devices like printers with
parallel communication. The Centronics port is a 36 pin port that was developed as an interface
for printers and scanners and hence a parallel port is also called as a Centronics port.
Before the wide use of USB ports, parallel ports are very common in printers. The Centronics
port was later replaced by DB-25 port with parallel interface.
Audio Ports
Audio ports are used to connect speakers or other audio output devices with the
computer. The audio signals can be either analogue or digital and depending on that the port and
its corresponding connector differ.

VGA Port
VGA port is found in many computers, projectors, video cards and High Definition TVs.
It is a D-sub connector consisting of 15 pins in 3 rows. The connector is called as DE-15.
VGA port is the main interface between computers and older CRT monitors. Even the modern
LCD and LED monitors support VGA ports but the picture quality is reduced. VGA carries
analogue video signals up to a resolution of 648X480.

Digital Video Interface (DVI)


DVI is a high speed digital interface between a display controller like a computer and a
display device like a monitor. It was developed with an aim of transmitting lossless digital video
signals and replace the analogue VGA technology.
Display Port
Display Port is a digital display interface with optional multiple channel audio and other
forms of data. Display Port is developed with an aim of replacing VGA and DVI ports as the
main interface between a computer and monitor.

HDMI
HDMI is an abbreviation of High Definition Media Interface. HDMI is a digital interface
to connect High Definition and Ultra High Definition devices like Computer monitors, HDTVs,
Blu-Ray players, gaming consoles, High Definition Cameras [Link] can be used to carry
uncompressed video and compressed or uncompressed audio signals.

CSE, CITECH 2018-19 Page 25


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

USB
Universal Serial Bus (USB) replaced serial ports, parallel ports, PS/2 connectors, game
ports and power chargers for portable devices. USB port can be used to transfer data, act
as an interface for peripherals and even act as power supply for devices connected to it. There
are three kinds of USB ports: Type A, Type B or mini USB and Micro USB.

Input Devices
An input device is any hardware device that sends data to a computer, allowing you to
interact with and control it. The most commonly used or primary input devices on a computer
are the keyboard and mouse. However, there are dozens of other devices that can also be used
to input data into the computer.
Today, input devices are important because they are what allows you to interact with and add
new information to a computer. For example, if a computer had no input devices, it could run
by itself but there would be no way to change its settings, fix errors, or other various user
interactions. Also, if you wanted to add new information to the computer (e.g., text, command,
document, picture, etc.), you wouldn't be able to do so without an input device.

Output Devices
An output device is any device used to send data from a computer to another device or user.
Most computer data output that is meant for humans is in the form of audio or video. Thus, most
output devices used by humans are in these categories. Examples include monitors, projectors,.
Output devices allow computers to communicate with users and with other devices. This can include
peripherals, which may be used for input/output (I/O) purposes, like network interface cards
(NICs), modems, IR ports, RFID systems and wireless networking devices, as well as mechanical
output devices, like solenoids, motors and other electromechanical devices.
Some of the most common output devices that people are familiar with include monitors, which
produce video output; speakers, which produce audio output; and printers, which produce text or
graphical output.

CSE, CITECH 2018-19 Page 26


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

Computers in a network
The Network allows computers to connect and communicate with different computers via any
medium. LAN, MAN and WAN are the three major types of the network designed to operate
over the area they cover. There are some similarities and dissimilarities between them. One of
the major differences is the geographical area they cover, i.e. LAN covers the smallest
area; MAN covers an area larger than LAN and WAN comprises the largest of all.

Local Area Network (LAN): LAN or Local Area Network connects network devices in such a
way that personal computer and workstations can share data, tools and programs. The group of
computers and devices are connected together by a switch, or stack of switches, using a private
addressing scheme as defined by the TCP/IP protocol. Private addresses are unique in relation to
other computers on the local network. Routers are found at the boundary of a LAN, connecting
them to the larger WAN.
Metropolitan Area Network (MAN): MAN or Metropolitan area Network covers a larger area
than that of a LAN and smaller area as compared to WAN. It connects two or more computers
that are apart but resides in the same or different cities. It covers a large geographical area and may
serve as an ISP (Internet Service Provider). MAN is designed for customers who need a high-
speed connectivity. Speeds of MAN ranges in terms of Mbps. It‘s hard to design and maintain a
Metropolitan Area Network.
The fault tolerance of a MAN is less and also there is more congestion in the network. It
is costly and may or may not be owned by a single organization. The data transfer rate and the
propagation delay of MAN is moderate. Devices used for transmission of data through MAN are:
Modem and Wire/Cable. Examples of a MAN are the part of the telephone company network
that can provide a high-speed DSL line to the customer or the cable TV network in a city.
Wide Area Network (WAN): WAN or Wide Area Network is a computer network that extends
over a large geographical area, although it might be confined within the bounds of a state or
country. A WAN could be a connection of LAN connecting to other LAN‘s via telephone lines
and radio waves and may be limited to an enterprise (a corporation or an organization) or
accessible to the public. The technology is high speed and relatively expensive.

CSE, CITECH 2018-19 Page 27


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

There are two types of WAN: Switched WAN and Point-to-Point WAN. WAN is
difficult to design and maintain. Similar to a MAN, the fault tolerance of a WAN is less and
there is more congestion in the network. A Communication medium used for WAN is PSTN or
Satellite Link. Due to long distance transmission, the noise and error tend to be more in WAN.

Network hardware
Networking hardware, also known as network equipment or computer
networking devices, are physical devices which are required for communication and
interaction between devices on a computer network. Specifically, they mediate data in a
computer network.[1] Units which are the last receiver or generate data are called hosts or data
terminal equipment.

Networking devices may include gateways, routers, network bridges, modems,


wireless access points, networking cables, line drivers, switches, hubs, and repeaters; and
may also include hybrid network devices such as multilayer switches, protocol
converters, bridge routers, proxy servers, firewalls, network address translators, multiplexers,
network interface controllers, wireless network interface controllers, ISDN terminal
adapters and other related
hardware.

The most common kind of networking hardware today is a copper-


based Ethernet adapter which is a standard inclusion on most modern computer
systems. Wireless networking has become increasingly popular, especially for portable
and handheld devices. Other networking hardware used in computers includes data center
equipment (such as file servers, database servers and storage areas), network
services (such as DNS, DHCP, email, etc.) as well as devices which assure content delivery.

Taking a wider view, mobile phones, PDAs and even modern coffee machines may
also be considered networking hardware. As technology advances and IP-based networks
are integrated into building infrastructure and household utilities, network hardware will
become an ambiguous term owing to the vastly increasing number of "network capable"
endpoints.

CSE, CITECH 2018-19 Page 28


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

Typical core network devices include:

Gateway: an interface providing a compatibility between networks by converting


transmission speeds, protocols, codes, or security measures.
Router: a networking device that forwards data packets between computer networks.
Routers perform the "traffic directing" functions on the Internet. A data packet is typically
forwarded from one router to another through the networks that constitute the internetwork
until it reaches its destination node.[3] It works on OSI layer 3.

Switch: a device that connects devices together on a computer network, by using packet
switching to receive, process and forward data to the destination device. Unlike less
advanced network hubs, a network switch forwards data only to one or multiple devices that
need to receive it, rather than broadcasting the same data out of each of its ports.[5] It works
on OSI layer 2.
Bridge: a device that connects multiple network segments. It works on OSI layers 1 and 2.
Repeater: an electronic device that receives a signal and retransmits it at a higher level or
higher power, or onto the other side of an obstruction, so that the signal can cover longer
distances.
Repeater hub: for connecting multiple Ethernet devices together and making them act as a
single network segment. It has multiple input/output (I/O) ports, in which a
signal introduced at the input of any port appears at the output of every port except the
original incoming.[1] A hub works at the physical layer (layer 1) of the OSI
model.[8] Repeater hubs also participate in collision detection, forwarding a jam signal to all
ports if it detects a collision. Hubs are now largely obsolete, having been replaced
by network switches except in very old installations or specialized applications.

Software basics and types


A computer uses software, colloquially known as programs and applications, to perform tasks.
The computer accesses its commands from the operating instructions in the software and then
performs the tasks specified in these instructions. Computer users can purchase a host
of software, including word processors, graphic editors, databases, games, and more. Software
has to be compatible with a computer operating system, such as Windows, Mac OS, and Linux.

CSE, CITECH 2018-19 Page 29


C Programming for Problem solving (18CPS13/23) Module 1: C Overview
Operating System: System software that is responsible for functioning of all hardware parts
and their interoperability to carry out tasks successfully is called operating system (OS). OS is
the first software to be loaded into computer memory when the computer is switched on and this
is called booting. OS manages a computer‘s basic functions like storing data in memory,
retrieving files from storage devices, scheduling tasks based on priority, etc.

Language Processor: An important function of system software is to convert all user


instructions into machine understandable language. When we talk of human machine
interactions, languages are of three types:
Machine-level language

Assembly-level language

High level language

System software that converts source code to object code is called language processor.
There are three types of language interpreters−

Assembler − Converts assembly level program into machine level program.

Interpreter − Converts high level programs into machine level program line by line.

Compiler − Converts high level programs into machine level programs at one go rather
than line by line.

Device Drivers: System software that controls and monitors functioning of a specific device on
computer is called device driver. Each device like printer, scanner, microphone, speaker, etc.
that needs to be attached externally to the system has a specific driver associated with it. When
you attach a new device, you need to install its driver so that the OS knows how it needs to be
managed.
Application Software
A software that performs a single task and nothing else is called application software.
Application software are very specialized in their function and approach to solving a problem.

CSE, CITECH 2018-19 Page 30


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

So a spreadsheet software can only do operations with numbers and nothing else. A hospital
management software will manage hospital activities and nothing else. Here are some commonly
used application software −

Word processing

Spreadsheet

Presentation

Database management

Multimedia tools

Utility Software
Application software that assist system software in doing their work is called utility software. Thus
utility software is actually a cross between system software and application software. Examples of
utility software include

Antivirus software

Disk management tools

File management tools

Compression tools

Backup tools

Summary :
✓ External devices are connected to computer through ports
✓ All ports are connected to motherboard
✓ There are different types of ports are
1. [Link]
2. [Link] port
3. [Link] port
4. [Link]
5. [Link]/2
6. [Link]
7. [Link]-45
CSE, CITECH 2018-19 Page 31
C Programming for Problem solving (18CPS13/23) Module 1: C Overview

Universal Serial Bus ( USB ) :


has replaced the serial and parallel ports in the motherboard. A USB port has four lines, two each for data
and power. Is used to connect a computer to devices such as cameras, printers, scanners and external hard
drives.

Serial Port :
a connector by which a device that sends data one bit at a time may be connected to a computer. Once used
by the keyboard, terminals and modems, they are offered in 9 and 25
pin configurations.

Parallel Port :
a connector for a device that sends or receives several bits of data simultaneously by using more than one
wire and uses 25 pins where data are transferred in parallel.

Video Graphics Array (VGA) Port :


connector is a three-row 15-pin DE-15 connector. The 15-pin VGA connector was provided on many video
cards, computer monitors, laptop computers, projectors, and high definition television sets.

CSE, CITECH 2018-19 Page 32


C Programming for Problem solving (18CPS13/23) Module 1: C Overview
RJ45 Port : registered jack 45, is the Ethernet style data port found on switches, routers and network
cards.

PS/2 Port : is a 6-pin connector used for connecting keyboards and mouse to a PC compatible computer
system.

High Definition Multimedia Interface (HDMI) : HDMI is a connector and cable capable of
transmitting high-quality and high-bandwidth streams of audio and video between devices.

Input devices
✓ Some of the input devices are
✓ [Link]
✓ [Link] Devices
✓ [Link] – 1. Flatbed
2. Handheld – Barcode
3. MICR (Magnetic Ink)

Keyboard
✓ Either physical or touchscreen.
✓ Has QWERTY layout and consists of letters , numerals and special symbols called Characters.
✓ Each characters has unique value called ASCII value.
✓ Eg: A = 65 , ! = 21
✓ Special keys like - Enter key, Backspace, Delete, Ctrl key, Function key [F1] .
✓ Connected - PS/2 or USB

CSE, CITECH 2018-19 Page 33


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

Pointing Design
✓ Mouse in desktop & touchpad in laptop.
✓ GUIs need a pointing device to control the movement of cursor
✓ Early mouse – rotating ball & 2 buttons.
✓ Right ,left click & scroll.
✓ Later - Optical mouse with infrared laser or LED to track movements.
✓ Now wireless mouse uses radio frequency technology.
✓ In laptop – rectangular space with 2 buttons.

Scanner
✓ Scanner-creates digital image of a doc by optically scanning it.
✓ Works with the special software that is shipped with the product.
✓ Connects to the USB port.
✓ Pictures are converted to JPEG files and documents to pdf files.
✓ Scanner can act in photocopier mode which directly print the document without saving it.
✓ Modern scanners have OCR(Optical Character Recognition) facility – image file converted to text
file and then can be edited.
✓ Handheld scanners – manually moved across the doc.
✓ MICR(Magnetic Ink Character Recognition) – used to read codes printed on bank cheques.

OutPut Device
✓ Output: information that can be seen or heard
✓ Output Devices
o Monitors: CRT and LCD
o Printers :
✓ Impact (Dot Matix Printer, Daisy Wheel Printer, Line Printer)
✓ Non Impact (Ink Jet Printer, Laser Printer)
o Plotters

CSE, CITECH 2018-19 Page 34


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

Monitor
✓ CRT( Cathode ray tube) Monitor
o Uses rarefied tube containing 3 electron guns(RGB) and screen coated with phosphorescent
material.
o The guns emit electrons to create images on the screen by selectively lighting up the
phosphors.
✓ Resolution 640 * 480 pixels which translates to an aspect ratio of 4:3.
✓ They are large and heavy, energy-inefficient and generate lot of heat.
✓ Note : Resolution is the number of pixels (individual points of color) contained on a
display monitor.
✓ The aspect ratio of a display device is the proportional relationship between the width and the
height of the display.

LCD Monitor
✓ It comprises thousands of liquid crystals, which may allow or block the passage of light through
them.
✓ An image is formed by selectively applying a voltage to these crystals and using a separate light
source for light to pass through them.
✓ The backlight is provided either
o by fluorescent light.
✓ Aspect ratio 16:9
✓ Consumes less power, generates less heat, takes less space and increased life span.
✓ Note : A fluorescent lamp or fluorescent
✓ tube is a low-pressure mercury-vapor
✓ gas-discharge lamp that uses fluorescence
✓ to produce visible light.

CSE, CITECH 2018-19 Page 35


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

Printers
✓ IMPACT – print head to strike (impact) a ribbon placed between the print head and paper
o Noisy, slow, low quality document compared to non - impact but still dot matrix printer is
used as it is cheaper.
✓ Non –I mpact – no strike (impact)
o Quiet, fast and produce high quality document but expensive.
Impact Printers
Dot-matrix printer
✓ print head has either 9 or 24 pins which are fired in multiple combinations to generate
letters, numerals and symbols.
✓ The ribbon is impregnated with ink, and when the pins fire against the ribbon, an
impression is created on the paper behind it.
✓ Speed – 300 cps (characters per second).
✓ A printer with 24pins offers the best print quality at 144 dpi(dots per inch),
✓ Due to gaps between the pins doesn’t produce quality output.

Daisy-wheel Printer
✓ It employs a wheel with separate characters distributed along its outer edge.
✓ Characters are pre formed and not generated
✓ The wheel is rotated so that the desired character directly faces the ribbon.
✓ We can print characters of different fonts.
✓ Can’t print graphics
✓ Obsolete

Line Printer
✓ It uses print chain containing the characters.
✓ The chain rotates continuously in front of the paper.
✓ Hammer strikes the paper in the normal
▪ manner, but speed is high 1200 lpm
CSE, CITECH 2018-19 Page 36
C Programming for Problem solving (18CPS13/23) Module 1: C Overview

▪ (lines per minute).


✓ Used to print low-quality reports.
▪ Can print unattended for long stretches of time
✓ It is extremely noisy.

Non impact Printer


✓ These printers are fast and produce documents of very high resolution.
✓ Two Types:
Laser printer
o It works like a photo copier
o A laser beam creates an image of the page to be printed on a light sensitive drum.
o The charged areas attract black magnetic powder (toner)
o The image created in the form of dots is transferred from drum to paper by actual contact.
o A roller heats up paper to melt toner which gets fused to paper.
o Colored laser printers use colored toner.
o Built in RAM to store documents- frees computer to do its work after submission for
printing.
o Print texts and graphics in high quality
o Resolution: varies from 300 dpi to 1200 dpi
o Speed: 20 pages per minute (ppm) typical bust fast one can operate at 200 ppm.

Ink Jet Printer


o A print head sprays tiny drops of ink at high pressure as it moves along the paper.
o The ink , stored in a replaceable cartridge, passes through a matrix comprising a number of
tiny nozzles.
o Color ink jet printers either have separate cartridges for each color or use a multi-
chambered cartridge.
o Resolution 300 dpi. Speed is low around 1 to 6 pages per minute.

CSE, CITECH 2018-19 Page 37


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

Plotter
✓ Plotters makes line drawings, unlike printers which print text and graphics
✓ It uses one or more automated pens
✓ Commands are taken from special files called vector graphic files
✓ Based on plotter type, either pen moves or paper moves
✓ Slow and expensive
✓ Suitable to create drawings of buildings and machines and can handle large size papers.
Computers in Network
✓ Interconnection of computer is called a computer network.
Different ways of connecting computers in network is called as network topology
Network Types :
✓ Local Area Network (LAN)
✓ Wide Area Network (WAN)
Technology advances have led to the birth of other types of
networks
o Metropolitan Area Network (MAN)
o Campus Area Network (CAN)
o Personal Area Network (PAN)
o Internet and intranet

Local Area Network


✓ Local Area Network is a group of computers connected to each other in a small area such as
building, office.
✓ LAN is used for connecting two or more personal computers through a communication medium
such as twisted pair, coaxial cable, etc.
✓ The data is transferred at an extremely faster rate in Local Area Network.
✓ Local Area Network provides higher security.

CSE, CITECH 2018-19 Page 38


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

Wide Area Network


✓ Wide Area Network is a network that extends over a large geographical area such as states or
countries.
✓ A Wide Area Network is quite bigger network than the LAN.
✓ A Wide Area Network is not limited to a single location, but it spans over a large geographical
area through a telephone line, fibre optic cable or satellite links.
✓ The internet is one of the biggest WAN in the world.
✓ A Wide Area Network is widely used in the field of Business, government, and education.

Metropolitan Area Network


✓ A metropolitan area network is a network that covers a larger geographic area by interconnecting a
different LAN to form a larger network.
✓ Government agencies use MAN to connect to the citizens and private industries.
✓ In MAN, various LANs are connected to each other through a telephone exchange line.
✓ It has a higher range than Local Area Network(LAN).

Personal Area Network


✓ Personal Area Network is a network arranged within an individual person, typically within a range
of 10 meters.
✓ Personal Area Network is used for connecting the computer devices of personal use is known as
Personal Area Network.

CSE, CITECH 2018-19 Page 39


C Programming for Problem solving (18CPS13/23) Module 1: C Overview
✓ Personal Area Network covers an area of 30 feet.
✓ Personal computer devices that are used to develop the personal area network are the laptop,
mobile phones, media player and play stations.

Campus Area Network


✓ A campus area network is larger than a local area network LAN since it may span multiple
buildings within a specific area.
✓ Most CANs are comprised of several LANs connected via switches and routers that combine to
create a single network.
✓ They operate similar to LANs, in that users with access to the network (wired or wireless) can
communicate directly with other systems within the network.

Internet and Internet ( intranet )


✓ internet : a global computer network providing a variety of information and communication
facilities, consisting of interconnected networks using standardized communication protocols.
✓ Internet ( intranet ) : An intranet is a private network accessible only to an organization's staff. Often,
a wide range of information and services are available on an organization's internal intranet that are

unavailable to the public, unlike the Internet.

CSE, CITECH 2018-19 Page 40


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

Network Hardware
Network Interface Card:
A network interface card (NIC) is a hardware component without which a computer cannot be
connected over a network.
It is a circuit board installed in a computer that provides a dedicated network connection to the
computer. It is also called network interface controller, network adapter or LAN adapter.

HUB and SWITCH:


A hub in the context of networking, is a hardware device that relays communication data. A hub
sends data packets to all devices on a network, regardless of any addresses contained in the data
packet.
A switch is different than a hub in that it keeps a record of all addresses of all connected devices.
Thus, it knows which device or system is connected to which port. When a data packet is received,
the switch immediately knows which port to send it to.

Bridge and Router


A bridge is a type of computer network device that provides interconnection with other bridge networks that
use the same protocol.

CSE, CITECH 2018-19 Page 41


C Programming for Problem solving (18CPS13/23) Module 1: C Overview
A router is a networking device that forwards data packets between computer networks. Routers perform
the traffic directing functions on the Internet. Data sent through the internet, such as a web page or email, is

in the form of data packets.

Software
Computer software also called software, is a set of instructions and its associated documentations that tells
a computer what to do or how to perform a task.
There are 3 types of Software :
System Software
Application Software
Utility Software
System software is a type of computer program that is designed to run a computer’s hardware
and application programs.
The operating system (OS) is the best-known example of system software. The OS manages all the other
programs in a computer.
Application software is a program or group of programs designed for end users. Application software is a
program or group of programs designed for end users.

System Software :
Basic Input Output System (BIOS)
This is a small program that checks the hardware devices and peripherals at boot time and then loads the
operating system.
Operating system
This is the central system software that manages both the hardware and the programs running on the
computer.
Device driver
Every hardware needs a special software that knows how to handle it. Programs access a device driver by
making a call to the operating system.

CSE, CITECH 2018-19 Page 42


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

Compilers and associated programs A programmer invokes a compiler program to convert the source
code written by them to machine code.

Application Software
Office software office software was one of its first applications. This category now comprises three
separate applications – word processing, spread sheet and presentations.

Database software This software package, commonly known as Data Base Management System (DBMS),
allows data having a uniform structure to be stored in a database. Microsoft Office has a DBMS
component (Access), but it is Oracle that dominates this space.

Communications software Computer networking led to the development of software that allowed users
to communicate with one another. Eg- Email , Skype and Whatsapp

Entertainment software Home entertainment on the PC has also seen the rise of software related to
gaming and multimedia.

Anti-virus software A virus is a small program designed by a person with malicious intent. Anti-virus
software is now an essential program to have on your computer.

Special-purpose software Apart from the general-purpose software mentioned previously, application
software are also available for desktop publishing, computer - aided design/manufacturing ( CAD / CAM )
and distance learning
Network Topology

There are a number of ways or topologies of connecting computers.


The bus topology uses a single cable as a bus to which all computers are connected. The failure of a single
node doesn't disrupt the communication between the nodes.

The star topology uses a central hub to which all nodes are connected. Because network traffic passes
through the hub, the entire network fails if the hub fails to work. On the other hand, new nodes can be
added without disrupting the service.

Nodes using the ring topology are connected in a closed loop without using a hub. Data moves from one
node to the next one which examines each packet to determine whether it should be allowed to move further
CSE, CITECH 2018-19 Page 43
C to
on Programming
the next node. for
For Problem solving
uni-directional (18CPS13/23)
rings, failure of one node causes Module 1: CtoOverview
the network shut down.

Nodes in a mesh topology are connected to one another, offering a choice of multiple routes for data to
travel. When a node breaks down, the packet simply changes its route. This is the most expensive of all the
topologies, and is found mainly in corporate networks.

CSE, CITECH 2018-19 Page 44


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

CSE, CITECH 2018-19 Page 45


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

CSE, CITECH 2018-19 Page 46


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

CSE, CITECH 2018-19 Page 47


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

CSE, CITECH 2018-19 Page 48


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

CSE, CITECH 2018-19 Page 49


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

CSE, CITECH 2018-19 Page 50


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

CSE, CITECH 2018-19 Page 51


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

CSE, CITECH 2018-19 Page 52


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

CSE, CITECH 2018-19 Page 53


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

CSE, CITECH 2018-19 Page 54


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

CSE, CITECH 2018-19 Page 55


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

// An example program to demonstrate working of enum in C


#include<stdio.h>

enum week{Mon, Tue, Wed, Thur, Fri, Sat, Sun};

int main()
{
enum week day;
day = Wed;
printf("%d",day);
return 0;
}
Output:
2
2. #include <stdio.h>
enum State {Working = 1, Failed = 0, Freezed = 0};
int main()
{
printf("%d, %d, %d", Working, Failed, Freezed);
return 0;
}
Output:
1, 0, 0
include <stdio.h>
enum day {sunday = 1, monday, tuesday = 5, wednesday, thursday = 10, friday,
turday};

int main()
{
printf("%d %d %d %d %d %d %d", sunday, monday, tuesday,
wednesday, thursday, friday, saturday);
CSE, CITECH 2018-19 Page 56
Creturn
Programming
0; for Problem solving (18CPS13/23) Module 1: C Overview
}
Output:
1 2 5 6 10 11 12

CSE, CITECH 2018-19 Page 57


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

CSE, CITECH 2018-19 Page 58


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

CSE, CITECH 2018-19 Page 59


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

CSE, CITECH 2018-19 Page 60


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

CSE, CITECH 2018-19 Page 61


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

CSE, CITECH 2018-19 Page 62


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

CSE, CITECH 2018-19 Page 63


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

CSE, CITECH 2018-19 Page 64


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

CSE, CITECH 2018-19 Page 65


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

CSE, CITECH 2018-19 Page 66


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

CSE, CITECH 2018-19 Page 67


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

CSE, CITECH 2018-19 Page 68


COutput
Programming for Problem
of the above program : solving (18CPS13/23) Module 1: C Overview

CSE, CITECH 2018-19 Page 69


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

CSE, CITECH 2018-19 Page 70


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

CSE, CITECH 2018-19 Page 71


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

CSE, CITECH 2018-19 Page 72


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

CSE, CITECH 2018-19 Page 73


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

CSE, CITECH 2018-19 Page 74


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

PRECEDENCE OF ARITHMETIC OPERATORS


An arithmetic expression without parenthesis will be evaluated from left to right using the rules of precedence of
operators. There are two distinct priority levels of arithmetic operators in C.
High priority * / %
Low priority + –
The basic evaluation procedure includes ‘two’ left-to-right passes through the expression. During the first
pass, the high priority operators (if any) are applied as they are encountered. During the second pass, the low
priority operators (if any) are applied as they are encountered. Consider the following evaluation statement that
has been used in the program of Fig. 3.4.
x=a–b/3+c*2–1
When a = 9, b = 12, c = 3, the statement becomes
x = 9 – 12 / 3 + 3 * 2 – 1
and is evaluated as follows
First pass
Step 1: x = 9 – 4 + 3 * 2 – 1
Step 2: x = 9 – 4 + 6 – 1
Second pass
Step 3: x = 5 + 6 – 1
Step 4: x = 11 – 1
Step 5: x = 10
These steps are illustrated in Fig. 3.5. The numbers inside parenthesis refer to step numbers.

CSE, CITECH 2018-19 Page 75


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

Fig. 3.5 illustration of hierarchy of operations


However, the order of evaluation can be changed by introducing parenthesis into an expression. Consider
the same expression with parenthesis as shown below:
9 – 12 / (3 + 3) * (2 – 1)
Whenever parentheses are used, the expressions within parentheses assume highest priority. If two or more sets of
parentheses appear one after another as shown above, the expression contained in the left-most set is evaluated
first and the right-most in the last. Given below are the new steps.
First pass
Step 1: 9 – 12 / 6 * (2 – 1)
Step 2: 9 – 12 / 6 * 1
Second pass
Step 3: 9 – 2 * 1
Step 4: 9 – 2
Third pass
Step 5: 7
This time, the procedure consists of three left-to-right passes. However, the number of evaluation steps
remains the same as 5 (i.e., equal to the number of arithmetic operators).
Parentheses may be nested, and in such cases, evaluation of the expression will proceed outward from the
innermost set of parentheses. For example:
9 – (12 / (3 + 3) * 2) – 1 = 4
Whereas
9 – ((12 / 3) + 3 * 2) – 1 = -2
While parentheses allow us to change the order of priority, we may also use them to improve the
understandability of the program.
Rules for Evaluation of Expression
• First, parenthesized sub expressions from left to right are evaluated.
• If parentheses are nested, the evaluation begins with the innermost sub-expression.
• The precedence rule is applied in determining the order of application of operators in evaluating sub-
expressions.
• The associativity rule is applied when two or more operators of the same precedence level appear in a sub-
expression.
• Arithmetic expressions are evaluated from left to right using the rules of precedence.
• When parentheses are used, the expressions within parentheses assume highest priority.

Program for the following expression: a=5<=8 && 6!=5


void main( )
{
CSE, CITECH 2018-19 Page 76
C Programming
int a;
for Problem solving (18CPS13/23) Module 1: C Overview
a= 5<=8 && 6!=5;
printf(“%d”,a);
}
OUTPUT:
1

12 SOME COMPUTATIONAL PROBLEMS


When expressions include real values, then it is important to take necessary precautions to guard against
certain computational errors. We know that the computer gives approximate values for real numbers and the errors
due to such approximations may lead to serious problems. For example, consider the following statements:
a = 1.0 / 3.0;
b = a * 3.0;
We know that (1.0 / 3.0) 3.0 is equal to 1. But there is no guarantee that the value of b computed in a
program will be equal to 1.
Another problem is division by zero. On most computers, any attempt to divide a number by zero will
result in abnormal termination of the program. In some cases such a division may produce meaningless results.
Care should be taken to test the denominator that is likely to assume zero value and avoid a division by zero.
The third problem is to avoid overflow or underflow errors. It is our responsibility to guarantee that the
operands are of the correct type and range , and the result may not produce any overflow or underflow.
PROGRAM 3.6: Output of the program in Fig. 3.7 shows round-off errors that can occur in computation of
floating point numbers.
main()
{
float sum, n, term ;
int count = 1 ;
sum = 0 ;
printf("Enter value of n\n") ;
scanf("%f", &n) ;
term = 1.0/n ;
while( count <= n )
{
sum = sum + term ;
count++ ;
}
printf("Sum = %f\n", sum) ;
}

1. Output
Enter value of n
99
Sum = 1.000001
Enter value of n
143
Sum = 0.999999
We know that the sum of n terms of 1/n is 1. However, due to errors in floating point representation the
result is not always 1.

CSE, CITECH 2018-19 Page 77


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

CSE, CITECH 2018-19 Page 78


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

CSE, CITECH 2018-19 Page 79


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

CSE, CITECH 2018-19 Page 80


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

CSE, CITECH 2018-19 Page 81


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

CSE, CITECH 2018-19 Page 82


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

CSE, CITECH 2018-19 Page 83


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

CSE, CITECH 2018-19 Page 84


C Programming for Problem solving (18CPS13/23) Module 1: C Overview

CSE, CITECH 2018-19 Page 85

You might also like