Module1IC
Module1IC
in
MODULE 1
1. What is a computer? Write the characteristics of computer.
A computer is defined as an electronic device that is designed to accept data, perform the
required mathematical and logical operations at high speed, and output the result.
The important characteristics of a computer are:
Speed: Computers can perform millions of operations
per second. The speed of computers is usually given in
nanoseconds and picoseconds.
Accuracy: A computer is a very fast, reliable, and robust
electronic device. It always gives accurate results, provided
the correct data and set of instructions are input to it.
Automation: Computers are automatable devices that
can perform a task without any user intervention.
The user just needs to assign the task to the computer, after which it automatically
controls different devices and executes the program instructions.
Diligence: Unlike humans, computers never get tired of a repetitive task. It can continually
work for hours without creating errors.
Versatile: Computers are versatile devices as they can perform multiple tasks of different
nature at the same time. Computers are used in our daily life in different fields.
Memory: Computers have memory. They have internal or primary memory (storage space)
as well as external or secondary memory. The internal memory of computers is very
expensive and limited in size (Example: RAM, ROM), and the secondary storage is cheaper
and of bigger capacity (Example: Hard disk).
No IQ: Computers do not have any decision-making abilities of their own. They need
guidance to perform various tasks.
Economical: Computers are considered as short-term investments for achieving long-term
gains. Computers save time, energy, and money.
2. Briefly explain evolution of computer through different generations.
First Generation (1942–1955)
Hardware Technology: First generation computers were manufactured using thousands
of vacuum tubes; a vacuum tube is a device made of fragile glass.
Memory: Electromagnetic relay was used as primary memory and punched cards were
used to store data and instructions.
Software Technology: Programming was done in machine or assembly language.
Used for: Scientific applications.
Examples: ENIAC, EDVAC, EDSAC, UNIVAC I, IBM 701.
Second Generation (1955–1964)
Hardware Technology: This generation computers were manufactured using transistors.
Transistors were reliable, powerful, cheaper, smaller, & cooler than vacuum tubes.
Memory: Magnetic core memory was used as primary memory; magnetic tapes and
magnetic disks were used to store data and instructions.
Software Technology: Programming was done in high level programming languages.
Batch operating system was used.
Used for: Scientific and commercial applications.
Examples: Honeywell 400, IBM 7030, CDC 1604, UNIVAC LARC.
Third Generation (1964–1975)
Hardware Technology: Third generation computers were manufactured using integrated
chips (ICs) with SSI (Small Scale Integration) & MSI (Medium Scale Integration) technology.
ICs consist of several components like transistors, capacitors, & resistors on a single chip
to avoid wired interconnections between components. Minicomputers came into existence.
Memory: Larger magnetic core memory was used as primary memory; larger capacity
magnetic tapes and magnetic disks were used to store data and instructions.
Software Technology: Programming was done in high level programming languages such
as FORTRAN, COBOL, Pascal, and BASIC. Software was separated from the hardware.
Used for: Scientific, commercial, and interactive online applications.
Examples: IBM 360/370, PDP-8, PADP-11, CDC6600.
Fourth Generation (1975–1989)
Hardware Technology: Fourth generation computers were manufactured using ICs with
LSI (Large Scale Integration) and later with VLSI (Very Large Scale Integration) technology.
Microcomputers came into existence. Use of personal computers became widespread. High
speed computer networks in the form of LANs, WANs, and MANs started growing.
Memory: Semiconductor memory was used as primary memory, large capacity magnetic
disks were used as built-in secondary memory. Magnetic tapes and floppy disks were used
as portable storage devices.
Software Technology: Programming was done in high level programming language such
as C and C++. Graphical User Interface (GUI) based operating system (e.g. Windows) was
introduced. UNIX, Apple Mac OS and MS DOS were introduced. All these operating systems
had multi-processing and multiprogramming capabilities.
Used for: Scientific, commercial, interactive online, and network applications.
Examples: IBM PC, Apple II, TRS-80, VAX 9000, CRAY-1, CRAY-2, CRAY-X/MP.
Fifth Generation (1989–Present)
Hardware Technology: Fifth generation computers are manufactured using ICs with ULSI
(Ultra Large Scale Integrated) technology. The use of Internet became widespread and very
powerful mainframes, desktops, portable laptops, and smartphones are being used
commonly. Supercomputers use parallel processing techniques.
Memory: Semiconductor memory is used as primary memory; large capacity magnetic
disks are used as built-in secondary memory. Magnetic tapes and floppy disks were used
as portable storage devices, which have now been replaced by optical disks and USB drives.
Software Technology: Programming is done in high-level programming languages such as
Java, Python, and C#. Graphical User Interface (GUI)-based operating systems such as
Windows, UNIX, Linux, Ubuntu, and Apple Mac are being used. These operating systems
are more powerful and user friendly than the ones available in the previous generations.
Used for: Scientific, commercial, interactive online, multimedia (graphics, audio, and
video), and network applications
Examples: IBM notebooks, Pentium PCs, IBM SP/2, Param supercomputer
3. How computers are classified? Briefly explain.
Supercomputers
Supercomputer is the fastest, most powerful, and most expensive computer.
First developed in the 1980s to process large amounts of data and to solve complex
scientific problems.
Mainly used for weather forecasting, nuclear energy research, aircraft design,
automotive design, online banking, controlling industrial units, etc.
Examples are CRAY-1, CRAY-2, Control Data CYBER 205, and ETA A-10.
Mainframe Computers
Mainframe computers are large-scale computers (but smaller than supercomputers).
Very expensive and need a very large clean room with air conditioning.
Support multiple processors. For example, the IBM S/390 mainframe can support
50,000 users at the same time.
The two types of terminals that can be used with mainframe systems are as follows:
Dumb Terminals
Dumb terminals consist of only a monitor and a keyboard (or mouse). They do not have
their own CPU and memory and use the mainframe system’s CPU and storage devices.
Intelligent Terminals
Intelligent terminals have their own processor and thus can perform some processing
operations. But, they do not have their own storage space.
They are typically used as servers on the World Wide Web.
The smallest computer of their times and are also known as midrange computers.
Widely used in business, education, hospitals, government organizations, etc.
Single-user minicomputers are used for performing complex design tasks.
The first microcomputer was designed by IBM and was named IBM-PC. Another type of
popular PC is designed by Apple.
PCs and PC-compatible computers commonly use the Windows operating system, while
Apple computers use the Macintosh operating system (MacOS).
PCs can be classified into the following categories:
Desktop PCs: A desktop PC is the most popular model of PCs. The system unit of the
desktop PC can be placed flat on a desk or table. It is widely used in homes and offices.
Laptops: Laptops are small microcomputers that can easily fit inside a briefcase and can
easily be carried from one place to another and are useful especially when going on long
journeys.
Workstations: Workstations are single-user computers that have the same features as
PCs, but their processing speed matches that of a minicomputer or mainframe computer.
Network Computers: They have less processing power, memory, and storage than a
desktop computer and are designed to be used as terminals in a networked environment.
Handheld Computers: They can fit in one hand, while users can use the other hand to
operate them. Very small in size, and hence they have small-sized screens and keyboards
Examples: Smartphones, Tablet PCs.
4. Discuss few applications of computer.
Some applications of computers are:
Word processing: Word processing software enables users to read and write documents.
Users can also add images, tables, and graphs for illustrating a concept.
Internet: The Internet is a network of networks that connects computers all over the world.
It gives the user access to an enormous amount of information. Browsing, e-mail, chatting,
video conferencing etc. are few applications using internet.
Digital video or audio composition: Computers make audio or video composition and
editing very simple. Graphics engineers use computers for developing short or full-length
films and creating 3-D models and special effects in science fiction and action movies.
Desktop publishing: Desktop publishing software enables us to create page layouts for
entire books.
e-Business: e-Business or electronic business is the process of conducting business via the
Internet. This may include buying and selling of goods and services using computers and
the Internet. The following are techniques in which e-commerce helps users to conduct
business transactions: Business-to-consumer or B2C, Business-to-business or B2B,
Consumer-to-consumer or C2C.
Electronic banking: Electronic banking, also known as cyber banking or online banking,
supports various banking activities on the go.
Health care: Computers have become a necessary device in the health care industry. The
following are areas in which computers are extensively used in the health care industry:
Storing records, Surgical procedures, Better diagnosis and treatment.
Meteorology: Meteorology is the study of the atmosphere. Some of the applications include
the following: Weather forecasting, Aviation meteorology, Agricultural meteorology, Nuclear
meteorology, Maritime meteorology.
Multi-media and Animation: Multimedia and animation that combines still images,
moving images, text, and sound in meaningful ways is one of most powerful aspects of
computer technology. Multimedia and animation is used to add special effects in movies. In
education, multimedia is used to prepare training courses.
Legal System: Computers are used by lawyers to shorten the time required to conduct
legal precedent and case research.
Retail Business: Computers are used in retail shops to enter orders, calculate costs, and
print receipts.
Travel and Tourism: Computers are used to prepare tickets, monitor the train’s or
airplane’s route, and guide the plane to a safe landing. They are also used to research
about hotels in an area, reserve rooms, or to rent a car.
Robotics: Robots are computer-controlled machines mainly used in the manufacturing
process in extreme conditions where humans cannot work.
Education: A computer is a powerful teaching aid and can act as another teacher in the
classroom. Teachers use computers to develop instructional material.
Industry and Engineering: Computers are found in all kinds of industries, such as
thermal power plants, oil refineries, and chemical industries, for process control, CAD.
MOHAMMED SALEEM | Asst. Prof., Dept. of E & C, PACE 6
[INTRODUCTION TO C PROGRAMMING - BESCK104E] [email protected]
5. Explain the organization of a computer with the help of a neat block diagram.
A computer is an electronic device that performs five major operations:
• Accepting data or instructions (input)
• Storing data
• Processing data
• Displaying results (output)
• Controlling and coordinating all operations inside a Computer.
Figure below shows the interaction between the different units of a computer system.
Input: This is the process of entering data and instructions (also known as programs) into
the computer system. The data and instructions can be entered by using different input
devices such as keyboard, mouse, scanner, and trackball.
Storage: The computer storage space not only stores the data and programs that operate
on that data but also stores the intermediate results and the final results of processing. A
computer has two types of storage areas:
Primary storage: Also known as the main memory, is the storage area that is directly
accessible by the CPU at very high speeds. It is used to store the data and parts of
programs, the intermediate results of processing, and the recently generated results.
Example: Random Access Memory (RAM).
Secondary storage Also known as auxiliary memory, is cheaper, non-volatile, and used
to permanently store data and programs that are not being currently executed by CPU.
Example: Magnetic disk used to store data, such as C and D drives, for future use.
Output: Output is the process of giving the result of data processing to the outside world
(external to the computer system). The results are given through output devices such as
monitor, and printer.
MOHAMMED SALEEM | Asst. Prof., Dept. of E & C, PACE 7
[INTRODUCTION TO C PROGRAMMING - BESCK104E] [email protected]
Control: The control unit (CU) manages and controls all the components of the computer
system. The CPU is a combination of the arithmetic logic unit (ALU) and the CU. The CPU is
known as the brain of the computer system.
Processing: The process of performing operations on the data as per the instructions
specified by the user (program) is called processing. Data and instructions are taken from
the primary memory and transferred to the ALU, which performs all sorts of calculations.
The intermediate results of processing may be stored in the main memory. When the
processing completes, the final result is then transferred to the main memory.
6. List and explain the functions of major parts of computer.
Keyboard: The keyboard is the main input device for computers. Using a keyboard, the
user can type a document, use keystroke shortcuts, access menus, play games, and
perform numerous other tasks.
Pointing Devices: A pointing input device enables the users to easily control the movement
of pointer to select items on a display, to draw graphics, etc. Examples: Mouse, trackball,
light pen, joystick, and touchpad.
Mouse: It is the key input device used in a graphical user interface (GUT). It can be used to
handle the pointer easily on the screen to perform various functions such as opening a
program or file.
Handheld Devices: A handheld device is a pocket-sized computing device with a display
screen and touch input and/or a miniature keyboard. Examples: Smartphones, PDAs,
handheld game consoles, and portable media players.
Optical Devices: Optical devices, use light as a source of input for detecting or recognizing
different objects such as characters, marks, codes, and images. These devices convert these
objects into digital data and send it to the computer for further processing. Examples are
barcode readers, image scanners, optical character recognition (OCR), optical mark readers
(OMR), and magnetic ink character recognition (MICR) devices.
Audio-visual Input Devices:
Audio Devices: Audio devices are used to either capture or create sound. They enable
computers to accept music, speech, or sound effects for recording and/or editing.
Microphones and CD players are examples of two widely used audio input devices.
Video Input Devices: Video input devices are used to capture video from the outside world
into the computer. The video card converts analog video signals to digital data to store it in
the computer (and vice versa). Digital camera and web camera are popular examples of
video input devices.
8. Explain the different types of output devices.
Any device that outputs/gives information from a computer can be called an output device.
Output devices are electromechanical devices that accept digital data from the computer
and convert them into human-understandable language.
Monitors and speakers are two widely used output devices. Figure below categorizes
output devices into different groups.
Three variants of monitor: cathode ray tube (CRT), liquid crystal display (LCD), & plasma.
Projectors: A projector is a device that takes an image from a video source and projects it
onto a screen or another surface. The projector works by receiving a video signal from some
external device and projects that signal onto a screen.
Speakers: To meet the user’s demand of audio capabilities from the computers, speakers
were developed in different sizes and shapes, and with different powers and sound quality.
With all these types of speakers, the user can enjoy music, movie, or a game, and the voice
will be spread through the entire room.
Hard Copy Devices
Hard copy output devices are those that produce a physical form of output.
Printers: A printer is a device that takes the text and graphics information obtained from a
computer and prints it on a paper.
Printers can be broadly classified into two groups:
Impact Printer: These printers print characters by striking an inked ribbon against the
paper. Examples-dot matrix printers, daisy wheel printer.
Non-impact printer: Non-impact printers are much quieter than impact printers. Non-
impact printers use cartridge-based ink, which is either sprayed onto the page. The main
types of non-impact printers are inkjet, laser, and thermal printers.
Plotters: A plotter is a printing device that is usually used to print vector graphics with
high print quality. They are widely used to draw maps, in scientific applications, and
computer-aided engineering (CAE).
Drum plotters: A drum plotter is used to draw graphics on paper that is wrapped around
a drum. They are usually used with mainframe and minicomputer systems.
Flatbed plotter: In a flatbed plotter, the paper is spread on the flat rectangular surface of
the plotter, and the pen is moved over it.
9. With the neat diagram, explain the working of CRT monitor and LCD monitor.
Working of a CRT monitor: CRT monitors work by firing charged electrons at a
phosphorus film. When electrons hit the phosphor-coated screen, they glow, thereby
enabling the user to see the output.
In a CRT, the stream of electrons comes out of the heated filament cathode into the
vacuum. The anode attracts the electrons and focuses the stream of electrons to form a
tight beam that is then accelerated by an accelerating anode. This tight, high-speed beam
of electrons flies through the vacuum in the tube and hits the flat screen at the other end of
the tube. This screen is coated with phosphor, which glows when struck by the beam,
thereby displaying a picture, which the user sees on the monitor.
Working of a LCD Monitor: An LCD monitor is a thin, flat, electronic visual display that
uses the light modulating properties of liquid crystals, which do not emit light directly.
LCD technology is based on the principle of blocking light. The LCD consists of two pieces
of polarizing filters that contain a liquid crystal material between them. A backlight creates
light, which is made to pass through the first substrate. Simultaneously, the electrical
currents cause the liquid crystal molecules to align, thus allowing varying levels of light to
pass through to the second substrate and create the colors, and hence images are seen on
the screen.
10. How printers are classified? Briefly explain.
Printers: A printer is a device that takes the text and graphics information obtained from a
computer and prints it on a paper. Printers can be broadly classified into two groups-
impact and non-impact printers as show.
Impact Printer: These printers print characters by striking an inked ribbon against the
paper. Examples-dot matrix printers, daisy wheel printers, and most types of line printers.
Dot matrix printer: A dot matrix printer prints characters and images of all types as a
pattern of dots. This printer has a print-head (or hammer) that consists of pins
representing the character or image. The print-head runs back and forth on the page and
prints by striking an ink-soaked cloth ribbon against the paper.
Daisy wheel printer: Daisy wheel printers use an impact printing to generate high quality
output comparable to typewriters, and are three times faster. The print-head of a daisy
wheel printer is a circular wheel, with arms or spokes.
Line printer: A line printer is a high-speed impact printer in which one typed line is
printed at a time. The speed of a line printer usually varies from 600 to 1200 lines per
minute. Band printer is a commonly used variant of line printers.
Non-impact printer: Non-impact printers are much quieter than impact printers. Non-
impact printers use cartridge-based ink, which is either sprayed onto the page. The main
types of non-impact printers are inkjet, laser, and thermal printers.
Inkjet printer: The print-head of inkjet printers has several tiny nozzles, called jets. As the
paper moves past the print-head, the nozzles spray ink onto it, forming characters and
images. An inkjet printer can produce from 100 to several hundred pages.
Laser printer: A laser printer is a non-impact printer that works at very high speeds and
produces high-quality text and graphics. It uses the technology used in photocopier
machines.
11. Explain different phases in software development life cycle (SDL).
To design and development of programs, the entire program or software development
process is divided into a number of phases, where each phase performs a well- defined
task. The phases in the software development life cycle (SDLC) process is shown in figure.
Requirements analysis: In this phase, the user's expectations are gathered to know why
the program/software has to be built. Then, all the gathered requirements are analysed to
arrive at the objective of the overall software product. The every identified requirement of
the users is documented.
Design: In the design phase, a plan of actions are made and this plans will be followed
throughout the development process. The core structure of the software/program is broken
down into modules. The solution of the program is then specified for each module in the
form of algorithms or flowcharts. The design phase, therefore, specifies how
program/software will be built.
MOHAMMED SALEEM | Asst. Prof., Dept. of E & C, PACE 13
[INTRODUCTION TO C PROGRAMMING - BESCK104E] [email protected]
in below table.
14. What are the different types of errors encountered in programming? Explain.
The errors are broadly classified under four groups as shown in Figure.
Run-time Errors: The run-time errors occur when the program is being run executed.
Such errors occur when the program performs some illegal operations like:
dividing a number by zero
opening a file that already exists
Semantic Errors: Errors which may comply with rules of the programming language but
are not meaningful to the compiler.
Logical Errors: Logical errors are errors in the program code that result in unexpected and
undesirable output. Such errors are not detected by the compiler, and programmers must
check their code line by line or use a debugger to locate and rectify the errors. Logical
errors occur due to incorrect statements.
Linker Errors: These errors occur when the linker is not able to find the function definition
for a given prototype.
15. Explain characteristics of C. Mention uses of C.
Basic characteristics of C language are:
C is a high-level programming language: The programmer needs to concentrate on the
problem and not worry about the machine code on which the program would run.
Small size: C has only 32 keywords. This makes it relatively easy to learn.
Stable language.
Quick language as a well written C program is likely to be as quick as or quicker than a
program written in any other language.
Core language. Many programming languages (like C++, Java, Perl, etc.) are based on C.
C is a portable language, i.e., a C program written for one computer can be run on
another computer with little or no modification.
C is often treated as the second best language for any given programming task. While
the best language depends on the particular task to be performed, the second best
language, on the other hand, will always be C.
Supports pointers to refer computer memory, arrays, structures, and functions.
C is an extensible language: Enables the user to add his own functions to the C library.
The uses of C language can be summarized as follows:
C language is primarily used for system programming.
function. The data declared within a function are known as local declaration as that data
will be visible only within that function.
The statement in a function contains the code that
manipulates the data to perform a specified task.
C program can have any number of functions
depending on the tasks that have to be performed
and each function can have any number of
statements arranged according to a specific sequence.
Example: C program to print a message.
#include<stdio.h>
int main( )
{
printf(“ Welcome to C”);
return 0;
}
17. Explain different input output statements in C with appropriate syntax &
examples.
C language supports two formatting input / output functions: printf and scanf.
printf( ): The printf function (print formatting) is used to display information required by
the user and also prints the values of the variables. For this, the printf function takes data
values, converts them to a text stream using formatting specifications in the control string
and passes the resulting text stream the standard output.
The syntax of printf function can be given as:
printf ("control string", variable list);
The function accepts two parameters: control string and variable list.
The control string may contain zero or more conversion specifications, textual data, and
control characters to be displayed. The control string may also contain the text to be
printed like instructions to the user, captions, identifiers, or any other text to make the
output readable. The control characters can also be included in the printf statement. These
control characters include \n, \t, \r, \a, etc.
After the control string, the function can have as many additional arguments as specified in
the control string.
The floating point is of 4 bytes and is used to store decimal and exponential values. It
is used to store decimal numbers (numbers with floating point) with single precision.
The double is of 8 bytes and is used to store decimal numbers (numbers with floating
point) with double precision.
The void type holds no value. It is primarily used in three cases:
To specify the return type of a function
To specify the parameters of the function
To create generic pointers.
In addition, C also supports four modifiers-two sign specifiers (signed and unsigned)
and two size specifiers (short and long).
19. What are the different files used in C program? Explain.
Every C program has four files associated with it as shown below.
Source Code Files: The source code file contains the source code of the program. The file
extension of any C source code file is ‘.c’. This file contains C source code that defines the
main function and maybe other functions. A C program in general may include even other
source code files (with the file extension.c).
MOHAMMED SALEEM | Asst. Prof., Dept. of E & C, PACE 21
[INTRODUCTION TO C PROGRAMMING - BESCK104E] [email protected]
Header Files: A header file is a file with extension ‘.h’ that contains function declarations
and macro definitions to be shared between several source files. A header file can be used
in the program by including with C pre-processor directive ‘#include’. Some examples of
using standard header files are:
#include<stdio.h> : for standardised input and output functions
#include<string.h> : for string handling functions
#include<math.h> : for mathematical functions
#include<conio.h> : for clearing the screen
#include<stdlib.h> : for some miscellaneous functions
Object Files: Object files are generated by the compiler as a result of processing the source
code file. Object files contain compact binary code of the function definitions. Linker uses
these object files to produce an executable file (.exe file) by combining the object files
together. Object files have a ‘.o' extension.
Binary Executable Files: The binary executable file is generated by the linker. The linker
links the various object files to produce a binary file that can be directly executed. On
Windows operating system, the executable files have a ‘.exe’ extension.
20. Define keyword. List few keywords used in C.
C has a set of reserved words often known as keywords that cannot be used as an
identifier. All keywords are basically a sequence of characters that have a fixed meaning. All
keywords must be written in lowercase (small) letters. Table below shows the list of
keywords in C.
21. Define identifiers. What are the rules for forming identifier names?
Identifiers, help us to identify data and other objects in the program. Identifiers are
basically the names given to program elements such as variables, arrays, and functions.
Identifiers may consist of sequence of letters, numerals, or underscores.
MOHAMMED SALEEM | Asst. Prof., Dept. of E & C, PACE 22
[INTRODUCTION TO C PROGRAMMING - BESCK104E] [email protected]
Identifiers can be of any reasonable length. They should not contain more than 31
characters.
Examples of valid identifiers include:
roll_number, marks, name, emp_number, basic_pay, HRA, DA, dept_code, EMP_NO
Examples of invalid identifiers include:
23_student, $_name, %marks, (DA), auto