Beruflich Dokumente
Kultur Dokumente
PART-B(16MARKS)
1. Define computer. Explain the characteristics briefly? (MAY 2009\FEB 2009)
Computer is an electronic device which is used to store the data, as per given
instructions it gives results quickly and accurately.
Characteristics of Computer
The characteristics of computers that have made them so powerful and universally useful are
speed, accuracy, diligence, versatility and storage capacity. Let us discuss them briefly.
Speed
Computers work at an incredible speed. A powerful computer is capable of performing about 3-4
million simple instructions per second.
Accuracy
In addition to being fast, computers are also accurate. Errors that may occur can almost always
be attributed to human error (inaccurate data, poorly designed system or faulty
instruction/programs written by the programmer)
Diligence
Unlike human beings, computers are highly consistent. They do not suffer from human traits of
boredom and tiredness resulting in lack of concentration. Computers, therefore, are better than
human beings in performing voluminous and repetitive jobs.
Versatility
Computers are versatile MAChines and are capable of performing any task as long as it can be
broken down into a series of logical steps. The presence of computers can be seen in almost
every sphere Railway/Air reservation, Banks, Hotels, Weather forecasting and many more.
Storage Capacity
Todays computers can store large volumes of data. A piece of information once recorded (or
stored) in the computer, can never be forgotten and can be retrieved almost instantaneously.
2. Explain briefly the developments in computer technology starting from a simple
Calculating MAChine to the first computer
Calculating MAChine:
A computer is a MAChine that works with data and information in the form of numbers.
People from the beginning of time, and throughout the years, have invented and continue to
invent things that help them count. Caveman counted with the only counting tools they knew,
their fingers and toes. These were considered the first counting tools. Soon man realized that
other objects needed to be used to keep up with larger numbers. Some of the other counting tools
that have been used throughout time have been stones, knots on ropes (quipu), and notches on
sticks, notches on bones, tally sticks, to name just a few. People used these counting tools to
count their possessions and also to keep tract of the passing of time.
Napier bones:
The oldest known objects used to represent numbers are bones with notches carved into
them. These bones, which were discovered in western Europe, date from the Aurignacian period
20,000 to 30,000 years ago and correspond to the first appearance of Cro-Magno man.Counting
boards and counting tablets were also used to represent everyday calculations such as goods
bought and sold.
Slide Rules:
The slide rule is used primarily for multiplication and division, and also for functions
such as roots, logarithms and trigonometry, but is not normally used for addition or subtraction.
Though similar in name and appearance to a standard ruler, the slide rule is not ordinarily used
for measuring length or drawing straight lines. Slide rules exist in a diverse range of styles and
generally appear in a linear or circular form with a standardized set of markings (scales) essential
to performing mathematical computations.
Pascals Addition and subtracting MAChine:
The Pascaline is known as the first mechanical and automatic calculator. Pascal invented
the Pascaline to help make his father's job as a tax accountant easier. The MAChine is sometimes
called the La Pascaline or Pascal's MAChine. The Pascaline never became popular. First of all,
the MAChine broke often and its inventor was the only person who could fix it. Second, it was
slow. Third, clerks would not use it: They were afraid it might replace them at their jobs. The
Pascaline was a wooden box that could only add and subtract by means of a series of gears and
wheels. When each wheel rotated one revolution, it would then turn the neighboring wheel. On
top of the wheels were a series of windows through which the totals could be read. About 50
models were constructed and were made of wood, ivory, ebony, and copper.
Leibnizs Multiplication and division MAChine:
In 1673, German inventor Gottfried Leibniz perfected the Leibniz Calculator. Leibniz entered a
university at fifteen years of age and received his bachelor's degree at seventeen. This MAChine
is sometimes called The Stepped Reckoner. The Liebniz was also a calculating MAChine, but
much superior to that of the Pascaline. It could do more than just add and subtract. The Leibniz
Calculator could also multiply, divide, and find square roots of numbers. It too was mechanical
and worked by hand. A crank was added to speed up the work of this calculator. It was used by
mathematicians and bookkeepers.Mr. Leibniz believed that it did not make sense for men to
spend hours and hours doing mathematical calculations when he could invent a MAChine that
would work much faster. Would you rather add a long list of numbers with a pencil and paper or
use a calculator.
Charles Babbage & his Engines:
In the early 1820s, an English mathematician by the name Charles Babbage, designed a
computing MAChine called the Difference Engine. This MAChine was to be used in the
calculating and printing of simple math tables. In the 1830s, he designed a second computing
MAChine called the Analytical Engine. This MAChine was to be used in calculating complicated
problems by following a set of instructions.
Analytical Engine:
The Analytical Engine was a mechanical computer that can solve any mathematical
problem. It uses punch-cards similar to those used by the Jacquard loom and can perform simple
conditional operations.
Difference Engine:
However, neither of these MAChines were ever finished because the
technology at the time was not advanced enough, and both of his projects
lacked financial funding. The computing MAChines made in the 1900s, and
even those today are based on the designs of the Difference Engine and the
Analytical Engine. This is why Charles Babbage is known as the "Father of
Computers."
Herman Hollerith & his Tabulating MAChine
An American inventor by the name of Herman Hollerith wanted to speed up the work
involved in taking the government census. In 1890, 50 years after Charles Babbage's death,
Hollerith invented a MAChine called the tabulating MAChine, using notes that were left by
Babbage. Prior to this invention it took nearly eight years to count everyone in the United States
and add up all the information about where people lived, their ages, and what their jobs were.
The Tabulating MAChine used punched cards to record and sort data or information. Each hole
punched meant something. If a hole had been punched, a pin would pass through it to make an
electrical contact with mercury in a cup below. This turned motors that moved numbers that
counted. Approximately 65 cards could be passed through this computer in a minute, and in 1890
it took only 2.5 years to complete the U.S. Census.
2. Explain in detail the different generation of computers.
Computers are such an integral part of our everyday life now most people take them
and what they have added to life totally for granted. 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.
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.
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 werent 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.
These 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.
1964 1971: Third Generation Integrated Circuits
By this phase, transistors were now being miniaturized 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.
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.
Microprocessors even moved beyond the realm of computers and into an increasing number of
everyday products.
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.
Super computer
Super computer is the fastest, most expensive, big in size, and most powerful computer that can
perform multiple tasks within no second. It has multi-user, multiprocessing, very
highefficiency and large amount of storage capacity. It is called super computer because it can
solve difficult and complex problem within a nano second.
Application
o
o
o
o
o
o
Example
c-DAC (center for development of advanced computer) of INDIA has developed PARAM series
of super computer. Anurag is also indian super computer. Other super computers are cray
xmp/14, CDC-205 etc. Mr. Seymour cray was a pioneer person in the field of supercomputer
production. He had developed the first super computer cray-1 in 1976.
Mainframe computer
Mainframe computer is the large sized computer that covers about 1000 sq feet. It is
general purpose computer that is designed to process large amount of data with very high speed.
It accepts large amount of data from different terminals and multiple users and process them at
same time. More than 100 users are allowed to work in this system. It is applicable for large
organization with multi-users for example: large business organization, department of
examinations, industries and defense to process data of complex nature. It uses several cpu for
data processing.
Application areas
o
o
o
o
o
o
o
Example
IBM s/390, IBM s/709, ICL 39, CDC 6600
Minicomputer
Mini computers are medium sized computer. So, these are popular as middle ranged
computer. It is also multiple user computer and supports more than dozen of people at a time. It
is costlier than microcomputer.
It is also used in university, middle range business organizations to process complex data. It is
also used in scientific research, instrumentation system, engineering analysis, and industrial
process monitoring and control etc.
Example
languages, multimedia, graphics, 3d graphics and games. These are popular among students,
professionals and home users due to small size, low price and low maintenance.
PDP-11, vax etc.
Microcomputer
Most popular general purpose computers which are mostly used on day to day work are
microcomputers. These are popular as home pc or personal computer (pc) because these are
single user computers and mostly used for personal use and application. These support many
higher level application cost and easy in operation.
Example
IBM PCs, apple MAC, IBM ps/2, all computer available with pentium models etc.
The input unit that moves data from the outside world into the computer.
The output unit that moves results from inside the computer to the outside world.
The control unit that acts as the stage unit to ensure that all the other components act in
concert.
Memory
Memory is a collection of cells, each with a unique physical address. We use the generic
word cell here rather than byte, because the number of bits in each addressable location, called
the memory's addressability, varies from one machine to another. Today, most computers are
byte addressable.
To fully illustrate the concept of memory, take a computer with 4GB of RAM as an
example. The memory consists of 4 230 bytes, which means each byte of the computer is
uniquely addressable, and the addressability of the machine is 8 bits. The cells in memory are
numbered consecutively beginning with 0. For example, if the addressability is 8, and there are
256 cells of memory, the cells would be addressed as follows:
The Arithmetic/Logic Unit (ALU) is capable of performing basic arithmetic operations
such as adding, subtracting, multiplying, and dividing two numbers. This unit is also capable of
performing logical operations such as AND , OR , and NOT . The ALU operates on words, a
natural unit of data associated with a particular computer design. Historically, the word length of
a computer has been the number of bits processed at once by the ALU. However, the current
Intel line of processors has blurred this definition by defining the word length to be 16 bits. The
processor can work on words (of 16 bits), double words (32 bits), and quadwords (64 bits). In the
rest of this wiki, when referring to word, it will be of the historical nature aforementioned.
Most modern ALUs have a small number of special storage units called Registers. These
registers contain one word and are used to store information that is needed again immediately.
For example in the calculation of 1 (2 + 3). 2 is first added to 3 and the result is multiplied by
1. Rather than storing the result of adding 2 and 3 in memory and then retrieving it to multiply it
by 1, the result is left in a register and the contents of the register is multiplied by 1. Access to
registers is much faster than access to memory locations.
Input/Output Units
All of the computing power in the world would not be useful if one could not input values into
the calculations from the outside or report to the outside the results of said calculations. Input
and output units are the channels through which the computer communicates with the outside
world.
An Input Unit is a device through which data and programs from the outside world are entered
into the computer. The first input units interpreted holes punched on paper tape or cards.
Modern-day input devices, however, include, but are not limited to; keyboards, mice, cameras
(also known as, simply, webcams), and scanning devices.
An Output Unit is a device through which results stored in the computer memory are made
available to the outside world. Examples include printers and screen monitors.
Control Unit
The Control Unit is the organising force in the computer, for it is in charge of the Fetch-Execute
Cycle. There are two special registers in the control unit. The Instruction Register (IR) contains
the instruction that is being executed, and the Program Counter (PR) contains the address of the
next instruction to be executed. Because the ALU and the control unit work so closely together
they are often thought of as one unit called the Central Processing Unit (CPU).
Above is a simplified view of the flow of information through the parts of a von Neumann
machine. The parts are connected to one another by a collection of wires called a bus, through
which data travels in the computer. Each bus carries three kinds of information; address, data,
and control. An address is used to select the memory location or device to which data will go, or
from which it will be taken. Data then flows over the bus between CPU, memory, and I/O
Devices. The control information is used to manage the flow of addresses and data. For example,
a control signal will typically be used to determine the direction in which the data is flowing
either to or from the CPU. The Bus Width is the number of bits that it can transfer
simultaneously. The wider the bus, the more address or data bits it can move at once.
RAM and ROM
Describe primary memory.
RAM stands for Random-Access Memory. RAM is memory in which each cell (usually a byte)
can be directly accessed. Inherent in the idea of being able to access each location is the ability
to change the contents of each location. That is, storing something else into that place can change
the bit pattern in each cell.
In addition to RAM, most computers contain a second kind of memory called ROM. ROM
stands for Read-Only Memory. The contents in locations in ROM cannot be changed. Their
contents are permanent and cannot be altered by a second operation. Placing the bit pattern in
ROM is called burning. The bit pattern is burnt either at the time the ROM is manufactured or at
the time the computer parts are assembled.
RAM and ROM are differentiated by a very basic property; RAM is volatile, and ROM is not.
This means that RAM does not retain its bit configuration when the power is turned off, but
ROM does. Because ROM is stable and cannot be changed, it is used to store the instructions
that the computer needs to start itself. Frequently used software is also stored in ROM so that the
system does not have to read the software each time the machine is turned on. Main memory
usually contains some ROM along with the general-purpose RAM.
Secondary Storage Devices
Identify the need for persistent storage.
An input device is the means by which data and programs are entered into the computer and
stored into memory. An output device is the means by which results are sent back to the user.
Because most of main memory is volatile and limited, it is essential that there be other types of
storage devices where programs and data can be stored when they are no longer being processed
or when the machine is not turned on. These other types of storage devices (other than that of
main memory) are called secondary or auxiliary storage devices. Because data must be read
from them and written to them, each storage device is also an input and an output device.
Examples of secondary storage devices include;
Magnetic Tape,
Magnetic Disks,
Flash Drives,
External Hardrives
them can store permanently. Memory consists of instructions and the data saved into computer
through Central Processing Unit (CPU).
DRAM
SRAM
DRDRAM
Specification changes.
Specification expansion.
New equipment. The costs involved in program maintenance are usually grossly underestimated
by most programmers. It has been studied that in a typical programming environment, over 50%
of the time is spent on maintaining the existing programs. So, it becomes really necessary to
reduce the costs and the time spent on maintenance. This can be done by the use of the following
steps:
Structured code.
Modularity.
Documentation.
carefully documented, since its working will seldom be obvious. Such are organization may
require a large amount of programmers time and should be avoided when possible. Enormous
gains cannot be expected from program optimization. Unless the program is very poorly written,
speed increase or memory reduction larger than 25% is rare.
8. Explain the need for an algorithm and highlight its advantages. Write an algorithm
to find the greatest among three numbers.
Advandages
To write the logic and method(s) to solve the problem in the procedural steps is called
Algorithm. Algorithm in a step by step procedure to solve a given problem.
1) Algorithms are independent of any computer language.
2) Algorithms are easy
3) To debug, since every step has got its own logical sequence.
4) Algorithms can be easily converted into flowcharts and then into computer programs
Write an algorithmto find the greatest among three numbers.
Input: Three numbers a, b, and c
Output: x, the largest of a, b, and c
procedure max(a, b, c)
x := a
if b>x
then x := b
if c>x
then x :=
return(x)
end max.
9. Mention the guidelines in detail while drawing a flowchart with examples and list
out the merits and demerits of flowcharting.
2. Executable part: There is at least one statement in the executable part. These two
parts must appear between the opening and closing braces. The program
execution begins at the opening brace and ends at the closing brace. The closing
brace of the main function is the logical end of the program. All statements in the
declaration and executable part end with a semicolon.
6. Subprogram section: If the program is a multi-function program then the subprogram
section contains all the user-defined functions that are called in the main () function.
User-defined functions are generally placed immediately after the main () function,
although they may appear in any order.
All section, except the main () function section may be absent when they are not required
2. Explain in detail about the constants, expressions and statements in C.
Variables
Variable names in C can consist of letters and numbers in any order, except that the first
character must be a letter. Names are case sensitive, so upper- and lower-case letters are not
interchangeable. The underscore character (_) can also be included in variable names, and is
treated as a letter. There is no restriction on the length of names in C. Of course, variable names
are not allowed to clash with keywords that play a special role in the C language, such as int,
double, if, return, void, etc. The following are examples of valid variable names in C:
x c14 area electron mass TEMPERATURE
The C language supports a great variety of different data types. However, the two data types
which occur most often in scientific programs are integer, denoted int, and floating-point,
denoted double. (Note that variables of the most basic floating-point data type float are not
generally stored to sufficient precision by the computer to be of much use in scientific
programming.) The data type (int or double) of every variable in a C program must be
declared before that variable can appear in an executable statement.
Integer constants in C are denoted, in the regular fashion, by strings of arabic numbers: e.g.,
0 57 4567 128933
Floating-point constants can be written in either regular or scientific notation: e.g.,
0.01 70.456 3e+5 .5067e-16
Strings are mainly used in scientific programs for data input and output purposes. A string
consists of any number of consecutive characters (including blanks) enclosed in double quotation
marks: e.g.,
causes the value represented by y to be assigned to x. In the third expression, the value of the
expression (u + v) is assigned to t. The fourth expression takes the value 1 (true) if the value
of x is less than or equal to the value of y. Otherwise, the expression takes the value 0 (false).
Here, <= is a relational operator that compares the values of x and y. The final example causes
the value of j to be increased by 1. Thus, the expression is equivalent to
j=j+1
The increment (by unity) operator ++ is called a unary operator, because it only possesses one
operand.
A statement causes the computer to carry out some definite action. There are three different
classes of statements in C: expression statements, compound statements, and control statements.
An expression statement consists of an expression followed by a semicolon. The execution of
such a statement causes the associated expression to be evaluated. For example:
a = 6;
c = a + b;
++j;
The first two expression statements both cause the value of the expression on the right of the
equal sign to be assigned to the variable on the left. The third expression statement causes the
value of j to be incremented by 1. Again, there is no restriction on the length of an expression
statement: such a statement can even be split over many lines, so long as its end is signaled by a
semicolon.
A compound statement consists of several individual statements enclosed within a pair of
braces { }. The individual statements may themselves be expression statements, compound
statements, or control statements. Unlike expression statements, compound statements donot end
with semicolons. A typical compound statement is shown below:
{
pi = 3.141593;
circumference = 2. * pi * radius;
area = pi * radius * radius;
}
This particular compound statement consists of three expression statements, but acts like a single
entity in the program in which it appears.
A symbolic constant is a name that substitutes for a sequence of characters. The characters may
represent either a number or a string. When a program is compiled, each occurrence of a
symbolic constant is replaced by its corresponding character sequence. Symbolic constants are
usually defined at the beginning of a program, by writing
#define NAME text
where NAME represents a symbolic name, typically written in upper-case letters,
and text represents the sequence of characters that is associated with that name. Note
that text does not end with a semicolon, since a symbolic constant definition is not a true C
statement. In fact, during compilation, the resolution of symbolic names is performed (by the C
preprocessor) before the start of true compilation. For instance, suppose that a C program
contains the following symbolic constant definition:
#define PI 3.141593
Suppose, further, that the program contains the statement
area = PI * radius * radius;
During the compilation process, the preprocessor replaces each occurrence of the symbolic
constant PI by its corresponding text. Hence, the above statement becomes
area = 3.141593 * radius * radius;
Symbolic constants are particularly useful in scientific programs for representing constants of
nature, such as the mass of an electron, the speed of light, etc. Since these quantities are fixed,
there is little point in assigning variables in which to store them.
3.Discuss about the various data types in C.
o Character type
2. Derived Data Types
o Arrays
o Pointers
o Structures
o Enumeration
Integer data types
Integers are whole numbers that can have both positive and negative values, but no decimal
values. Example: 0, -5, 10
In C programming, keyword int is used for declaring integer variable. For example:
int id;
The size of int is either 2 bytes(In older PC's) or 4 bytes. If you consider an integer having size of
4 byte( equal to 32 bits), it can take 232 distinct states as: -231,-231+1, ...,-2, -1, 0, 1, 2, ..., 231-2,
231-1
Similarly, int of 2 bytes, it can take 216 distinct states from -215 to 215-1. If you try to store larger
number than 231-1, i.e,+2147483647 and smaller number than -231, i.e, -2147483648, program
will not run correctly.
Floating types
Floating type variables can hold real numbers such as: 2.34, -9.382, 5.0 etc. You can declare a
floating point variable in C by using either float or double keyword. For example:
float accountBalance;
double bookPrice;
Qualifiers alters the meaning of base data types to yield a new data type.
Size qualifiers
Size qualifiers alters the size of a basic type. There are two size qualifiers, longand short. For
example:
long double i;
The size of float is 8 bytes. However, when long keyword is used, that variable becomes 10
bytes.
If you know that the value of a variable will not be large, short can be used.
Sign qualifiers
Integers and floating point variables can hold both negative and positive values. However, if a
variable needs to hold positive value only, unsigned data types are used. For example:
There is another qualifier signed which can hold both negative and positive only. However, it is
not necessary to define variable signed since a variable is signed by default.
An integer variable of 4 bytes can hold data from -231 to 231-1. However, if the variable is defined
as unsigned, it can hold data from 0 to 232-1.
It is important to note that, sign qualifiers can be applied to int and char types only.
Constant qualifiers
An identifier can be declared as a constant. To do so const keyword is used.
4. Describe the various types of operators in C language along with its priority.
Operator precedence determines the grouping of terms in an expression and decides how an
expression is evaluated. Certain operators have higher precedence than others; for example, the
multiplication operator has a higher precedence than the addition operator.
For example, x = 7 + 3 * 2; here, x is assigned 13, not 20 because operator * has a higher
precedence than +, so it first gets multiplied with 3*2 and then adds into 7.
Here, operators with the highest precedence appear at the top of the table, those with the lowest
appear at the bottom. Within an expression, higher precedence operators will be evaluated first.
Category
Operator
Associativity
Postfix
() [] -> . ++ - -
Left to right
Unary
Right to left
Multiplicative
*/%
Left to right
Additive
+-
Left to right
Shift
<< >>
Left to right
Relational
Left to right
Equality
== !=
Left to right
Bitwise AND
&
Left to right
Bitwise XOR
Left to right
Bitwise OR
Left to right
Logical AND
&&
Left to right
Logical OR
||
Left to right
Conditional
?:
Right to left
Assignment
Right to left
Comma
Left to right