-->

programming concept(Theory part only)

 

Programming language

Programming:-

Computers work by programming or by instruction given by the user. If there is no instruction; just think no computer. So to write a program, we use some application software or programming software called programming language. Like C, C++, java, VB. C# etc

Qualities of good program:

When we write a program, the program should be coded with keeping in mind following features.

1.Integrity:

          The program coded by programmers must be correct and should give desired output called integrity.

2.Clarity:-

         The program should be designed in such a way a person may be business or non-IT degree holders can understand easily.

3.Simplicity:-

            Any problem can be solved in different ways. The programmer should choose that one technique which is very simple for both programmer and users.

4.Efficiency:-

           While designing a program or software, there is an important factor to be considered called fastness (speed) and less memory occupancy.

5.Modularity:- 

          Obviously, the highly skilled programmers use module technique while designing the program. This technique lets programmers as well as non programmers understand what is happening inside.

6.Fault tolerance:-

        While using the program if any error comes then the program should find itself the problem and search the good solution. This is very important factor to be considered.

7.Security:

          It’s a big issue for the programmers to keep in mind while programming. There should not be some like acceptances of invalid data or leakage of memory or data among the users and obviously prevention from unauthorized users from being misuse.

8.Time and cost effective:

         Customers, they want quality in work, service in time and low in price. So the vendor/s should try to minimize the time to be taken for development with its cost. (write any 5)


Types of programming languages:

                                                         We know that our computer is full of programs. It does everything by using programs. If there is no program then just we can say the computer is a useless/meaningless box. For the programs to be written by users; users use programming language. The programming language is a bridge between a user and machine. It is used to communicate with computers as well as to develop further platforms.

             We have different programming languages as categorized below.

Low level language: We have two types under this.

                           machine level language (1GL):-    Low level language was used in first and second generation computers. At that time, there was no language so programmers used to use languages like machine level language: It is the computer's own language.

                        In this language, the computer uses string or bunch of 0 and 1s to carry out tasks. Besides 0 and 1, the computer does not use anything else. This language is easily understandable by machine, so no need to use a translator or language processor.  Since it is very close to hardware level, a user needs to have knowledge of hardware to write a program in this language.

 Advantages:

1.Fast execution and high efficiency

2.Easily understandable

Disadvantages:

1.Machine dependency

2.Learning and Writing code is tedious

3.Difficult to debug if program is very long and complex.

4.Not easily customizable



Assembly language(2gL):

                          To overcome the problems faced in machine level language, another language called assembly language came in use by developers. In this language, we use mnemonics codes or words. Here Mnemonics means words which are easy to use and remember while writing. Unlike M.L.L., users do not need to use 0 and 1s, instead users have to use some words like ADD, SUB, LOAD, JMP, MUL, INC etc while coding. When we compare these all with machine level, we can see that they are easy to remember and use. But, the structure and writing way is similar to MLL. While writing program, the programmer needs to tell the name of the storage location (register) to the system so s/he must have an idea about Hexa storage locations by using a register. It is not a computer’s own language so the computer uses or has to use a translator called “Assembler” to translate Mnemonics codes to MLL. It has the following Pros and Cons.

     Advantages:                                                                     

1. Easier than MLL to understand and write

2.Easy to modify

3.Easier to find bugs

4.Fast execution because of machine closeness

Disadvantages

1.Complex program development is like very tedious

2.Machine dependency

3.Deep knowledge of hardware needed.

4.Logical errors difficult to detect

Etc

 High level language:

 As the users started writing complex programs, they felt that the MLL/AL was not suitable for fast writing and execution. So they moved to some user’s level language called high level language. And the development of HLL started from 3rd generation computers. The HLLs are closed to human languages where we use mostly English words/verbs which we use in our daily life like main, print, input, countif etc. by using this HLL, once the program is written on one system , the same program can be used on another system without any problem. They are more user friendly than MLL and AL. In this, users do not need to have hardware knowledge. Since it is not the computer's own language it needs to be translated into machine level language. For this we can use Language translators like “Compiler” or Interpreter.

       Advantages

1.Machine independent

2.Programmers need not to know about internal components

3.Easy to learn, understand, write, debug

4.Fast coding

5.More customizable and easy to maintain complex code

Disadvantages

1.Needs translator, so takes more time to get output and compile

2.Less efficient compared to MLL

3.Less use of computer resources etc

The HLL can be sub-categorized into:

3GL:

3 GL is called language of procedure oriented programming and it can be used for general purpose works/jobs. In this, the main focus is given on procedure with the help of available library functions. It is more flexible than 1 and 2 GLs. By using this we can solve varieties of problems in less time. We use hierarchical decomposition techniques to solve a task.  It has brought many programmer-friendly features to code such as loops, conditionals, classes etc. This means that one line of third generation code can produce many lines of object (machine) code, saving a lot of time when writing programs. Third generation uses CONCEPT OF execution line by line. Third generation languages can be platform independent, meaning that code written for one system will work on another. To convert a 3rd generation program into object code requires a Compiler or an Interpreter. This approach basically consists of writing a list of instructions for the computer to follow and organizing these instructions into groups known as functions.

                                 Following are the main properties carried by this programming:

1) Emphasis on doing things. 

2) Large program/s divided into small programs known as functions.

3) Shares global data

4) Data openly moves around the system.

some cons(disadvantages):

1. It’s heavy weight.

2. needs a translator.

3.more time is needed to get output.

 

4 GL:-

           A fourth generation (programming) language (4GL) is a grouping of programming languages that attempt to get closer than 3GLs to human language, form of thinking and conceptualization. 4GLs are more programmer-friendly and enhance programming efficiency with usage of English-like words and phrases, and when appropriate, the use of icons, graphical interfaces and symbolic representations. 4GLs are designed to reduce the overall time, effort and cost of software development. Most of the 4gLs use form,report,query etc. while programming we use “form” concept with many modules. The main domains and families of 4GLs are: database queries, report generators, data manipulation, analysis and reporting, screen painters and generators, GUI creators, mathematical optimization, web development and general purpose languages. In 4GL we can use drag and drop facility while programming or developing. for example , SQL,Oracle,Sybase VB.net etc. pros:-

1. more friendly

2. powerful application and any type

3.less no. of codes

cons:

1. slow in loading and running.

2.more memory consumption

3.translator based


 

Comparison of 3 and 4 GL:

3 GL

4 GL

1.        General purpose

1.        Application specific purpose

2.        More procedure oriented

2.        More problem oriented

3.        Large no. of instructions, less productivity

3.        Less no. of instructions, more productivity

4.        Programmer provides every detail

4.        No need to put detail explanations

5.        Slow and error prone

5.        Fast and error less (mostly)

6.        Not so cost effective(expensive)

6.        Cost effective

7.        High working load by for many programmers

7.        Less load by less programmer

8.        E.g. C, C++, java etc

8.        SQL, MARK IV,MAPPER

 

Natural language (5 GL):-

Simply, the language used by human beings is called natural language like English, Nepali, etc. the languages used so far like QBasic, C, C++ etc are artificial languages. The fifth generation computers are supposed to understand our language. They can work much in the same manner as we do. This language is designed to be used for Artificial Intelligence work. The computer having this facility works by remembering the used words earlier by users and then making decisions. In this, the more emphasis is given to “what rather than how to do work”. The algorithm; Just not the matter for the computer. The main emphasis is given on what is to be done.  In this language, users just type sentences like we do, to get output. Like, “name of persons having salary more or equal to 25000”. But sometimes the meaning can be difficult for a computer to understand in some cases. so some senior level scientists are working on them. So in comparison to earlier computers, the computers having 5GL can be considered smart computers. 

 

Translator (language translator):

                                           As we know that computer’s own language is machine level language, but if we do not write instructions in this language, yeah; the computer can not easily understand so to make the computer understandable, our system uses a program or software which converts all instructions written in our language into machine level language. This software is called “Translator”. The instruction written in our language is called source code and the code which the computer understands is object code. Having translated the code, the computer with the help of linker (a small utility) links all objects files and takes for processes. Later on, we get output if no bug exists.

  We have three types of Translator. They are:

                             Compiler:

                          A translator or program or system program which is used to convert high level instruction to machine level instruction (object code) is called compiler. Compiler translates the whole program into object code at same time not one by one.  During compiling process, if it finds any syntax error, it highlights all and displays such that users can correct and rerun. If our program is completely bug free (syntax) then only compiler translates into object code. But the compiler can not find the logical error or run time error, to detect this; users must be very careful while coding. As the translation completes, the linker links all object codes and processes and gives output.  If number of lines in program is very large then compiler may take long time to process and to show bug (if any). But in shorter program, it is very fast. E.g. translation by C, C++ etc

                             Interpreter:

                          Another translator or language processor used to translate our instruction into machine level instruction is an Interpreter. If we compare this with compiler, the interpreter converts one by one line into M.L.L. whereas compiler does all lines at once. So the interpreter is slow or it takes more time if we are writing some like complex program. It takes one line, converts into machine level after trapping the syntax error for every line. So finding error for every line is some like easy. Interpreter is likely to convert code into intermediate form rather than object code immediately. As the whole lines come to be in intermediate form then system converts into M.L.L. But, if the program is short then it could be a better choice than compiler for the programmers. Translator by QBASIC, php

               Assembler:

                            We have already discussed about level of writing programs i.e. low level and high level. Under low level, we have two types namely machine level and assembly.

                                                                  If we write program in assembly language by using mnemonics codes then computer can not understand easily so computer uses a translator to convert our code into machine level called “assembler”. Every command in assembly language has a corresponding command in machine language. The assembly language differs among computers, and thus these programs are not easily transferable to machines of a different type from the one on which they were written.

For this different assemblers are used.  An assembler operates mostly in strings. Therefore, it accepts the symbol and translates into 0 and 1s. While translating, system follows two steps:

                                             1 translating code into object code and

                                             2 linking all object codes with run time library to combine the modules and then giving meaning of symbolic address to object code and then into executable code.

Here linker is a binder. While writing programs by using module concept, we have to combine all modules before execution, this is called linking. Actually linker combines all objects codes and then executes.

Comparison between Compiler and Interpreter: 

Compiler

Interpreter

a.        Converts directly into object code

a.        Converts into intermediate form

b.        Translates Whole program at once

b.        It translates one by one line.

c.        Takes some time to generate output

c.        Instantly it gives output for each line, not for whole program

d.        Faster than interpreter

d.        Slower than compiler

e.        It is not required to translate the program each time you run.

e.        Each time it translates the program

f.         Most of the HLL have compiler

f.         Very less languages have interpreter

g.        Used by professionals

g.        By mostly beginners

h.        C,C++

h.        BASIC


Bugs:- While writing program, if a user does mistake then it is called bug. Mostly, a user (programmer) does following mistakes.

a)        Syntax error: An error which is related to syntax or done syntactically is called syntax error. It is easily found by compiler. After correcting all bugs we can re-run to get result. For e.g.

In a language ‘C’,

 {

printf(“hello world”)

}

Here, we have done syntax mistake because according to rule of C program, all the lines must be terminated by semi-colon. Here it is missing.

b)       Semantic error:- It is called logical error because the user does mistake in logic( expression, formula, data type etc). Computer runs the program and gives output but some like in-appropriate or not so correct (100%). It is unlike syntax where program does not run until the bugs are removed. In this case the program runs without any problem but we get what we should not. It is really very problematic. To be more clear, let’s see example in C.


{

int pi=3.14;

printf(“pi=%d”,pi);

}

Here, we have given 3.14 for PI but unknowingly we have given data type int, due to this data type, computer displays only 3, whereas the correct value is 3.14. This type error can not be highlighted by compiler and obviously we can not get help from compiler to remove this. No any method to find this. Suppose, if we going to write very complex program and if we do this type of mistake then just think; how long will it take to find bug! So we must be careful while writing program.

a)        Run time error: This type error comes into existence when a user runs program i.e executes. When a computer strikes with type of error, the program crashes, and does not respond. And some where our operating system also gets crashed and we have to restart our system. We get no output at all. The system does not display anything. Let’s see an example.

In language like ‘c’,

{

int a=90;

printf(“the quotient part is =%d”,a/0);

}

Here, the number is divided by zero which is a problem for computer. Because the computer does not know how to divide by zero. Similarly, if we have case of finding square root of negative numbers then same case occurs.

Comparison of syntax and semantic error:


Syntax error

Semantic error

1.        Says about mistake happened in rule of program

1.        Says about mistakes happened in logical  meaning of line or statement.

2.        This error is highlighted by compiler or can be detected.

2.        This is logical error, so compiler does not highlight. Users have to find out themselves

3.        This error is not so problematic.

3.        But it is extremely problematic ie takes long time to find.

4.        Documentation is available.

4.        Documentation not available.

5.      It does not take more time to detect.

5.        It takes more time to detect and fix..

6.        No output until the bug gets corrected.

6.        Output can be but some like inaccurate.

7.        Syntactically correct does not mean semantically correct

7.        Semantically correct program can be syntactically correct.

Eg in C language under body line,

{

printf( “ hello world”)

}

Here, semicolon is missing.

Eg in C language under body line,

{

Int a=3,b=2;

printf(“ %d”,a/b);

}

Here the output has to be 1.5 but computer displays only 1.


Comparison of program and software:- 


Program

Software

a.        It says about set of instructions.

a.        It says about collection of many programs.

b.        It can be written by one programmer.

b.        It is made by a team.

c.        It contains limited lines.

c.        It contains large no. of lines.

d.        Not so time consuming.

d.        It is time consuming.

e.        It contains code only.

e.        It contains manual with documentation.

f.         Limited functionality.

f.         Wide range of functionality.

Eg in C under body line

{

Statement 1;

Statement 2;

}

A software can be

                                               

                                    Software

Winzip, Os, browser


Program statement:-

A statement is composed of many words/phrases/command which is used to carry out particular task. Like in QBASIC,

Cls

A=2

B=3

Print ” sum=”; a+b

End

Here, we can see that there are five lines called statements. Each has their own function. Similarly in ‘c’ under body line, we can write

{ int a=4;

Int b=9;

Printf(“ sum= %d”, a+b);

}

Here we can see three lines having some specified meaning.

 

Operator, operation, operand:

Operator:-

                In program, we use many symbols. Some symbols can be like +, -, * >= etc,. They are used to operate on data to carry out certain task. So this type of symbol is called operator. Eg

                                 If we write a+b then + is called operator operating on a and b. There are mainly three types of operator namely arithmetic (+, - etc), relational ( >=, <=, > etc) and logical ( &&,|| ! etc)

Operand:-

               Without data our program is nothing. So a data on which operator works or operates is called operand. Like, in previous example a+b, a and b are operand.

Operation:-

                  Simply, when we combine operand and operator, we go for certain action or just calculation. This is called operation.

Like, in A*B, we have both operator and operand. But in a whole expression, we are going to perform multiplication. So multiplication is an operation.

    

Program designing tools:-

                             When we go for software development process we use many phases step by step. Like problem defining, system analysis, feasibility study, system designing, coding, testing etc. During the design process, we use many tools to have a broad idea or clear presentation about a project and its target (objective) before coding. By using these tools we can know detail about problem, used data and processes sequentially and diagrammatically. There are many tools like Algorithm, Flow chart, Context diagram, DFD, Decision tree, Decision table etc.

                               Let’s have a one by one discussion.

                             Algorithm:

                                                   This is the first step or a tool which we apply while designing the system. It says about sequence of finite steps written in certain order manually by programmers to carry out job. While writing algorithm, we follow or use general English words which we use in our daily life. There is no particular rule for that. Mostly, it uses 4 units namely inputs, processes, storing and output. Let’s see an example to be clear.

General features of Algorithm:

·         Clear specification of input

·         Uses variables

·         Provides clear steps, processes, controls and specifications.

·         Uses subroutines.

Rules for algorithms:

1.  Finiteness

2.  Input if needed with processes should be shown

3.  Very simple language should be used

4.  The writer while writing algorithm should be keep in mind about program to be written after this.

 

An algorithm to get sum of two numbers:

Step 1: start

Step 2: get two numbers say a,b

Step 3: let sum=a+b

Step: 4 print sum

Step 5 stop


Flowchart: A very powerful tool which is used to depict the algorithm diagrammatically. Or graphical representation of algorithm is called flowchart. A flowchart can show and give us a bird eye view of algorithm. We can understand easily what an algorithm willing to say. While designing or drawing flowchart, we use many symbols like:




Advantages:

1.        Good means of communication.

2.        Effective analysis

3.        As Documentation tool

4.        Helps in debugging process.

Disadvantages”

1.        Time consuming.

2.        More space consuming

3.Difficult to maintain


eg. 1. to get sum of two numbers.






























2. flowchart to get greatest number out of two numbers.



Rules while drawing flowchart:

. Must start at start and end at oval symbol.

.clearly mention of input/outputs.

. always one arrow in and one out from each symbol except decision box.

.each part or statement should include  meaning inside.

Etc

Types of flowchart:-There are many types but here, we are going to talk about only two types.

a.        Program flow chart: A flow chart which says about sequence of flow of statements with different variables, inputs and outputs. It is oriented towards program. It contains many parts interconnected to each other logically. It serves as a tool between a designer and programmer. Programmers can use it very efficiently and easily while coding. Besides this, we can also use as a documentation for an application. For example, to show great number.




               System flowchart: a flowchart which says about a system rather than a single program, its internal components with their interlinking to each other, the flow of data in and out of system. This flowchart gives an overview of whole system with individual operations. In summarized and in detail form, we can get structure from top to bottom. Besides this, it also provides a logical and physical view of system. It reflects the relationship between some like major components and different devices. While designing a system, we additionally use some more symbols as shown below



for example: 1.

Flowchart showing process of cheque books.


2.Similarly, a cruise car’s flow chart can be represented as




Comparison of program and system flow chart:


System

Program

1.it gives broad overview about system.

1.It gives idea about program only.

2.system says about only interconnection of different and major components.

2.Program says about flow of instructions but not about system.

3.A system can have many small numbers of programs.

3.A program can be a part of system.

4.It is complex in nature.

4.It is less (simpler) than system.

5.It time consuming and made by system designer or a group like.

5.Having designed system, programmer/s go for coding individually.

6.It uses many other symbols besides programming symbols.

7.It uses very limited and simple symbols.

Eg. Banking system

Eg a computerized transaction by a customer.


Pseudo-code: Another powerful tool which can be used to represent our algorithm. Unlike algorithm, no symbols are used in this. But, we can use many English words very similar to a programming platform because it is made by using many languages like BASIC, FORTRAN and many others. So, programmers feel very ease and easily they can convert into programming without consuming more time. But we should not understand that it is a program! It is very closed to program. In this word “Pseudo code”, Pseudo means fake and means the codes are not original, they are fake.

                                             While writing fake code, we use some reserved words like: BEGIN, SET, GET, PRINT, IF…ENDIF, FOR..ENDFOR, DO…ENDDO, WHILE…ENDWHILE, REPEAT….UNTIL, SHOW, DISPLAY,HALT ETC.

             SAMPLES:

 BEGIN

SET a=0

SET b=5

LET sum=a+b

PRINT sum

HALT

Here used variables are: a,b and sum.

2.

SET a=0

SET b=5

For s= a to b

PRINT s

Endfor

HALT

Used variables: a,b and s


Control structures (Program logic):  When we write program and run on system, the execution occurs immediately. The execution of instruction sometimes has to be controlled by using many parts or blocks of statements to get desired output. This is called control structure. These are in built and very important part of programming field and programmers too. By using this we can glue the different parts like, “what a program is”, “what a program is going to do”, “what will happen if a particular condition satisfies and if does not satisfy” etc. this part is also called logic, Which is the heart of program, which makes the program sensible and meaningful. Mainly, we have three parts as a control structures or simply logics.


1. Sequence: Our program contains many lines of codes or instructions. This says about execution of lines one after another in a sequence or order. While writing program the codes should be in certain sequence to get desired output if not then we may get some like unexpected output. Flowchart can be used to represent like given below.      

flowchart

In QB,

cls

a=9

b=8

print “hello”

print a

print b

end

Here, we can see how a program executes written in QB. At first, first line gets executed then second and so on.

b) Selection: This logical part says about “selection of certain block of statements/parts/” but under certain condition. In our daily life also  we use this concept, don’t we? Let’s take an example; if I have Rs. 1000 then I would do this/that, if not, then nothing I will. So, you do not think that it’s simple to understand about selection. In our program, some where we have to use this concept very frequently. It can be represented by using flow chart as given below.

A sample program in QB/C looks like:

QB

C

Flowchart

Cls                                                                                   

A=2                                                                                    If a mod 2=0 then                                                             Print “even”                                                                                         Else                                                                                                     

           Print “odd”                                                          

Endif                                                                                                   

End


{

int a=2;

if(a%2==0)

{

printf(“even”);

}

Else

{

printf(“odd”);

}



we can see here how an execution takes place. At first the condition is tested ,if it is satisfying then many instructions one after another execute and if the condition does not satisfy then other instruction get executed.  

Just like if.... we can use other selection structure like if..else if,switch... etc if there are multiple conditions to be tested or included. they work in same manner as ‘if’ works as shown above.


C) Iteration (Looping):-It simply says execution of different statements/blocks again and again repeatedly under certain condition. When the condition dissatisfies, the execution stops. This is called iteration or looping. With the help of flowchart, we can represent as

flowchart

a simple ‘c’ code

In Programming, we write in following way under body line( in c).

for(i=1;i<=4;i++)

{

printf(“%d”,i);

Here, we can see how an execution occurs many times if the condition satisfies(  in same as in flowchart).














In above flowchart or code we can see that there is an entry point ,condition testing and then executing many instructions,this execution just goes on or repeats again and again after checking condition.when the condition becomes false the further movement or execution does not occur and  termination takes place.

For looping, we can use different other statements in same manner like while or do.. while or do...until etc. The working way and syntax are little bit different but we get same output.


Data types:-

To store data in program entered by user or some constants, we need some format to store in memory. This format is called data type. Or simply we can say a classification of different data which we use while writing the program. The data types are used by computer while accepting, processing, storing and outputting.

                                                             In general we have following data types mostly used by many programming platforms.

                             Integers:- An integer can be a whole number but not a fractional number. It can accept any + ve or –ve number.  It is very common type of data used by computer. When we add/subtract/divide/multiply, we get integer but if output is in fractional, the system just truncates that decimal part and returns only integer part. Like 1+2 yields 3. 3 divided by 2 yields 1. For this data type in some language, we use some suffix like % or word like ‘int’.

                            

          Floating part:- If we are going to write a program which includes some like fraction type of data then we use this data type. Like, 1.23, -.34.45 etc. the computers recognize the real numbers having fractions easily and processes accordingly. For float type of data, we use some words like ‘float’ and some where suffix like ! or #.

                            

                        Character type:- Simply a letter or a number or space or any other symbol which we use in program is called character. A single character is placed in a single quote like ‘a’ or ‘,’ or ‘1’ etc. but, if we combine many characters then we put inside double quote like “computer”, it has 8 characters. For this type, we use reserved word like ‘char’ in C and some where it is not needed.

                            

                       String type: A data type which contains many characters together and mostly put inside double quote (in most language) is called string. Like “computing” or “education” etc. for this, we use reserved word char with some index value. In C, we can write char name[20];. Here name is a string type of data and holds up to 20 characters.

                            

                                 Array type: Not the matter what we want to store, we can use concept of array. An array is data type which lets us to use or store many but same type of data by a single name. like, if we want to store 20 integer then we should write, int a [20], if we want to store float, we should use float a[20] or if that is string of many characters then just write char a[40]. It is very popular in programming while storing huge amount of data. While storing, it starts from index value 0. Like,

Int A[2]; means a[0], a[1] is going to store some data.

                         

                 Boolean: It’s that data type which does the operation on the basis of true (1) and false (0) outcome. It is used to create true/false statements. To create true or false statements, it uses some operators like OR, AND NOT. These all can be used to compare the values and to return either 0 or 1. Like, if we write A AND B, then our program compares A and B, if both are true (1) then it returns 1 else returns 0. 

Codes:-

             We know that our computer works on discrete way i.e. by using digital circuit working on two modes ON and OFF. These two states are represented by two values 1 and 0 respectively. The digital computer understands our instructions in binary form so whatever we enter, computer converts into binary and stores in register. Like, if we enter 5 in decimal; it is converted into 101 (binary form) by computer. Therefore, at least 4 bits code is required to represent the decimal numbers. There are different ways to present the discrete system in computer. Let’s see one by one.

 

Absolute binary code: There are many devices which work on analog signal. The incoming analog signal has to be converted into digital signal to be used by computer. Similarly, in our daily life we use ‘+’ for positive numbers and ‘-‘ for negative numbers. But in this absolute binary code system, the process is just opposite. I mean, for positive numbers, 0 is used and for negative numbers 1is used. Here 1 is called most significant digit (Left most digit in binary number) and LSB means least significant bit (right most digit.). so, this is code to represent given number in 0 and 1 form.

For eg, 510 is 101 in binary but can be written 00000101 and -510 can be 1 0000101

 

Binary coded decimal:- A code which is used to represent the decimal number in binary format. It works on 8-bits system. It is a simplest way to present all decimal numbers among all. There is a straight forward rule to present. For given decimal number, separate all individual digits and write their corresponding binay values. After this, make them four/four bits by adding bits (0) in front. Like, for a number 11 in decimal, we have binary value 1011. But in binary coded decimal, according to rule, having separated the digit and writing with four bits, it becomes 0001 0001.  

 

Alphanumeric code:- These codes contain not only numerical but also alphabets. Hence goes the name. For communication between 2 or more computers, one needs a binary based code which can represent the letters of the alphabets as well as the numbers. Common codes used for this have 7 to 8 bits /word and are referred to as alphanumeric codes. It uses 6-bits code system. But this is not enough to represent all the characters.

In a true alpha-numeric code numbers are assigned to all characters - no letters are used. This is so that computers can process the code. The best-known example of an alpha numeric code is ASCII, where the numbers 0 - 255 are assigned to all the standard letters (upper and lowercase having different codes) and the digits 1 - 0, as well as the other characters a keyboard can type.

A code which uses both letters and numbers is one such as Hexadecimal Code - this is a form of counting using 16 as a base instead of the more usual 10. The code uses 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 and then uses A for 10, B for 11, C for 12, D for 13, E for 14 and F for 15. 16 is represented in this code as 10. Hexadecimal allows decimal numbers of 0 - 255 to be represented by two characters.

 

ASCII code:- It is an acronym of “American Standard code for Information Interchange”. It is latest coding system used by almost all computing system. In ASCII, every letter, number, and punctuation symbol has a corresponding number, or ASCII code (from 1 to 127). For example, the character for the number 1 has the code 49, capital letter A has the code 65, and a blank space has the code 32. This encoding system not only lets a computer store a document as a series of numbers, but also lets it share such documents with other computers that use the ASCII system. Documentation files or program source code files are usually stored as ASCII text. In contrast, binary files, such as executable programs, graphical images, or word processing documents, contain other characters that cannot be normally displayed or printed, and are usually illegible to human beings. The standard ASCII character set uses just 7 bits for each character. There are several larger character sets that use 8 bits, which gives them 128 additional characters. The extra characters are used to represent non-English characters, graphics symbols, and mathematical symbols. But now-a-days, it is using b-bits code. The last one is used for parity.

 

EEBCDIC:- A code which stands for Extended Binary-Coded Decimal Interchange Code and developed by IBM for its larger operating system is mostly used on IBM machines to represent characters as numbers. This code works on 8-bit system for entered number of data and provides 256 (28) different characters. It uses same character as ASCII but codes (bits) are different for different characters. The first 4 bits are called zone bits and last 4 bits are for digit values. For example,

                          1----------------------------------------à 1111 0000 (EBCDIC)                                                                                                                    

                                    2-------------------------------------à1111 0010

 

UNICODE:- Computer works with numbers. They store letters and other characters by assigning a number for each one. Before Unicode was used, there were many encoding systems but no single encoding technique could contain enough characters. So remove this problem, the concept of Unicode generated by Unicode Consortium, which is a non-profit organization.

Unicode provides a unique number for every character, no matter what the platform, no matter what the program, no matter what the language. Unicode enables a single software product or single web-site to be targeted across multiple platforms, languages and countries without re-engineering.it allows data to be transmitted through many different systems without corruption. 

The Unicode standard is designed to support the worldwide interchange, processing and display of the written text of diverse language and technical disciplines of modern world. Unlike others, the Unicode works on 16 bits, i.e. for each one character, it uses 16 bits. So totally it can have more than 65000 characters (216). Due to having of this much character, we can say it is a bit killing English language and other European and Asian languages.


5 comments:

  1. minecraft java This particular is usually apparently essential and moreover outstanding truth along with for sure fair-minded and moreover admittedly useful My business is looking to find in advance designed for this specific useful stuffs…

    ReplyDelete
  2. Practising C, C++ And Java Programming With Examples: Programming Concept(Theory Part Only) >>>>> Download Now

    >>>>> Download Full

    Practising C, C++ And Java Programming With Examples: Programming Concept(Theory Part Only) >>>>> Download LINK

    >>>>> Download Now

    Practising C, C++ And Java Programming With Examples: Programming Concept(Theory Part Only) >>>>> Download Full

    >>>>> Download LINK F6

    ReplyDelete
  3. Thanks for sharing this helpful blog with us, I found this really helpful.
    If you are looking for Online tuition for Computer Science then Ziyyara is the right choice. Thank you and keep sharing these kind of blogs.

    ReplyDelete