Friday, 2 September 2022

Bharat College PGDCA CF 1st Unit

 

Computer Fundamentals

                                            Unit-I

 

Computer System Concepts: -A Computer is an electronic device that can perform a variety of operations in accordance with a set of instructions called programs.

            In other words, a computer is a machine that handles data. Data are facts that are gathered and entered into the computer. The computer stores, retrieves, sends, receives, and analyzes the data to produce information. Information is any collection of words, numbers, and symbols, organized so that it is meaningful to the person using it.

                                                The word “computer” comes from the word “compute” which means to calculate. So a computer is normally considered to be a calculating device that can perform arithmetic operations at enormous speed. In fact, the original objective for inventing the computer was to create a fast calculating machine. But more than 80% of the work done by computers today is of non-mathematical or non-numerical nature. Hence, to define a computer merely as calculating device is to ignore over 80% of the work. More accurately, a computer may be defined as a device that operates upon data. Data can be anything like Bio-data of various applicants, the marks obtained by various students in various subjects etc.

            Data comes in various shapes and sizes depending upon the type of computer application. A computer can store, process and retrieve data as and when desired. The fact that computers process data is so fundamental that many people have started calling it a data processor. The activity of processing data using a computer is called data processing. The computer can access and process data millions of times faster than humans can. A computer can store data and information in its memory, process them, and produce the desired results. Computers can do many different tasks such as playing games, railway reservation, weather forecasting etc.

[Data: - Data in computer terminology means raw facts.

            For example: Mohan, 1977, A etc.

Information: - It means what we get after processing data (meaningful data). Data are aggregated ( iw.kZ;ksx] leqPp;] lewg ) and summarized in various meaningful ways to form the information. For example Mohan, whose roll number is 1977 has grade A.]

A computer system consists of a computer and supporting devices for input and output of data. The data to be processed are supplied to the computer with the help of input devices. The processing unit performs the desired operations on the information and the result of calculations/processing is obtained on the output devices. Several types of input/output devices can be attached to the computer. A computer consists of electronic circuits only, while the input/output devices have both electronic and mechanical components.   

Computer System Characteristics: -

1. Speed: - The smallest unit of time in the human experience is the second. A computer is a very fast device. It can perform in a few seconds the amount of work that a human being can do an entire year – if he worked day and night and did nothing else. While talking about the speed of a computer, we do not talk in terms of seconds or even milliseconds (10-3). Our units of speed are the microseconds (10-6), the nanoseconds (10-9) and even the Pico seconds (10-12). A powerful computer is capable of performing several billion (109) simple arithmetic operations per second.

            To classify the speeds of different computer systems, the industry has developed the criterion of million instructions per second (MIPS). Data processors can compare computers’ processing speeds by comparing the number of instruction each can perform in 1 second. One computer might have a rating of 0.5 MIPS, another rating of 10 MIPS.

2. Accuracy: - In addition to being very fast, computers are very accurate.  The accuracy of a computer is consistently high and the degree of accuracy of a particular computer depends upon its design. But for a particular computer, each and every calculation is performed with the same accuracy.

                                    Errors can occur in a computer, but these are mainly due to human rather than technological weakness, that is, due to imprecise thinking by the programmer or due to incorrect input data. Computer errors caused due to incorrect input data or unreliable programs is often referred to as Garbage-in-Garbage-out or GIGO.  Hardware errors are usually detected and corrected by the computer system itself.  Any calculating device is useless if its results are unreliable. Computers are universally accused (nks"k yxkuk] vkjksi yxkuk) of making mistakes on bills, cheques and statements, although most errors attributed (fo'ks"krk] xq.k] y{k.k] fo'ks"k.k] izrhd] Js;] ) to computers are really human errors.

3.Diligence: - Unlike human beings, a computer is free from monotony, tiredness, lack of concentration etc and hence can work for hours together without creating any error and without grumbling. Due to this property, computers obviously score over human beings in doing routine type of jobs, which require great accuracy.  If ten million calculations have to be performed, a computer will perform the ten millionth calculations with exactly the same accuracy and speed as the first one.

4. Versatility: - Versatility is one of the most wonderful things about the computer. One moment, it is preparing the results of particular examination, the next moment it is busy preparing electricity bills and in between, it may be helping an office secretary to trace an important letter in seconds. All this work is possible by changing the program (sequence of instructions for computers). Briefly, a computer is capable of performing almost any task, provided that the task can be reduced to a series of logical steps.

5. Power of remembering: - As a human being acquires new knowledge, the brain subconsciously selects what it feels to be important and worth retaining in its memory, and relegates unimportant details to the back of the mind or just forgets them. With computers, this is not the case.    A computer can store and recall any amount of information because of its secondary storage capability. Every piece of information can be retained as long as desired by the user and can be recalled as and when required. Even after several years, the information recalled would be as accurate as on the day when it was fed to the computer. A computer forgets or losses certain information only when it is asked to do so. So it is entirely up to the user to make a computer retain or forget particular information.

In order to explain, the idea of storage capacity, we can take an example of CD-ROM and a hard disk. A single CD-ROM can store up to 700 MB of data while a hard disk can have a capacity of around 80 GB (1 GB=1024MB).

6. Automatic: - A machine is said to be automatic if it works by itself without human intervention. Computers are automatic machines because once started on a job, they carry on until the job is finished, normally without any human assistance. However, computers being machines cannot start themselves. They cannot go out and fine their own problems and solutions. They have to be instructed. That is, a computer works from a program of coded instruction that specify exactly how a particular job is to be done. While the job is in progress, the program is stored in the computer, and the parts of the instruction are obeyed. As soon as one instruction is completed, the next is obeyed automatically. Some of the other characteristics of computers such as speed and accuracy are due to the fact that they are automatic and work on a problem without any human intervention.

7. No I.Q.: - A computer is not a magical device. It can only perform tasks that a human being can.  The difference is that it performs these tasks with unthinkable speed and accuracy. It possesses no intelligence of its own. Its I.Q. is zero, at least till today. It has to be told what to do and in what sequence. Hence, only the user can determine what tasks a computer will perform. A computer cannot take its own decision in this regard.

8. No Feeling: - Computer is devoid of emotions. They have no feelings and no instincts because they are machine. Although men have succeeded in building a memory for the computer, but no computer possess the equivalent of a human heart and soul. Based on our feelings, taste, knowledge and experience, we often make certain judgments in our day-to-day life. But computers cannot make such judgments on their own. Their judgment is based on the instructions given to them in the form of programs that are written by us. They are only as good as man makes and uses them. 

 

Capabilities of Computer:

1.     It is self-directing. The user merely feeds all the instructions to the computer at the start and later proceeds without any need for human intervention.

2.     Ability to store and retrieve information. The computer has the ability to remember or recall data when finds the need for them.

3.     Ability to perform mathematical operations and solve complex formula at high speed and with great precision. A very fast computer can perform the addition of 20 million pairs of ten-digit numbers in one second.

4.     Ability to perform logic operation. The computer is capable of comparing numbers, letters of alphabets and special characters. Based on the results of comparison, the computer can direct to take alternative actions.

Limitations of Computer:

1.     It can do only what is designed or programmed to do. If you ask the computer to get the total payroll for a certain period, it will give you only the total payroll and not the net salary or gross salary of each employee.

2.     It cannot correct input data. If you mistakenly entered an hour rate of P50 per hour, the computer cannot respond to the actual rate of P40 per hour.

3.     It cannot think and cannot drive meaning from objects. The computer cannot interpret your favorite poem or your present mood.

4.     It can only process jobs expressed in a number of steps leading to a precisely defined goal.

5.      It cannot completely avoid making errors due to power fluctuations, system malfunctions, and human disorders.

TYPES OF COMPUTER: -The computers have been classified into three categories

1) Digital Computer

2) Analog Computer

3) Hybrid Computer

DIGITAL COMPUTERS: - Digital computers represent data as numbers. Counting on your fingers is the simplest form of digital computer. The digital computers work upon discontinuous data. They convert the data into digits (binary digits 0 and 1) and all operations are carried out on these digits at extremely fast rates. A digital computer knows how to count the digits and add the digits. Digital Computers are much faster than analog computers and far more accurate. Computers used for business and scientific applications are digital computers. Digital Computers can be classified in two ways:

(1)   Purpose- wise

(2)   Size and performance wise

Purpose Wise digital computers are classified into two types:

Special-Purpose Computer is the one that is designed to perform a specific task. The instruction (programs) to carry out the task is permanently stored in the machine. For the specific tasks, this type of computer works efficiently but such computers are not versatile.

General- Purpose Computer is the one that can work on different types of programs input to it and thus be used in countless applications. The programs are not permanently stored but are input at the time of execution. These computers are very versatile.

Size and Performance wise digital computers can be classified into following four types:

Microcomputers- a microcomputer is a computer who’s CPU is a microprocessor. A microprocessor is a processor whose all components are on a single integrated circuit chip. Those are normally single-microprocessors, single-user systems designed for performing basic operations like educational, training, small business applications, playing games etc. These are mainly used in offices, homes, schools, shops, stores etc. IBM PCs, Apple Mac, IBM PS/2 are some popular computers of this range.

            Compared to mainframes and minis the microcomputer may be comparatively slow and their capabilities limited, but they do provide good value for money. The market of cheap microcomputers has tremendously (extremely) expanded in recent years. In India, several companies have been licensed to manufacture microprocessors.

Minicomputers- Minicomputers are more powerful computers than microcomputers in terms of processing power and capabilities. Minicomputers are mainly multi-user systems where many users simultaneously work on the systems. Mini computers posses’ greater storage capacity and larger memories as compared to microcomputers. These are even capable of handling more input-output devices. The most important advantage of a minicomputer over the mainframe is that it is cheaper in cost, small in size and very reliable. It does not require air conditioning and can be operated at room temperature.  Examples are: PDP-11, VAX, and 7500 MAGNUM etc.

            Mini computer can accept and transfer data from I/O devices at the maximum speed of 4 millions bytes per second. They usually employ microprocessors (chips) in the CPU, both for data storage as well as data manipulations.

Mainframe Computers- Mainframe computers are designed to handle huge volumes of data and information. These very large and expensive computers have great processing speed and very large storage capacity and memory as compared to minicomputers. These computers even posses and work with more than one processor at the same time. Thus, one can say these are multi-user, multiprocessor systems. For mainframe computers very sophisticated operating systems are needed to control and supervise their operation. Mainframe allows its user to maintain large information storage at a centralized location and be able to access and process this data from different computers located at different locations. They are typically used by large businesses and for scientific purposes. Examples are: ICL 39, CDC 6600, VAX 8842, IBM 3090/600, and IBM 4381.

Super Computers –Super computers are the most powerful computers among digital computers. These consist of several processors running together thereby making them immensely (hugely) faster and powerful. These computers are capable of handling huge amounts of calculations that are beyond human capabilities. Super computers can perform billions of instruction per second. Some of today’s super computers have the computing capability equal to that of 40,000 microcomputers. A Japanese super-computer has calculated the value of Pi to 16 million decimal places. These computers cost in 15-20 million-dollar range. A super computer can process a great deal of information and make extensive calculations very, very quickly. They can resolve complex mathematical equations in a few hours, which would have taken a scientist with paper and pencil a lifetime, or, years, using a hand calculator. Typically, super computers are used to solve multi-variant mathematical problems of existent physical processes, such as aerodynamics, metrology and plasma physics. These are also required by the military strategists to simulate defense scenario. These are mainly used in application used in applications like weather forecasting, nuclear science research, seismology etc. Examples are: CRAY X-MP/14, CDC –205, ETA, PARAM, and ANURAG.

            PARAM and ANURAG are super computers produced by India and are exported to many European countries.

ANALOG COMPUTERS: - In analog computers, continues quantities are used. Computations are carried out with physical quantities such as voltage, length, current, temperature etc. The devices that measure such quantities are analog devices e.g. voltmeter ammeter. Analog computers operate by measuring rather than counting. Such computers do not directly deal with the numbers. They measure continuous physical magnitudes (such as temperature, pressure and voltage), which are analogous to the numbers under considerations. For example, the petrol pump may have an analog computer that converts the flow of pumped petrol into two measurements- the quantity of petrol and the price for that quantity.   The main advantage of analog computers is that all calculations take place in parallel and hence these are faster. It is very easy to get graphical results directly using analog computer. But their accuracy is poor as compared to digital counterparts. Analog computers are mostly used in engineering and scientific applications. An electronic weighing scale is an example of analog computer.

Difference between Analog and Digital Computer: -

Analog

Digital

Operates on physical quantities like temperature, resistance, length, speed etc.

Operates on numbers like amount of cheque, number of miles etc.

Measures

Counts

Continuous

Discontinuous

Storage capacity relatively high

Storage capacity relatively low

Mainly Process Control

Scientific and Commercial use

HYBRID COMPUTER: -    Hybrid computers utilize the best qualities of both the digital and analog computers. In these computers some calculations take place in analog manner and rest of them take place in digital manner. Hybrid computers are best used in hospital where analog part is responsible for measurement of patient’s heart beat, blood pressure, temperature and other vital signs and then the operation is carried out in digital fashion to monitor patient’s vital signs. They are usually used for special problems in which input data derived from measurements is converted into digits and processed by computer. Hybrid computers are also used in weather forecasting, scientific applications, control national defense and passenger flight radar and various fields of engineering and in industrial control processes.

            The computer can act like an analog computer, converting measurements into numeric input. It can act as a digital computer, processing stored data for management. Analog and hybrid computers perform specialized task but the digital computers are used almost everywhere in business and scientific applications.

 

Basic Components of a Computer System: - A computer can be viewed as a system that comprises several units. The term computer system refers to the whole of computer hardware, components, peripherals and data communication equipments. It consists of a number of interrelated components that work together with the aim of converting data into information. A computer system essentially has the following components:

The Central Processing Unit (CPU):- The CPU is the brain of a computer system. All major calculations and comparisons performed by a computer are carried out inside its CPU. The CPU is also responsible for activating and controlling the operations of other units of the computer system.

Control Unit:- We know that the two basic components of a CPU are the   Control Unit and the Arithmetic Logic Unit.  The CU controls and guides the interpretation, flow and manipulation of all data and information. The CU sends control signals until the required operations are done properly by ALU and memory. Another important function of CU is the program execution i.e. carrying out all the instruction stored in the program. The CU gets program instruction from memory and executes them one after the other. After getting the instruction form memory in CU, the instruction is decoded and interpreted i.e. which operation is to be performed. The control unit even controls the flow of data from input devices to memory and from memory to output devices.

            Although, the control unit does not perform any actual processing on the data, it acts as a central nervous system for the other components of the computer.

Arithmetic Logic Unit:- The arithmetic logic unit (ALU) of a computer system is the place where the actual execution of the instructions takes place during the processing operation. All calculation is performed and all comparisons (decision) are made in the ALU. The data and instruction stored in the primary storage prior to processing are transferred as and when needed to the ALU where processing takes place. No processing done in the primary storage unit. The ALU perform all the four arithmetical (+, -, *, /) and some logical (<, >, =, <=, >=, <>) operations. When two numbers are required to be added, these numbers are sent from memory to ALU where addition takes place and the result is put back in the memory. The same way other arithmetic operations are performed. For logical operation also, the numbers to be compared are sent from memory to ALU where the comparisons takes place and the result is returned to the memory. The result of a logical operation is either TRUE or FALSE. These operations provide the capability of decision-making to the computer.

Input/Output functions:- A computer system also incorporates input and output devices, which are a communication medium between a human and the computer. An input unit accepts instructions and data from the user and communicate them to the computer. The basic task of this unit is to gather the data and converts it into the form that the computer can understand. Some of the input devices are keyboard, mouse, light pen and so on.

            Just as humans communicate with computers with input devices, the computer can communicate with human beings with the help of output devices. Like input units, output units are instruments of interpretations and communications between humans and computers. These devices take the machine coded output results from the processor and convert them into a form that can be used by the people or as a machine input in another processing cycle. Some of the commonly used output devices are printers, monitor and plotters.

            In addition to these, a computer also employs secondary storage devices, which are extensively used for storing data or instructions. The physical components or materials on which data is stored permanently are called storage units or devices. It supplies the stored information to the other units of computer as and when required. Some common storage devices are floppy disks, hard disks and tape drives.

Memory:- The memory of a computer is more like a predefined working place, where it temporarily keeps information and data to facilitate its performance. When the task is performed, it clears its memory and memory space is then available for the next task to be performed. When the power is switched off, everything stored in the memory gets erased and cannot be recalled.

                                                The memory of computer is often called main memory or primary memory.  The memory of a computer can be thought of as cells. Each of these cells is further broken down into smaller parts known as bits. A bit means a binary digit i.e. either 0 or 1. A bit is an elementary unit of the memory. A group of 8 bits is called a byte and a group of 4 bits is called a nibble.

            One byte is the smallest unit, which can represent a data item or a character. Other units of memory are KB, MB, and GB.

            1KB = 1024 BYTES = 210

 

                    1 MB = 1024 KB = 1024*1024 BYTES

 

            1 GB = 1024 MB = 1024*1024*1024 BYTES

 

Since computer’s main memory (primary memory) is temporary, secondary memory space is needed to store data and information permanently for later use. The two most common secondary storage media are the floppy diskette and the hard disk.

            There are two types of memories: Primary and Secondary. The primary memory or the main memory is part of the main computer system. The processor directly stores and retrieves information from it. The primary memory itself is implemented by two types of memory technologies. The first is called random access memory(RAM) and other is read only memory(ROM).

Random Access Memory (RAM):- Random access memory is a volatile memory. It means the information stored in it remains as long as the power is switched ON. As soon as the power is switched OFF, the information contained in it vanishes. RAM can be defined as a block of sequential memory locations, each of which has a unique address determining the location and those locations contain a data element.

Physically, this memory consists of some integrated circuit chips either on the motherboard or on a small circuit board attached to the motherboard. A computer’s motherboard is designed so that its memory capacity can be easily enhanced by adding more memory chips. The additional RAM chips, which plug into special sockets on the motherboard, are also known as single in-line memory modules (SIMMs).

            There are two types of RAM.

Dynamic Random Access Memory (DRAM):- This type of RAM holds the data in dynamic manner with the help of a refresh circuitry. Each second or even less than that the content of each memory cell is read and the reading action refreshes the contents of the memory. Due to this refreshing action, the memory is called dynamic RAM. DRAMs are made from transistor and capacitor. The capacitor holds the electrical charge if the bit contains 1 and no charge if the bit is 0. The transistors read the contents of the capacitor. The charge is held for a short period and than it fades away, that is, when refresh circuitry comes in.

Static Random Access Memory (SRAM):- SRAM along with DRAM is essential for a system to run optimally, because it is very fast as compared to DRAM. It is effective because most programs access the same data repeatedly and keeping all this information in the fast SRAM allows the computer to avoid accessing the slower DRAM. Data is first written to SRAM assuming that it will be used again soon. SRAM is generally included in a computer system by the name of cache. A static RAM is faster, costlier, and consumes more power than dynamic RAM. Due to these reasons, large memories use dynamic RAM, and static RAM is used mainly for specialized applications. The main memory of most computers uses dynamic RAM.

Read Only Memory (ROM):- A special type of RAM, called read only memory (ROM) is a non-volatile memory chip in which data is stored permanently and can not be altered by the programmer. As the name suggests, read only memory can only be read, not written. The contents of ROM are not lost even in case of sudden power failure, making it non-volatile in a nature.  Read only memory is also random access in nature, which means the CPU can randomly access any location within ROM.

            In fact, storing data permanently into this kind of memory is called “burning in the data”, because data in such memory is stored by fuse-links. Once a fuse-link is burnt it is permanent. ROMs are mainly used to store programs and data which do not change and are frequently used. For example, the most basic computer operations are carried out by wired electronic circuits. However, there are several higher level operations that are very frequently used but will require very complicated electronics circuits for their implementations. Hence, instead of building electronics for these operations, special programs are written to perform these operations. These programs are called micro programs because they deal with low-level machine functions and are essentially substitutes for additional hardware.  Micro programs are written to aid the control unit in directing all the operations of the computer systems. ROMs are mainly used by computer manufacturers for storing these micro programs so that they can not be modified by the users. A good example of a micro program that is stored in a ROM chip of a computer is the set of instructions that is needed to make the computer system ready for use when its power is switched on. This micro programs called system boot programs, contains a set of start up instructions to check if the system hardware like memory, I/O devices etc are functioning properly and looks for an operating system and loads its core part in the volatile RAM of the system to produce the initial display screen prompt. Note that this micro program is used every time the computer is switched on and needs to be retained when the computer is switched off.    

There are various types of ROMs, which are given below:

  • Programmable Read Only Memory (PROM)- PROM is a ROM that can be programmed to record information using a facility known as PROM programmer. Once the chip has been programmed, the recorded information can not be changed i. e. PROM becomes same as ROM.
  • Erasable Programmable Read Only Memory- EPROM is another type of ROM that can not erased and the chip can be programmed to record different information using a special PROM program facility. Erasure to achieved by exposing the chip to ultraviolet light. When an EPROM is in use, information can only be read and the information remains on the chip until it is erased. EPROM are of two kinds-UVPROM(Ultraviolet PROM) and EAPROM(Electrically Alterable PROM).
  • Electrically Erasable PROM (EEPROM)- This type of ROM can be programmed and erased by electrical signals. It does not require exposure to ultraviolet light to erase its contents as EPROM memory does and provides an easy means to load and store temporary or permanent information in a form of ROM memory. Information loaded in this memory can be retained for many years without any power supplied, one of its new applications is as a backup to RAM memory whose contents   are lost in a power failure. When power is returned, the EEPROM memory can be used to replace the lost contents of the RAM memory and the microcomputer can continue working just as if nothing had happened. Even newer devices are combining RAM and EEPROM memory in a single integrated circuit.  Due to the ease with which stored programs can be altered, EEPROM is also known as flash memory. Flash memory is used in many new I/O and storage devices. The intelligence of these devices can be upgraded by simply down-loading new software from a vendor-supplied disk to flash memory.

 

Cache Memory:-  Cache memory is an extremely fast, small memory between CPU and main memory whose access time is closer to the processing speed of the CPU. It acts as a high-speed buffer between CPU and main memory and is used to temporarily store very active data and instructions during processing. Since the cache memory is faster than main memory, the processing speed is increased by making data and instructions needed in present processing available in the cache.

 

Data Representation and Codes:- We know that a computer stores data internally in a format that is not easily readable by human beings. Every computer stores numbers, letters and other special characters in codes form. Therefore, you have to understand number system before codes. Basically, there are two types of number system.

1)     Non-Positional Number Systems:- In early days, human beings counted on fingers. When counting beyond ten fingers, they used stones, pebbles, or sticks to indicate values. This method of counting uses known as non-positional number system. In this system, we have symbols such as I for 1, II for 2, III for 3, IIII for 4, IIIII for 5 etc. Each symbol represents the same value regardless of its position in a number, and to find the value of a number, one has to count the number of symbols present in the number. Since it is very difficult to perform arithmetic with such a number system, positional number systems were developed.

2)     Positional Number System:- In a positional number system, there are only a few symbols called digits. These symbols represent different values, depending on the position they occupy in a number. The value of each digit in such a number is determined by three considerations:

a)     The digit itself,

b)     The position of the digit in the number, and

c)     The base of the number system(where base is defined as the total number of digits available in the number system).

             In our day-to-day life, we use decimal number system. In this system, base is equal to 10 because there are altogether ten symbols or digits (0, 1, 2, 3, 4, 5, 6, 7, 8, and 9). You know that in decimal number system, successive positions to the left of the decimal point represent units, tens, hundreds, thousands, etc. However, notice that each position represents a specific power of the base (10). For example, decimal number 2586(written as 258610) consists of digit 6 in unit’s position, 8 in tens position, 5 in hundreds positions, and 2 in thousands positions, and its value can be written as:

            (2*103)+(5*102)+(8*101)+(6*100)=2000+500+80+6=2586

            The principles that apply to decimal number system, also apply to any other positional number system. It is important to keep track of only the base of the number system in which we are working. The value of the base in all positional number systems suggests the following characteristics:

  1. The value of the base determines the total number of different symbols or digits available in the number system. The first of these choices is always zero.
  2. The maximum value of a single digit is always equal to one less than the value of the base.

Decimal:- The primary number system used is a base ten number system or decimal number system. The decimal system is the system, which we use every day while counting. The name is derived from the Latin word Decem, which means ten. This number system includes the ten digits from 0 through 9. These digits are recognized as the symbols of the decimal system.

            Starting at the decimal point and moving to the left, each position is represented by the base (radix) value (10 for decimal) raised to a power. The power starts at 0 for the position just to the left of the decimal point. The power is incremented for each position that continues to the left.

Binary:-- Binary number system is like decimal number system, except that the base is 2, instead of 10. You can use only two symbols or digits (0 and 1) in this number system. Note that the largest single digits are 1(one less than the base). Each position in a binary number represents a power of the base (2). Hence, in this system, the rightmost positions is units (20) position, the second position from the right is 2’s (21) and so on. Therefore, decimal equivalent of binary number 10101(written as 101012) is:

(1*24)+(0*23)+(1*22)+(0*21)+(1*20)=16+0+4+0+1=21

Hence, we can write

101012=2110

            The short form of “binary digit” is bit. Hence, a bit in computer terminology means either a 0 or 1. An n-bit number is a binary number consisting of ‘n’ bits. All 3-bit numbers along with their decimal equivalent is shown in table.

Binary

Decimal Equivalent

000

0

001

1

010

2

011

3

100

4

101

5

110

6

111

7

 

Remember that we have only two digits, 0 and 1, in binary number system and hence, binary equivalent of decimal number 2 has to be stated as 10(read as one, zero). Another important point to note is that with 3 bits (positions), only 8(23) different patterns of 0s and 1s are possible, as shown in table. In fact, any decimal number in the range 0 to 2n-1 can be represented in binary form as an n-bit number. Every computer stores numbers, letters, and other special characters in binary form. There are several occasions when computer professionals need to know the raw data contained in a computer’s memory. A commonly used way of doing this is to print memory contents on a printer. This printout is called a memory dump. Memory dumps, which are in binary numbers, would have many pages of 0s and 1s. Working with these numbers would be very difficult and error prone for computer professional. Hence, two number systems- octal and hexadecimal are often used as shortcut notations for binary.

Octal: In octal number system, the base is 8. Hence, there are only eight symbols or digits: 0,1,2,3,4,5,6 and 7. The largest single digit is 7(one less than the base 8). Each positions in an octal number represents a power of the base (8). Therefore, decimal equivalent of octal number 2057(written as 20578) is:

(2*83)+(0*82)+(5*81)+(7*80)=1024+0+40+7=1071

Hence, 20578=107110

Observe that there are only 8 digits in octal number system, 3 bits( 23=8) are sufficient to represent any octal number in binary.

Hexadecimal System: In hexadecimal number system, the base in 16. Hence, there are 16 symbols or digits. The first 10 digits are the same digits of decimal number system- 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. The remaining six digits are denoted by the largest single digit is F or 15(one less than the base 16). Each position in hexadecimal number system represents a power of the base (16). Therefore, decimal equivalent of hexadecimal number 1AF (written as 1AF16) is:

(1*162)+(A*161)+(F*160)=(1*256)+(10*16)+(15*1)=256+160+15=431

Hence, 1AF16=43110

Observe that since there are only 16 digits in hexadecimal number system, 4 bits (24=16) are sufficient to represent any hexadecimal number in binary.

 

Inter Conversion: Numbers expressed in decimal number system are much more meaningful to us, than are numbers expressed in any other number system. However, you can represent any number in one number system in any other number system. Because the input and final output values are to be in decimal, computer professionals are often required to convert numbers in other number system to decimal and vice-versa. Many methods or techniques can be used to convert numbers from one base to another.

Converting to Decimal from Another Base:-- The following three steps are used to convert to a base 10 value from any other number system:

Step 1: Determine the column value of each digit(this depends on the position of the digit and the base of the number system).

Step 2: Multiply the obtained column values by the digits in the corresponding columns.

Step 3: Sum the products calculated in step 2. The total is the equivalent value in decimal.

For Example:   110012=?10

Step 1: Determine Column Values

            Column Number                                 Column Value

1                                                                                                 20 = 1

2                                                                                                 21 = 2

3                                                                                                 22 = 4

4                                                                                                 23 = 8

5                                                                                                 24 = 16

Step 2: Multiply column values by corresponding column digits

            16        8          4          2          1

            *1        *1        *0        *0        *1

Step 3: Sum the products

            16+8+0+0+1=25

 

Converting from a Base 10 to a new base(Division-Remainder Technique):

The following four steps are used to convert a number from base 10 to a new base:

Step 1: Divide the decimal number to be converted by the value of the new base.

Step 2: Record the remainder from step 1 as the rightmost digit(least significant digit) of the new base number.

Step 3: Divide the quotient of the previous divide by the new base.

Step 4: Record the remainder from step 3 as the nest digit, (to the left) of the new base number.

For Example: 2510 = ?2

Steps 1 & 2: 25/2= 12 and remainder 1

Steps 3 & 4: 12/2= 6 and remainder 0

Steps 3 & 4: 6/2= 3 and remainder 0

Steps 3 & 4: 3/2= 1 and remainder 1

Steps 3 & 4: ½= 0 and remainder 1

Hence, 2510= 110012    

Computer Codes:-- Numeric data is not the only form of data handled by a computer. We often requires to process alphanumeric data also. An alphanumeric data is a string of symbols, where a symbol may be one of the letters A, B, C,…….Z, or one of the digits 0,1,2,…..9, or a special character, such as + - * / , . () = (space or blank) etc. An alphabetic data consists of only the letters A, B,C,……Z, and blank character. Similarly, numeric data consists of only the digits 0,1,2,….and 9. However, the bits 0 and 1 must represent any data internally. Hence, computers use binary coding schemes to represent data internally.

BCD Numbers: Binary Coded Decimal (BCD) code is one of the early computer codes. The idea of this coding scheme is to convert each digit of a decimal number into its binary equivalent instead of converting the entire decimal value into a binary number. This makes the conversion process easier.

Decimal Digits

BCD Equivalent

0

0000

1

0001

2

0010

3

0011

4

0100

5

0101

6

0110

7

0111

8

1000

9

1001

 Figure shows BCD equivalent of each decimal digit. Since 8 and 9 require 4 bits, all decimal digits are represented in BCD by 4 bits. As you, know that 4210 is equal to 1010102.  However, converting 4210 into BCD produces the following result:

4210=0100       0010                or         01000010 in BCD

Note that each decimal digit is independently converted to a 4-bit binary number, and hence, the conversion process is very easy. Also note that when four bits are used, altogether 16 (24) combinations are possible. However, from figure you can see that only the first 10 of these combinations are used to represent decimal digits. The remaining six arrangements (1010, 1011, 1100, 1101, 1110 and 1111) have decimal values from 10 to 15. These arrangements are not used in BCD coding. That is 1010 does not represent 1010 in BCD. Instead,

1010= 0001      0000    or 00010000 in BCD

            4-bit BCD coding system can be used to represent only decimal numbers because four bits are insufficient to represent the various characters used by a computer. Hence, instead of using four bits with only 16 possible characters, computer designers commonly use six bits to represent characters in BCD code. In 6-bit BCD code, the four BCD numeric place positions are retained but two additional zone positions are added. With six bits, it is possible to represent 64(26) different characters. This is sufficient to code the decimal digits (10), alphabetic letters(26), and other special characters(28).

EBCDIC:- The major problem with BCD code is that it can represent only 64(26) different characters. This is not sufficient for providing decimal numbers (10), lowercase (small) letters (26), uppercase (capital) letters (26), and a large number of other special characters (28+). Hence, BCD code was extended from a 6-bit code to an 8-bit code. The added two bits are used as additional zone bits, expanding the zone to four bits. The resulting code is called the Extended Binary-Coded Decimal Interchange Code (EBCDIC). In this code, it is possible to represent 256(28) different characters, instead of 64 (26). In addition to the various characters, this also allows a large variety of printable characters and several non-printable control characters. The control characters are used to control such activities as printer vertical spacing, movement of cursor on terminal screen etc. All of the 256 combinations have not yet been assigned characters. Hence, the code can still grow, as new requirements develop. Developed by IBM, EBCDIC code is used in most IBM models, and in many other computers.

 

ASCII Codes: Another widely used computer code is the American Standard Code for Information Interchange (ASCII). Several American computer manufactures have adopted ASCII as their computer’s internal code. This code is popular in data communications, is used almost exclusively to represent data internally in microcomputers and is frequently found in larger computers produced by some vendors.

            American National Standards Institute (ANSI) published ASCII standard in 1963. However, the standard lacked lowercase letters and ANSI subsequently revised ASCII in 1967. Later revisions in 1968, 1977 and finally in 1986 brought it in its present form. Today, ASCII is one of the most popular and widely supported character-encoding standards.

            ASCII is of two types- ASCII-7 and ASCII-8. ASCII-7 is a 7-bit code that can represent 128(27) different characters. Computers using 8-bit byte and 7-bit ASCII either set the 8th bit (leftmost bit) of each byte as zero or use it as a parity bit.

            ASCII-8 is an extended version of ASCII-7. It is an 8-bit code that can represent 256(28) different characters. The additional bit is added to the left of the 7th bit(leftmost bit) of ASCII-7 codes. ASCII-7 uses only 7 bits whereas all the 8 bits are used in ASCII-8. Hence, the codes of first 128 characters (symbols) are identical in ASCII-7 and ASCII-8.

 

No comments:

Post a Comment