Docsity

The basic concept of computer programming., Study notes of Computer science

Toggle sidebar
bg1
Page | 1
CONCEPT OF COMPUTER PROGRAMMING
Qno 01: Define Program and Programming.
Program:A program is a set of instructions that computer must follow in order to process
a data into the information.
The instructions consist of statements used in a programming language, such as BASIC,
Pascal or C.
Programming:Programming is both an art and a science. Programming, also called
software engineering, involves steps similar to any problem-solving task.
Qno 02: What is Programming Language? Discuss its different types.
Programming Language:
A programming language is a special language programmers use to develop software
programs, scripts, or other sets of instructions for computer to execute.
OR
A language for expressing a set of detailed instructions for a digital computer is called a
“Programming Language”.
Types of Programming Language:
All Computers Language can be classified in the following three levels or generations of
Programming languages:
1. Low Level Language/Machine Language.
2. Assembly Language.
3. High Level Language.
1. Machine Language (Low Level Language):
Every creation of this universe has its own language. Likewise, computer has a
language that is called Machine Language or Low Level Language for instructing
computer to perform specific task. It is also called binary Language because it is
the language of 0s and 1s,means every instruction in Machine Language consists
of a series of 0s and 1s (binary code) that computer can understand and execute
directly.
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download The basic concept of computer programming. and more Study notes Computer science in PDF only on Docsity!

CONCEPT OF COMPUTER PROGRAMMING

Qno 01: Define Program and Programming. Program: A program is a set of instructions that computer must follow in order to process a data into the information. The instructions consist of statements used in a programming language, such as BASIC, Pascal or C. Programming: Programming is both an art and a science. Programming, also called software engineering , involves steps similar to any problem-solving task. Qno 02: What is Programming Language? Discuss its different types. Programming Language: A programming language is a special language programmers use to develop software programs, scripts, or other sets of instructions for computer to execute. OR A language for expressing a set of detailed instructions for a digital computer is called a “ Programming Language ”. Types of Programming Language: All Computers Language can be classified in the following three levels or generations of Programming languages:

  1. Low Level Language/Machine Language.
  2. Assembly Language.
  3. High Level Language. 1. Machine Language (Low Level Language): Every creation of this universe has its own language. Likewise, computer has a language that is called Machine Language or Low Level Language for instructing computer to perform specific task. It is also called binary Language because it is the language of 0s and 1s,means every instruction in Machine Language consists of a series of 0s and 1s (binary code) that computer can understand and execute directly.

2. Assembly Language: In assembly language, the statements are written in symbolic codes (termed as mnemonics) that are easier for human to read and write as compared to machine language. Each assembly language statement corresponds to one machine language statement. 3. High Level Language: High Level language are closer to human languages than low-level language and include statements like GOTO and PRINT which are regular words. Unlike the assembly language, the program of high level languages do not have to be written for a particular computer, but it can be execute on any machine that has a compiler for that language. Qno 03 : What are the characteristics of a successful computer program? The characteristics of a successful computer Program are as follows: 1. Correct it does what it is supposed to do. 2. Usable it is easy to use. 3. Reliable it works without failing. 4. Understable it can be easily comprehended. 5. Modifiable it can be enhanced and updated. 6. Maintainable it can corrected when errors are found. 7. Flexible it can be modified to supply other information as required. 8. General it is not too specialized. 9. Efficient it does not waste computer resources. Qno 04 : Explain the steps in programming. The five main steps in the programming process are as follows (see Fig. 1):

  1. Defining the problem.
  2. Planning the solution.
  3. Coding the program.
  4. Testing the program.
  5. Documenting the program.

According to requirement a reasonable programming language is selected to implement the solution. Step 4: Testing the Program Once the program has been coded completely the next phase is the implementation. By the implementation the programmer comes to know the physical and logical errors which are supposed to be debug. The program is tested regarding all types of errors that are syntax errors, logical errors and runtime errors. The testing phase makes sure that the program fulfills the objectives which are required for the users. Step 5: Documenting the Program Documentation is a written detailed description of the programming cycle and specific facts about the program. Typical program documentation materials include the origin and nature of the program, a brief narrative description of the program, algorithm and flowcharts, data-record descriptions, program listings and testing results. Qno 05 : How many types of programming languages are there regarding structure? TYPES OF PROGRAMMING LANGUAGES REGARDING STRUCTURE: Computer languages have the following types regarding structure, instruction set & methodology of writing codes.

  • Procedure Oriented Language
  • Object Oriented Language
  • Visual Programming Language Procedure Oriented Language: Procedure Oriented Languages require programmers to solve programming problems using traditional programming logic that is programmers write the instructions in the sequence in which they must be executed to solve the problem. For Example: COBOL and Pascal.

Object Oriented Language: An object oriented languages uses classes and objects having specific properties and method for a comprehensive programming. It is a better approach than a procedure oriented language. For Example: C++, JAVA etc. Visual Programming Language: A Visual Programming Language provides a graphical or windows like environment for programming. It contains visual objects like text boxes, buttons, combo boxes, lists and forms etc. For Example: VB6.Net. Qno 06 : Write the differences between procedures oriented language and object oriented language. PROCEDURE ORIENTED LANGUAGE OBJECT ORIENTED LANGUAGE

1. Procedure oriented language takes a bottom-up approach in designing a program. Object oriented language follows a top- down approach. 2. Program is divided into small chunks based on the functions. Program is divided into objects depending on the problem. 3. Each function contains different data. Each object controls its own data. 4. Operator overloading is not allowed. Operator overloading is allowed.

Logical Error: The logical error is an error in planning the program’s logic. In this case, the language processor successfully translates the source code into machine code into machine code. The computer actually does not know that an error has been made. For example: You wanted to do the sum of A and B and put the result in the variable C, this is accomplished by typing: C = A + B But while typing, the programmer has however typed the following expression: C = A - B Such a program will run properly but will give unexpected result. Run Time Error: Runtime error occur when a program is run on the computer and the results are achieved due to some misinterpretation of a particular instruction. For example: Dividing a number by zero, which result in a very large value of quotient. Qno 09 : Explain the debugging process in detail. THE DEBUGGING PROCESS: The process through which a program can be made error free and properly functional is called debugging process. Several tools have been devised for finding and removing three types of errors as follows:

1. Desk Checking:

In the desk checking, a programmer checks a printout of the program while sitting at a desk, the programmer’s goes through the listing line by line looking for syntax, logic and runtime errors. In other words, desk checking is a sort of proof reading.

2. Manual testing with sample data:

Both correct and incorrect data are run through the program manually, not with a computer-to test for correct processing results. This is called dry run of program. If any error found then it is removed before further testing.

3. Structured walk-through:

A structured walk-through is a process in which three or four programmers including the creator of the program, review (walk-through) the program. They analyze it for completeness, accuracy and quality of design and then discuss their conclusions.

4. Attempt at translation:

The program is run through a computer, using a translator program. The translator attempts to translate the written program from the programming language (Such as C or Pascal) into the machine language of 1s and 0s. Before the program will run, it must be free of syntax errors. These syntax errors are identified by the translating program.

5. Testing sample data on the computer:

After all syntax errors have been corrected, the program is tested for logical errors in the program statements. We must plan the sample data carefully to make sure you test every part of the program. This step is sometimes called alpha-testing.

6. Run real-world data:

After testing with Sample data, the program may run fine in the laboratory. However, if the program going to be sold commercially. It is released to a selected set of users to be tested with real data called beta-testing. Qno 10 : What is language translator? Also explain its types. LANGUAGE TRANSLATORS: It translates the computer program into machine understandable form. Language translators are interpreter, compiler and assembler.

i. Interpreter:

Interpreter translates and executes each program statement one at a time, translation is required if program is run again. Example: GWBASIC.

ii. Compiler:

Compiler translates the whole program at a time and stores translated program on disk. The original program is called “Source Program” and its translated version is called “Object code”.

iii. Assembler:

Assembler is a program that converts an assembly language program into machine language.

Qno 13 : Write the difference between source code and object code. SOURCE CODE OBJECT CODE 1) Source code is written in high level or assembly language. 1) Object code is written in machine language through compilers. 2) Source code is easy to understand. 2) Object code is difficult to understand. 3) Source code is easy to modify. 3) Object code is difficult to modify. 4) Source code contains fewer statement than object code. 4) Object code contains more statements than source code.