Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
22 views27 pages

Data Representation in A Computer

Uploaded by

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

Data Representation in A Computer

Uploaded by

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

DATA REPRESENTATION IN A

COMPUTER

1. Introduction
 Computers are classified according to functionality, physical
size and purpose.
 Functionality, Computers could be analog, digital or hybrid.
Digital computers process data that is in discrete form whereas
analog computers process data that is continuous in nature. Hybrid
computers on the other hand can process data that is both discrete
and continuous.
 In digital computers, the user input is first converted and
transmitted as electrical pulses that can be represented by two
unique states ON and OFF. The ON state may be represented by a
“1” and the off state by a “0”.The sequence of ON’S and OFF’S
forms the electrical signals that the computer can understand.
 A digital signal rises suddenly to a peak voltage of +1 for some time
then suddenly drops -1 level on the other hand an analog signal
rises to +1 and then drops to -1 in a continuous version.

 Although the two graphs look different in their appearance, notice that they repeat
themselves at equal time intervals. Electrical signals or waveforms of this nature are
said to be periodic.Generally,a periodic wave representing a signal can be described
using the following parameters
 Amplitude(A)
 Frequency(f)
 periodic time(T)

 Amplitude (A): this is the maximum displacement that the waveform of an electric
signal can attain.
 Frequency (f): is the number of cycles made by a signal in one second. It is measured
in hertz.1hert is equivalent to 1 cycle/second.
 Periodic time (T): the time taken by a signal to complete one cycle is called periodic
time. Periodic time is given by the formula T=1/f, where f is the frequency of the
wave.

 When a digital signal is to be sent over analog telephone lines e.g. e-mail, it has to be
converted to analog signal. This is done by connecting a device called a modem to the
digital computer. This process of converting a digital signal to an analog signal is
known as modulation. On the receiving end, the incoming analog signal is converted
back to digital form in a process known as demodulation.
2. concepts of data representation in digital
computers
 Data and instructions cannot be entered and processed directly into computers using
human language. Any type of data be it numbers, letters, special symbols, sound or
pictures must first be converted into machine-readable form i.e. binary form. Due to
this reason, it is important to understand how a computer together with its peripheral
devices handles data in its electronic circuits, on magnetic media and in optical
devices.

Data representation in digital circuits

 Electronic components, such as microprocessor, are made up of millions of electronic


circuits. The availability of high voltage(on) in these circuits is interpreted as ‘1’
while a low voltage (off) is interpreted as ‘0’.This concept can be compared to
switching on and off an electric circuit. When the switch is closed the high voltage in
the circuit causes the bulb to light (‘1’ state).on the other hand when the switch is
open, the bulb goes off (‘0’ state). This forms a basis for describing data
representation in digital computers using the binary number system.

Data representation on magnetic media

 The laser beam reflected from the land is interpreted, as 1.The laser entering the pot is
not reflected. This is interpreted as 0.The reflected pattern of light from the rotating
disk falls on a receiving photoelectric detector that transforms the patterns into digital
form.The presence of a magnetic field in one direction on magnetic media is
interpreted as 1; while the field in the opposite direction is interpreted as
“0”.Magnetic technology is mostly used on storage devices that are coated with
special magnetic materials such as iron oxide. Data is written on the media by
arranging the magnetic dipoles of some iron oxide particles to face in the same
direction and some others in the opposite direction

Data representation on optical media

In optical devices, the presence of light is interpreted as ‘1’ while its absence is interpreted as
‘0’.Optical devices use this technology to read or store data. Take example of a CD-ROM, if
the shiny surface is placed under a powerful microscope, the surface is observed to have very
tiny holes called pits. The areas that do not have pits are called land.

Reason for use of binary system in


computers
 It has proved difficult to develop devices that can understand natural language directly
due to the complexity of natural languages. However, it is easier to construct electric
circuits based on the binary or ON and OFF logic. All forms of data can be
represented in binary system format. Other reasons for the use of binary are that
digital devices are more reliable, small and use less energy as compared to analog
devices.

Bits, bytes, nibble and word

 The terms bits, bytes, nibble and word are used widely in reference to computer
memory and data size.
 Bits: can be defined as either a binary, which can be 0, or 1.It is the basic unit of data
or information in digital computers.

 Byte: a group of bits (8 bits) used to represent a character. A byte is considered as the
basic unit of measuring memory size in computer.
 A nibble: is half a byte, which is usually a grouping of 4 bytes.

 Word: two or more bits make a word. The term word length is used as the measure
of the number of bits in each word. For example, a word can have a length of 16 bits,
32 bits, 64 bits etc.

Types of data representation


 Computers not only process numbers, letters and special symbols but also complex
types of data such as sound and pictures. However, these complex types of data take a
lot of memory and processor time when coded in binary form.
 This limitation necessitates the need to develop better ways of handling long streams
of binary digits.
 Higher number systems are used in computing to reduce these streams of binary digits
into manageable form. This helps to improve the processing speed and optimize
memory usage.

Number systems and their representation

o A number system is a set of symbols used to represent values derived from a


common base or radix.
o As far as computers are concerned, number systems can be classified into two
major categories:
o decimal number system
o binary number system
o octal number system
o hexadecimal number system

Decimal number system

o The term decimal is derived from a Latin prefix deci, which means ten.
Decimal number system has ten digits ranging from 0-9. Because this system
has ten digits; it is also called a base ten number system or denary number
system.
o A decimal number should always be written with a subscript 10 e.g. X10
o But since this is the most widely used number system in the world, the
subscript is usually understood and ignored in written work. However ,when
many number systems are considered together, the subscript must always be
put so as to differentiate the number systems.
o The magnitude of a number can be considered using these parameters.
o Absolute value
o Place value or positional value
o Base value
 The absolute value is the magnitude of a digit in a number. for
example the digit 5 in 7458 has an absolute value of 5 according to its
value in the number line.
 The place value of a digit in a number refers to the position of the
digit in that number i.e. whether; tens, hundreds, thousands etc.
 The total value of a number is the sum of the place value of each digit
making the number.
 The base value of a number also k known as the radix, depends on the
type of the number systems that is being used .The value of any
number depends on the radix. for example the number 10010 is not
equivalent to 1002.

Binary number system


It uses two digits namely, 1 and 0 to represent numbers. unlike in decimal numbers where the
place value goes up in factors of ten, in binary system, the place values increase by the factor
of 2.binary numbers are written as X2.consider a binary number such as 10112.The right most
digit has a place value of 1×20 while the left most has a place value of 1×23.

Octal number system

Consists of eight digits ranging from 0-7.the place value of octal numbers goes up in factors
of eight from right to left.

Hexadecimal number system


This is a base 16 number system that consists of sixteen digits ranging from 0-9 and letters A-
F where A is equivalent to 10,B to 11 up to F which is equivalent to 15 in base ten system.
The place value of hexadecimal numbers goes up in factors of sixteen.

 A hexadecimal number can be denoted using 16 as a subscript or capital letter H to


the right of the number .For example, 94B can be written as 94B16 or 94BH.

Further conversion of numbers from one number system to another

 To convert numbers from one system to another. the following conversions will be
considered.

 Converting between binary and decimal numbers.


 Converting octal numbers to decimal and binary form.
 Converting hexadecimal numbers to decimal and binary form.

1. a) Conversion between binary and decimal number


2. Converting binary numbers to decimal numbers

 To convert a binary number to a decimal number, we proceed as follows:

 First, write the place values starting from the right hand side.
 Write each digit under its place value.
 Multiply each digit by its corresponding place value.
 Add up the products. The answer will be the decimal number in base ten.

EXAMPLE

Convert 1011012 to base 10(or decimal) number

Place value 25 24 23 22 21 20
Binary 1 0 1 1 0 1
digits

Multiply each digit by its place value

N10=(1*25) +(0*24)+(1*23)+(1*22)+(0*21)+(1*20)

N10=32+0+8+4+0+1

=4510

32*1=32

16*0=0

8*1=8 4*1=4

2*0=0

1*1=1

=4510

NB: remember to indicate the base subscript since it is the value that distinguishes the
different systems.

Nimetön #0b4a
 The binary equivalent of the fractional part is extracted from the products by reading
the respective integral digits from the top downwards as shown by the arrow next
page.
 Combine the two parts together to set the binary equivalent.
Convert 0.37510 into binary form

Read this digits

0.375×2=0.750

0.750×2=1.500

0.500×2=1.000 (fraction becomes zero)

Therefore 0.37510=0.0112

NB: When converting a real number from binary to decimal, work out the integral part and
the fractional parts separately then combine them.

Example

Convert 11.0112 to a decimal number.

Solution

Convert the integral and the fractional parts separately then add them up.

2×1= 2.000

1×1= +1.000

3.00010

Weight 21 20 . 2-1 2-2 2-3


Binary digit 1 1 .0 1 1
Values in base 2 1 . 0 0.25 0.125
10

0.50×0 =0.000

0.25×1 =0.250

0.125×1=+0.125

0.37510

3.00010+0.37510= 3.37510

Thus 11.0112=3.37510

1. iv) Converting a decimal fraction to binary

Divide the integral part continuously by 2.For the fractional part, proceed as follows:
Multiply the fractional part by 2 and note down the product

 Take the fractional part of the immediate product and multiply it by 2 again.
 Continue this process until the fractional part of the subsequent product is 0 or starts
to repeat itself.

Nimetön #0e21

o The following examples illustrate how to convert hexadecimal number to a
decimal numberExample

Convert octal number 3218 to its binary equivalent

Solution

Working from left to the right, each octal number is represented using three
digits and then combined we get the final binary equivalent. Therefore:

3=0112

2=0102

1=0012

Combining the three from left to right

3 2 1
011 010 001

3218 =0110100012

Converting binary numbers to hexadecimal numbers

 To convert binary numbers to their binary equivalents, simply group


the digits of the binary number into groups of four from right to left
e.g. 11010001.The next step is to write the hexadecimal equivalent of
each group e.g.

1101- D

0001- 1

The equivalent of 11010001 is D1H or D116

Converting hexadecimal numbers to decimal and binary numbers.

Converting hexadecimal numbers to decimal number


 To convert hexadecimal number to base 10 equivalent we proceed as
follows:

3. First, write the place values starting from the right hand side.
4. If a digit is a letter such as ‘A’ write its decimal equivalent

 Multiply each hexadecimal digit with its corresponding place value


and then add the products

The binary equivalent of the fractional part is extracted from the products by reading
the respective integral digits from the top downwards as shown by the arrow next pag

 Combine the two parts together to set the binary equivalent.

Convert 0.37510 into binary form

Read this digits

0.375×2=0.750

0.750×2=1.500

0.500×2=1.000 (fraction becomes zero)

Therefore 0.37510=0.0112

Converting octal numbers to decimal and binary numbers

Converting octal numbers to decimal numbers

 To convert a base 8 number to its decimal equivalent we use the same method as we
did with binary numbers. However, it is important to note that the maximum absolute
value of a octal digit is 7.For example 982 Is not a valid octal number because digit 9
is not an octal digit, but 7368 is valid because all the digits are in the range 0-
7.Example shows how to convert an octal number to a decimal number.

Example 1.13

Convert 5128 to its base 10 equivalent

Solution

Place 82 81 80
value 64 8 1
Octal digit 5 1 2

Write each number under its place value as shown below

Multiply each number by its place value.


N10=(5 x 82)+(1 x 81 )+(2 x 80 )

=(5 x 64)+8+2

=320+8+2

N10=33010

64 x 5=320

8 x 1= 8

1 x 2=+ 2

330

Therefore5128 =33010

Converting octal numbers to binary numbers

 To convert an octal number to binary, each digit is represented by three binary digits
because the maximum octal digit i.e. 7 can be represented with a maximum of seven
digits. See table:

Octal digit Binary equivalents


0 000
1 001
2 010
3 011
4 100
5 101
6 110
7 111

Nimetön #b724
Example

Convert the hexadecimal number 11116 to its binary equivalent.

Solution

Place each number under its place value.

162 161 160


1 1 1

256 x1= 256

16 x 1 = 16

1 x 1= + 1

273

Therefore 11116 =27310

Example

Convert octal number 3218 to its binary equivalent

Solution

Working from left to the right, each octal number is represented using three digits and then
combined we get the final binary equivalent. Therefore:

3=0112

2=0102

1=0012

Combining the three from left to right

3 2 1
011 010 001

3218 =0110100012

Converting binary numbers to hexadecimal numbers

To convert binary numbers to their binary equivalents, simply group the digits of the binary
number into groups of four from right to left e.g. 11010001.The next step is to write the
hexadecimal equivalent of each group e.g.

1101- D

0001- 1

The equivalent of 11010001 is D1H or D116

Converting hexadecimal numbers to decimal and binary numbers.

Converting hexadecimal numbers to decimal number


To convert hexadecimal number to base 10 equivalent we proceed as follows:

First, write the place values starting from the right hand side.

1. If a digit is a letter such as ‘A’ write its decimal equivalent

 Multiply each hexadecimal digit with its corresponding place value and then add the
products

 The following examples illustrate how to convert hexadecimal number to a decimal


number

Example

Convert the hexadecimal number 11116 to its binary equivalent

Solution

Place each number under its place value.

162 161 160


1 1 1

256 x1= 256

16 x 1 = 16

1 x 1= + 1

273

Therefore 11116 =27310

Converting hexadecimal numbers to binary


numbers
 Since F is equivalent to a binary number11112 the hexadecimal number are therefore
represented using4 digits as shown in the table below

Hexadecimal digit Decimal equivalent Binary equivalent


00 00 0000
01 01 0001
02 02 0010
03 03 0011
04 04 0100
05 05 0101
06 06 0110
07 07 0111
08 08 1000
09 09 1001
A 10 1010
B 11 1011
C 12 1100
D 13 1101
E 14 1110
F 15 1111

The simplest method of converting a hexadecimal number to binary is to express each


hexadecimal digit as a four bit binary digit number and then arranging the group according to
their corresponding positions as shown in example

Example 1

Convert 32116

Hexadecimal digit 3 2 1
Binary equivalent 0011 0010 0001

Combining the three sets of bits, we get 0011001000012

32116 = 0011001000012

Example 2

Convert 5E616 into binary

Hexadecimal digit

5 E 6
Binary 0101 1110 0110
equivalent

5E616 = 0101111001102

Symbolic representation using coding


schemes
 In computing, a single character such as a letter, a number or a symbol is represented
by a group of bits. The number of bits per character depends on the coding scheme
used.
 The most common coding schemes are:
 Binary Coded Decimal (BCD),
 Extended Binary Coded Decimal Interchange Code (EBCDIC) and
 American Standard Code for Information Interchange (ASCII).

Binary Coded Decimal

 Binary Coded Decimal is a 4-bit code used to represent numeric data only. For
example, a number like 9 can be represented using Binary Coded Decimal as 10012 .
 Binary Coded Decimal is mostly used in simple electronic devices like calculators and
microwaves. This is because it makes it easier to process and display individual
numbers on their Liquid Crystal Display (LCD) screens.
 A standard Binary Coded Decimal, an enhanced format of Binary Coded Decimal,
is a 6-bit representation scheme which can represent non-numeric characters. This
allows 64 characters to be represented. For letter A can be represented as
1100012using standard Binary Coded Decimal

Extended Binary Coded Decimal Interchange code (EBCDIC)

 Extended Binary Coded Decimal Interchange code (EBCDIC) is an 8-bit character-


coding scheme used primarily on IBM computers. A total of 256 (28) characters can
be coded using this scheme. For example, the symbolic representation of letter A
using Extended Binary Coded Decimal Interchange code is 110000012.

American standard code for information interchange (ASCII)

 American standard code for information interchange (ASCII) is a 7-bit code, which
means that only 128 characters i.e. 27 can be represented. However, manufactures
have added an eight bit to this coding scheme, which can now provide for 256
characters.
 This 8-bit coding scheme is referred to as an 8-bit American standard code for
information interchange. The symbolic representation of letter A using this scheme is
10000012..

Binary arithmetic operations


 In mathematics, the four basic arithmetic operations applied on numbers are addition,
subtraction, multiplications and division.
 In computers, the same operations are performed inside the central processing unit by
the arithmetic and logic unit (ALU). However, the arithmetic and logic unit cannot
perform binary subtractions directly. It performs binary subtractions using a process
known as For multiplication and division, the arithmetic and logic unit uses a method
called shifting before adding the bits.

Representation of signed binary numbers

 In computer technology, there are three common ways of representing a signed binary
number.

1. Prefixing an extra sign bit to a binary number.


2. Using ones compliment.
3. Using twos compliment.

Prefixing an extra sign bit to a binary number

 In decimal numbers, a signed number has a prefix “+” for a positive number e.g.
+2710 and “-“ for a negative number e.g.-27
 However, in binary, a negative number may be represented by prefixing a digit 1 to
the number while a positive number may be represented by prefixing a digit 0. For
example, the 7-bit binary equivalent of 127 is 11111112. To indicate that it is positive,
we add an extra bit (0) to the left of the number i.e. (0)11111112.
 To indicate that it is negative number we add an extra bit (1) i.e. (1)11111112.
 The problem of using this method is that the zero can be represented in two ways i.e.
(0)00000002 and (1)00000002.

Ones compliment
 The term compliment refers to a part which together with another makes up a whole.
For example in geometry two complimentary angle (900).
 The idea of compliment is used to address the problem of signed numbers i.e. positive
and negative.
 In decimal numbers (0 to 9), we talk of nine’s compliment. For example the nines
compliment
 Of 9 is 0, that of 5 is 4 while 3 is 6.
 However, in binary numbers, the ones compliment is the bitwise NOT applied to the
number. Bitwise NOT is a unary operator (operation on only one operand) that
performs logical negation on each bit. For example the bitwise NOT of 11002 is
00112e.
 0s are negated to 1s while 1s are negated to 0s.

Twos compliment

 Twos compliment, equivalent to tens compliment in decimal numbers, is the most


popular way of representing negative numbers in computer systems. The advantages
of using this method are:

1. There are no two ways of representing a zero as in the case with other two methods.
2. Effective addition and subtraction can be done even with numbers that are represented
with a sign bit without a need for circuitries to examine the sign of an operand.

 The twos compliment of a number is obtained by getting the ones compliment then
adding a 1. For example, to get the twos compliment of a decimal number 4510,
 First convert it to its binary equivalent then find its ones compliment. Add a 1 to ones
compliment i.e.

4510=001011012

Bitwise NOT (00101101) =11010010

Two’s compliment = 110100102+12


= 110100112

Binary addition

The five possible additions in binary are

1. 0+0=0
2. 0+ 12 = 12
3. 12 + 0 = 12
4. 12 + 12 = 102 (read as 0, carry 1)
5. 12 + 12 + 12 = 112 (read as 1, carry 1)

Example 1

Find the sum of 1112 + 0112

Solution

Arrange the bits vertically. 111

Working from the right to the left, we proceed as follows: + 011

Step 1 12 + 12 = 102, (write down 0 and carry 1) 10102

Step 2 12 + 12 + 12 = 112, (add and carry over digit to 1 + 1 in order to get 1 + 1

+1. From the sum, write down digit one the carry

Forward)

Step 3 12 + 12 + 02 = 102, (add the carry over digit to 1 + 0 in order to get

1 + 1 + 0.since this is the last step, write down 10)

Therefore 1112 + 0112 = 10102

This can be summarized in the table

1st number 1 1 1
2nd number 0 1 1
Carry digit - 1 1
sum 10 1 0

Example 2

Add the following binary number

101102
10112

+ 1112

Solution

Add the first two numbers and then add the sum to the third number a follows:

Step 1 Step 2

101102 1000012

+ 10112 + 1112

1000012 1010002

Binary subtraction
Direct subtraction

The four possible subtractions in binary are:

1. 0–0=0
2. 12 – 0 = 12
3. 12 – 12 = 0
4. 102 – 12 = 12 ( borrow 1 from the next most significant digit to make 0 become 102,

hence 102 – 12 = 12)

Subraction using ones compliment

The main purpose of using ones compliment in computers is to perform binary subtraction.
For example to get the difference in 5 – 3, using the ones compliment, we proceed as follows:

1. Rewrite the problem as 5 + (-3) to show that he computer binary subtraction by


adding the binary equivalent of 5 to ones compliment of 3.
2. Convert the absolute value of 3 into 8-bits equivalent i.e. 000000112.
3. Take the ones compliment of 000000112e. 111111002 which is the binary
representation of -310.
4. Add the binary equivalent of 5 to ones compliment of 3 i.e.

00000101

+ 11111000

(1)00000001
Subtraction using twos compliments.

Like in ones compliment, the twos compliment of a number is obtained by negating a positive
number to is negative counterpart. For example to get the difference in 5-3, using twos
compliment, we proceed as follow:

1. rewrite the problem as 5 + (-3)


2. Convert the absolute value of 3 into 8-bit binary equivalent i.e. 00000011.
3. Take the ones compliment of 00000011 i.e. 11111100.
4. add a 1 to the ones compliment i.e. 11111100 to get 11111101
5. add he binary equivalent of 5 to the twos compliment of 3 i.e.

00000101

+ 11111001

(1)00000010 Ignoring the overflow bit, the resulting number is 00000010, which is directly
read as a binary equivalent of +2.

Example

Using twos compliment

3110 - 1710 in binary form.

Solution

1710 in binary 00010001

1’s compliment 11101110

2’s compliment 11101111

3110 = 000111112

00011111 + 11101111 = (1)000011102

DATA PROCESSING
Introduction
 Data refers to the raw facts that do not have much meaning to the user and may include
numbers, letters, symbols, sound or images.
 Information refers to the meaningful output obtained after processing the data.
 Data processing therefore refers to the process of transforming raw data into meaningful
output i.e. information.
 Data processing can be done manually using pen and paper. Mechanically using simple
devices like typewriters or electronically using modern data processing tools such as
computers.

Data processing cycle

o It refers to the sequence of activities involved in data transformation from its row
form to information. it is often referred to as cycle because the output obtained can
be stored after processing and may be used in future as input.
o The four main stages of data processing cycle are:
 Data collection
 Data input
 Data processing
 Data output

1. Data collection

 Also referred to as data gathering or fact finding ,it involves looking for crucial facts needed
for processing.

Methods of data collection

 Include interviews; use of questionnaires, observation, etc.in most cases the data is
collected after sampling.
 Sampling is the process of selecting representative elements (e.g. people, organizations)
from an entire group (population) of interest. Some of the tools that help in the data
collection include source documents such as forms, data capture devices such as digital
camera etc.

Stages of data collection

 The process of data collection may involve a number of stages depending on the method
used. These include:
o Data creation: this is the process of identification and putting together facts in an
organized format. This may be in the form of manually prepared document or
captured from the source using a data capture device such as a barcode reader and
be inputted easily in a computer.
o Data preparation: this is the transcription (conversion) of data from source
document to machine readable form. This may not be the case for all input devices.
Data collected using devices that directly capture data in digital form do not require
transcription.
o Data transmission: this will depend on whether data need to be transmitted via
communication media to the central office.

4. Data input:

o Refers to the process where the collected data is converted from human readable
from to machine readable form (binary form). The conversion takes place in the
input device.
o Media conversion: data may need to be transmitted from one medium to another
e.g. from a floppy disk to a computer’s hard disk for faster input.
o Input validation: data entered into the computer is subjected to validity checks by a
computer program before being processed to reduce errors as the input.
o Sorting: in case the data needs to be arranged in a predefined order, it is first sorted
before processing.

9. Processing

o This is the transformation of the input data by the CPU to a more meaningful output
(information).Some of the operations performed on the data include calculations,
comparing values and sorting.

11. Output

o The final activity in the data processing cycle is producing the desired output also
referred to as information. This information can be distributed to the target group or
stored for future use. Distribution is making information available to those who need
it and is sometimes called information dissemination. This process of dissemination
may involve electronic presentation over the radio or television, distribution of hard
copies, broadcasting messages over the internet or mobile phones etc.

Description of errors in data processing



1. Computational errors

o Occurs when an arithmetic operation does not produce the expected results. The
most common computation errors include overflow, truncation and rounding
o Overflow errors
o Occurs if the result from a calculation is too large to be stored in the allocated
memory space. For example if a byte is represented using 8 bits, an overflow will
occur if the result of a calculation gives a 9-bit number.
o Truncation errors
o Result from having real numbers that have a long fractional part which cannot fit in
the allocated memory space. The computer would truncate or cut off the extra
characters from the fractional part. For example, a number like 0.784969 can be
truncated to four digits to become 0.784

The accuracy of the computer output is critical. As the saying goes garbage in garbage
out (GIGO),the accuracy of the data entered in the computer directly determines the
accuracy of the information given out.

 Some of the errors that influence the accuracy of data input and information output include

 Transcription,
 Computation and
 Algorithm or logical errors.

 2.Transcription errors
 Occurs during data entry. Such errors include misreading and transposition errors
 Misreading errors
 Are brought about by the incorrect reading of the source by the user and hence entering
wrong values. For example a user may misread a handwritten figure such as 589 and type
S89 instead i.e. confusing 5 for S.

 Transposition errors
 Results form incorrect arrangement of characters i.e. putting characters in the wrong order.
For example the user might enter 396 instead of 369.
 These errors may be avoided by using modern capture devices such as bar code readers,
digital cameras etc which enter data with the minimum user intervention.

 Rounding errors
 Results from raising or lowering a digit in a real number to the required rounded number. for
example, to round off 30.666 to one decimal place we raise the first digit after the decimal
point if its successor is more than or equal to five. In this case the successor is 6 therefore
30.666 rounded up to one decimal place is 30.7.if the successor is below five,e.g.30.635,we
round down the number to 30.6

1. Algorithm or logical errors


o An algorithm is a set of procedural steps followed to solve a given problem.
Algorithms are used as design tools when writing programs. Wrongly designed
programs would result in a program that runs but gives erroneous output. Such
errors that result from wrong algorithm design are referred to as algorithm or logical
errors.

Data integrity
 Data integrity refers to the accuracy and completeness of data entered in a computer or
received from the information system. Integrity is measured in terms
of accuracy, timeliness and relevance of data.

 Accuracy
 It refers to how close an approximation is to an actual value. As long as the correct
instructions and data are entered, computers produce accurate results efficiently. In
numbers, the accuracy of a real number depends on the number. For example, 72.1264 is
more accurate than 72.13.

 Timeliness
 This is the relative accuracy of data in respect to the current state of affairs for which it is
needed.
 This is important because data and information have a time value attached to them. If
received late, the information may have become useless to the user. For example,
information in the newspaper that is meant to invite people for a meeting or occasion must
be printed prior to the event and not later.

 Relevance
 Data entered into the computer must be relevant so as to get the expected output. In this
case, relevance means that the data entered must be pertinent to the processing needs at
hand and must meet the requirements of the processing cycle. The user also needs relevant
information for daily operations or decision making.

Threat to data integrity

 Threats to data integrity can be minimized through the following ways:


 Backup data preferably on external storage media.
 Control access to data by enforcing security measures.
 Design user interfaces that minimize chances of invalid data entry.
 Using error detection and correction software when transmitting data
 Using devices that directly capture data from the source such as bar code readers, digital
cameras, and optical scanners.

Data processing methods


 As mentioned earlier, data can be processed manually, mechanically and electronically.

1. Manual data processing

 In manual data processing, most tasks are done manually with a pen and a paper. For
example in a busy office, incoming tasks (input) are stacked in the “tray” (output). The
processing of each task involves a person using the brain in order to respond to queries.
 The processed information from the out tray is then distributed to the people who need it or
stored in a file cabinet.

1. Mechanical data processing

 Manual is cumbersome and boring especially repetitive tasks. Mechanical devices were
developed to help in automation of manual tasks. Examples of mechanical devices include
the typewriter, printing press, and weaving looms. Initially, these devices did not have
electronic intelligence.

1. Electronic data processing

 For a long time, scientists have researched on how to develop machine or devices that
would stimulate some form of human intelligence during data and information processing.
This was made possible to some extent with the development of electronic programmable
devices such as computers.
 The advent of microprocessor technology has greatly enhanced data processing efficiency
and capability. Some of the micro processor controlled devices include computers,
cellular(mobile) phones, calculators, fuel pumps, modern television sets, washing machines
etc

Computer files
 A file can be defined as a collection of related records that give a complete set of
information about a certain item or entity. A file can be stored manually in a file cabinet or
electronically in computer storage devices.
 Computerized storage offers a much better way of holding information than the manual
filing system which heavily relies on the concept of the file cabinet.

 Some of the advantages of computerized filing system include:

1. information takes up much less space than the manual filing


2. it is much easier to update or modify information
3. it offers faster access and retrieval of data
4. It enhances data integrity and reduces duplication
5. It enhances security of data if proper care is taken to secure it.

Elements of computer file

 A computer file is made up of three elements: characters, fields and records.

 Characters
 A character is the smallest element in a computer file and refers to letter, number or symbol
that can be entered, stored and output by a computer. A character is made up of seven or
eight bits depending on the character coding scheme used.

 Field
 A field is a single character or collection of characters that represents a single piece of data.
For example, the student’s admission number is an example of a field.

 Records
 A record is a collection of related fields that Represents a single entities, e.g. in a class score
sheet, detail of each student in a row such as admission number, name, total marks and
position make up a record.

Logical and physical files

 Computer files are classified as either physical or logical

 Logical files
 A computer file is referred to as logical file if it is viewed in terms of what data item it
contains and details of what processing operations may be performed on the data items. It
does not have implementation specific information like field, data types, size and file type.

 Physical files
 As opposed to a logical file, a physical file is viewed in terms of how data is stored on a
storage media and how the processing operations are made possible. Physical files have
implementation specific details such as characters per field and data type for each field.

Types of Computer Processing Files


 There are numerous types of files used for storing data needed for processing, reference or
back up. The main common types of processing files include

 Master files,
 Transaction,
 Reference,
 Backup, report and
 Sort file.

1. Master file

 A master file is the main that contains relatively permanent records about particular items or
entries. For example a customer file will contain details of a customer such as customer ID,
name and contact address.

1. Transaction (movement) file

A transaction file is used to hold data during transaction processing. The file is later used to
update the master file and audit daily, weekly or monthly transactions. For example in a busy
supermarket, daily sales are recorded on a transaction file and later used to update the stock
file. The file is also used by the management to check on the daily or periodic transactions.

Reference file

A reference file is mainly used for reference or look-up purposes. Look-up information is that
information that is stored in a separate file but is required during processing. For example, in
a point of sale terminal, the item code entered either manually or using a barcode reader looks
up the item description and price from a reference file stored on a storage device.

Backup file

A backup files is used to hold copies (backups) of data or information from the computers
fixed storage (hard disk). Since a file held on the hard disk may be corrupted, lost or changed
accidentally, it is necessary to keep copies of the recently updated files. Incase of the hard
disk failure, a backup file can be used to reconstruct the original file.

Report file

Used to store relatively permanent records extracted from the master file or generated after
processing. For example you may obtain a stock levels report generated from an inventory
system while a copy of the report will be stored in the report file.
Sort file
It stores data which is arranged in a particular order.

 Used mainly where data is to be processed sequentially. In sequential processing, data or


records are first sorted and held on a magnetic tape before updating the master file.

File organization methods


 File organization refers to the way data is stored in a file. File organization is very important
because it determines the methods of access, efficiency, flexibility and storage devices to
use. There are four methods of organizing files on a storage media. This include:

 sequential,
 random,
 serial and
 indexed-sequential

1. Sequential file organization

 Records are stored and accessed in a particular order sorted using a key field.
 Retrieval requires searching sequentially through the entire file record by record to the end.
 Because the record in a file are sorted in a particular order, better file searching methods like
the binary search technique can be used to reduce the time used for searching a file .
 Since the records are sorted, it is possible to know in which half of the file a particular record
being searched is located, Hence this method repeatedly divides the set of records in the file
into two halves and searches only the half on which the records is found.
 For example, of the file has records with key fields 20, 30, 40, 50, 60 and the computer is
searching for a record with key field 50, it starts at 40 upwards in its search, ignoring the first
half of the set.

Advantages of sequential file organization

 The sorting makes it easy to access records.


 The binary chop technique can be used to reduce record search time by as much as half the
time taken.

Disadvantages of sequential file organization

 The sorting does not remove the need to access other records as the search looks for
particular records.
 Sequential records cannot support modern technologies that require fast access to stored
records.
 The requirement that all records be of the same size is sometimes difficult to enforce.

1. Random or direct file organization

 Records are stored randomly but accessed directly.


 To access a file stored randomly, a record key is used to determine where a record is stored
on the storage media.
 Magnetic and optical disks allow data to be stored and accessed randomly.

Advantages of random file access

 Quick retrieval of records.


 The records can be of different sizes.

1. Serial file organization

 Records in a file are stored and accessed one after another.


 The records are not stored in any way on the storage medium this type of organization is
mainly used on magnetic tapes.

Advantages of serial file organization


 It is simple
 It is cheap

Disadvantages of serial file organization

 It is cumbersome to access because you have to access all proceeding records before
retrieving the one being searched.
 Wastage of space on medium in form of inter-record gap.
 It cannot support modern high speed requirements for quick record access.

1. Indexed-sequential file organization method

 Almost similar to sequential method only that, an index is used to enable the computer to
locate individual records on the storage media. For example, on a magnetic drum, records
are stored sequential on the tracks. However, each record is assigned an index that can be
used to access it directly.

Electronic data processing methods


 There are several ways in which a computer, under the influences of an operating system is
designed to process data.
 Examples of processing modes are:

1. online processing
2. real time processing
3. distributed processing
4. Time sharing
5. Batch processing
6. multiprocessing
7. multitasking
8. interactive processing

1. Online processing

 In online data processing data is processed immediately it is received. The computer is


connected directly to the data input unit via a communication link. The data input may be a
network terminal or online input devices attached to the computer.

1. Real-time processing

 Computer processes the incoming data as soon as it occurs, updates the transaction file and
gives an immediate response that would affect the events as they happen.
 This is different from online in that for the latter an immediate response may not be
required.
 The main purpose of a real-time processing is to provide accurate, up-to-date information
hence better services based on a true (real) situation.
 An example of a real time processing is making a reservation for airline seats. A customer
may request for an airline booking information through a remote terminal and the
requested information will be given out within no time by the reservation system. If a
booking is made, the system immediately updates the reservation file to avoid double
booking and sends the response back to the customer immediately.

 Distributed data processing


 Multiprogramming, also referred to as multitasking refers to a type of processing where
more than one program are executed apparently at the same time by a single central
processing unit.Distributed data processing refers to dividing (distributing) processing tasks
to two or more computer that are located on physically separate sites but connected by data
transmission media.
1. MultiprogrammingFor example, a distributed database will have different
tables of the same database residing on separate computers and processed
there as need arises.
 This distribution of processing power increases efficiency and speed
of processing. An example is in the banking industry where
customers’ accounts are operated on servers in the branches but all
the branch accounts can be administered centrally from the main
server as if they resided on it. In this case, we say that the
distributed database is transparent to the user because the
distribution is hidden from the user’s point of view.

1. Time sharing

 In a time sharing processing, many terminals connected to a central


computer are given access to the central processing unit apparently
at the same time. However in actual sense, each user is allocated a
time slice of the CPU in sequence. The amount of time allocated to
each user is controlled by a multi-user operating system. If a user’s
task is not completed during the allocated time slice, he/she is
allocated another time slice later in a round robin

1. Batch processing

 Data is accumulated as a group (batch) over a specified period of


time e.g. daily, weekly or monthly. The batch is then processed at
once.
 For example in payroll processing system, employees details
concerning the number of hours worked, rate of pay, and other
details are collected for a period of time say, one month. These
details are then used to process the payment for the duration
worked. Most printing systems use the batch processing to print
documents.

1. Multiprocessing

 Refers to the processing of more than one task at the same time on
different processors of the same computer. This is possible in
computers such as mainframes and network servers.
 In such systems a computer may contain more than one
independent central processing unit which works together in a
coordinated way.
 At a given time, the processors may execute instructions from two
or more different programs or from different parts of one program
simultaneously.
 This coordination is made possible by a multi-processing operating
system that enables different processors to operate together and
share the same memoryThe users of the distributed database will be
completely unaware of the distribution and will interact with the
database as if all of it was in their computer.

Exercises
1. Data processing cycle
2. Draw and label a clear flow diagram of
the stages involved in a data processing
cycle.
3. List the various steps in the data
processing cycle and briefly describe what
happens at each stage.
4. True or false.
5. Define
Submission folder for Exercise 2.
Sinulla ei ole tarvittavia oikeuksia lähettää mitään.

0 kommenttia

Draw and label a clear flow diagram of the


stages involved in a data processing cycle.

You might also like