CS05144Notes-2

download CS05144Notes-2

of 4

Transcript of CS05144Notes-2

  • 8/12/2019 CS05144Notes-2

    1/4

    INTRODUCTION TO COMPUTERS

    MR UPENDRA MECHANICAL DEPARTMENT 1

    Programming Language:

    A programming language serves as a translator thatenables communication between you and your computer. Thecomputer understands only the machine language.

    A computer programming Language is a mediumthrough which we deliver our instructions to be subsequently

    converted into the machine language to enable the computerunderstand our requirements and generate the output which isagain translated by the programming language into a language weunderstand.

    This is done through two components contained in theprogramming language itself.

    The 2 components are:-

    Compiler and

    Interpreter

  • 8/12/2019 CS05144Notes-2

    2/4

    INTRODUCTION TO COMPUTERS

    MR UPENDRA MECHANICAL DEPARTMENT 2

    Compiler:

    A compiler is the software which translates an entireprogram into the machine language that the computer can executedirectly.

    Interpreter:

    An interpreter is the software that reads the programand performs the tasks mentioned in the program without actually

    translating the program into machine code. An interpreter executessingle line of code at a time.

    The Compilerand Interpreterare themselves softwarewritten in same programming language.

    Program:

    A Program is a set of instructions for performing a particulartask.

    Source program:

    A program can be written in assembly language as wellas high-level language. This written program is called a sourceprogram.

  • 8/12/2019 CS05144Notes-2

    3/4

    INTRODUCTION TO COMPUTERS

    MR UPENDRA MECHANICAL DEPARTMENT 3

    Object program:

    The source program is to be converted to the machinelanguage, which is called as object program.

    Interpreter:

    An interpreterreads only one line of a source programat a time and converts it to the object codes. Incase there areerrors; the same will be indicated instantly.

    The disadvantage is that it consumes more time forconverting a source program to an object program.

    Compilers:

    A compiler reads the entire program and converts it tothe object code.

    It provides errors not of one line but errors of the entireprogram. Only error free programs are executed. It consumes littletime for converting a source program to an object program. Whenthe program length for any application is large, compilers arepreferred.

  • 8/12/2019 CS05144Notes-2

    4/4

    INTRODUCTION TO COMPUTERS

    MR UPENDRA MECHANICAL DEPARTMENT 4

    Testing and Debugging:

    We are checking to see if our algorithm gives the desiredresult or not.

    Hence, we are testing our algorithm. A set of values of a,b and c that we use for testing (e.g. a=2, b=3, c=5, is called a TestCase. as we test our algorithm for a possibility at a given time. Agroup of test cases makes up Test Data.

    If for any one of such condition, our algorithm gives anincorrect result, we say that there is a bug in the algorithm. It isanother name for an error. It is necessary then to correct this bug.I.e. change the algorithm and do a walkthrough again. Now thealgorithm should give correct result. This process of removing abug from an algorithm is called as debugging.