Back to home

Topics

1. What is a good program? Describe the factors which are considered to decide the goodness of a program ?

A Good Program means that it should produce correct and faster results, taking into account all the memory constraints. Quality of a good program depends upon the instructions that are given in program. So the instructions given in the program should be correct and meaningful.

Some of the characteristics used to decide the goodness of the program are described below

   i. Simplicity

  ii. Portability

 iii. Efficiency

 iv. Security

  v. Readability

 vi. Accuracy

vii. Modularity

viii. Reusability

i. Simplicity : A good program should be simple and easy to understand, The code of a program should be clear and based on an easy concept.

ii. Portability : The term portable means that a program could run on different platforms (operating system) or machines. Hence, a good program should be platform independent.

iii. Efficiency : It means the execution/processing time and memory utilization of a program both are less. Reason is that the processing time and memory usage are the two most important criteria for the measurement of performance a computer system.

Hence, a good program is designed in such a way that it takes the least amount of processing time and occupies the minimum memory space.

iv. Security : Security of a good program is that, it should be secure from bugs and threats coming from various sources, like Internet.

v. Readability : It should be ensured that the program is written in an easy way, so that it is readable and understandable to various users. If a program is written structurally, it helps the programmers or users to understand in a better way. It is advised to use a more user-friendly approach to write a program.

vi. Accuracy : The code of a program must be accurate and clear then only it will be able to generate the desired output. If the code is not accurate then the output produced will be meaningless.

vi. Modularity : Complex and large programs can be broken down into a number of sub-programs to perform sub-task (assigned jobs) independently.

viii. Reusability : It is ease with which software can be reused in developing other softwares. By reusing existing softwares, developers can create more complex softwares in a shorter amount of time.

2. What is an identifier?

Identifiers are user defined names. They are used to name things. A name is associated with a function or data object (constants and variables) and used to refer to that function or data object. Identifiers are made up of letters (A-Z, a-z), digits (0-9), and the underscore character ( _ ). They, however, must begin with a letter or underscore and not with a digit.

3. How to write comments in a program?

Comments are the entries in a computer program for the purpose of documentation or explanation. Comments are non-executable statements that are ignored by the compiler or interpreter and are not executed by the computer.

Comments are written to explain what each block of the program is doing .

Two types of comments used in programs are

1. Single Line Comment

A single line comment starts with // symbol.

For example,

           int y = 20 ; / / initialization

2. Multi Line Comment

A multiline comments starts with a /* symbol and ends with */ .

For example,

                 int a = 20; / / Here initialize the value of an integer type variable 'a' as 20*/.

3. What is the purpose of expression? Explain with an example.

Expressions are used to implement a particular task. It is a combination of Operators, Operands and Constants. Any expression used in the program should be understood by the user.

The followings are some of the points to be kept in mind while using expressions in a program.

(i) Use library functions to make programs more powerful

Example
           To find output = X6
           Output = X *X * X * X * X * X
           We can use output = power (X, 6)

(ii) Follow simplicity to maintain the clarity of expression

Example
          X = A+B – U +VY
          A-B   X+Y
Then, we can write
          X1 = (A+B) / (A-B)
          X2 = (U+V*Y) / (X +Y)
           X = X1 –X2

(iii) Avoid program tricks usage, whose meaning is difficult to understand by the user.

4. Write the steps involved in program development.

A program development process is the step by step process for converting the inputs into outputs. Some stages in program development process are given below

1. Analysis and Design

This is an important phase where all the requirements of the program are gathered and problems are cracked down.

An algorithm is formulated which gives the solution for the problem.

2. Coding

In this phase, programmer writes the code in a machine understandable language to solve the problem. The whole coding process depends upon the information obtained in above step.

3. Compile/ Syntax check

The process of converting the source code into the object code is called compilation. While performing this conversion the compiler also checks the program for any syntax or statement error. In the coding phase whichever language you have chosen for writing the source code, compiler for that particular language must be chosen for the compilation process.

4. Execute the Program

After compilation and rectifying all the syntax and semantic errors, the program needs to be executed. During this phase, the program instructions are carried out and hence this phase is also called the runtime.

5. Define Documentation :

Documentation refers to written description, specification, design code and comment, internal and external to a program, which make a program more understandable, readable and more easily modifiable.

6. Explain Modules of Documentation

Documentation Modules make information easily accessible to the user. Documentation modules are also known as manuals.

Some documentation manuals are given below

        i) Programmer Manual

       ii) System Manual

      iii) Users Manual

      iv) Operations Manual

       v) Standards Manual

      vi) Reference Manual

      vii) Installation Manual

7. Explain the four types of documentations.

1. User Documentation

User documentation simply describe how a program is used. It describe each features of the program, and assists the user in realizing these features. User documentation is used to constitute a contract specifying what the software will do.

A user documentation information like

       i) General description

      ii) Runflow description

     iii) Data flow description

     iv) Output specifications

     v) Program Run Instructions

     vi) Restart and Recovery Procedure

For example, A program is written to accept two numbers and print the biggest of two number and print the biggest of two number.

           # include

           void main ( )

              {

                   float A, B, C max ;

                   cout << "Enter 'two numbers" ;

                   cin>> a >> b;

                   cout << "\n" ;

                   if (a > =b)

                       max = a ;

                   else

                       max = b ;

                   cout << "The biggest number is " << max ;

              }

The user documentation for this program is given below:

General Descriptions. This program selects the biggest of the two numbers.

Run Flow. The program will prompt the user for entering two numbers.

          Enter two numbers

The user is allowed to enter two numbers as shown below

             Enter two numbers 4 5

Data Flow

                                 

Output Specifications. The program gives the biggest of the two numbers

     The biggest number is 5

Program Run instructions. Press + F9 to run the program.

Restart and Recovery Procedure. If syntax error is flashed, contact the programmer. If run-time error is flashed then restart the program and type float values between their range.

2. Technical Documentation (Programmer's Documentation)

It refers to different documents with product related data and information that are used and stored for different purposes. It describes various aspects of its intended operation. It includes comments, self documenting code, program formatting and written information that is outside the body of the source code. It also includes the history of the program development and subsequent modifications and user's manuals. It is also known as programmer's documentation.

There are two types of technical documentations

(a) Internal Documentation

Internal documentation is the code comprehension feature provided in the source code itself. Internal documentation can be provided in the code in several forms. The important constituents of internal documentation are the following

(i) Comments embedded in the source code.

(ii) Use of user-defined data types

(iii) Use of constant identifiers

(iv) Use of meaningful variable names

(v) Code indentation.

It includes self documenting code and formatting. Self documenting code is the source code that uses meaningful names for constants, variables and subprogram identifiers to clarify their meaning in the program. Good software development organizations usually ensure good internal documentation by appropriately formulating their coding standards and coding guidelines.

(b) External Documentation

External documentation  is provided through various types of supporting documents such as user's manual, software requirements specification document, design document, test document etc. A systematic  software development style ensures that all these documents are produced in an orderly fashion.

An important feature of good external  documentation is consistency with the code. We can say "Documentation which focuses on general description of the software code and is not concerned with its details is known as external documentation."

A sample for external documentation is given below,

3. Requirement Documentation

Documentation description of what a particular software does or shall do. It is also used as an agreement or as the for agreement on what the software shall do.

4. Architecture/Design Documentation

It is a written description of a software product, that a software designer writes in order to give a software development team overall guidance to the architecture of the software project.

8. What are the uses of documentation ?

Useful for technical personnel not only during & development, but also during operations and normal maintenance.

Essential during abnormal or urgent maintenance.

Very helpful in initiating and training.

Enables trouble shooting when the application system breaks down.

Essential for both internal and external control.

Ensures that all commitment and expectations are on record.

This becomes an useful interface between a technical personnel and non-technical personnel.

Documentation makes ease for any technical emergencies.

9. What you mean by Program Maintenance ?

Program maintenance refers to the modification or changes of a program, after it has been completed, in oder to meet changing requirements or to take care of errors that show up. A common perception of maintenance is that it merely involves fixing defects.

But program maintenance covers a wide range of activities including correcting coding and design errors, updating documentation and test data and upgrading user's support.

10. Explain Running and Debugging Programs.

Running a program is also known as executing process for finding whether the current coded program is running correctly or not and produces the output we want. It is an important step in program development by which a user ensures that the program code is correct and all their modules are working in a systematic manner.

Debugging is a process of finding and reducing the number of errors and defects, in a computer program. Debugger is a computer program that lets you run your program line by line and examine the values of the variables which are passed into functions.

It helps to figure out why a program is not running the way you expected i.e., the art of pinpointing a bug and fixing it is known as debugging and when all bugs are cleared out then the program code is said to be correct and error free.

A debugging process can be divided into three main parts

1) Identifying a Bug

It is the first step of debugging in which a user needs to focus on the program code and identify whether the code is infected by a bug or not. If a bug is serve to cause the program to terminate abnormally, the existence of a bug becomes obvious.

If the bug is minor and only causes the wrong results, it becomes much more difficult to detect the existence of a bug.

2). Classifying a Bug

This is an important step, which uses a bottom-up approach from the place where an has error occurred and analyzes the code to classify the type of bug occurred in a program.

3). Fixing the Bug

This is the straight forward step, after analyzing the original bug, in which you have to fix the bugs which causes a series of damages to your program and test the program after fixing it.

11. Write the General Debugging Methods methods used for debugging.

(i) Test the Methods. Methods should be properly checked and debugged before including them in the program.

(ii)Trace Code Blocks. Tracing should be done so that small errors can be detected. The parenthesis, comment marks (/*... */) and proper termination of statements should be checked.

(iii) Inserting of Debug Code. To avoid errors, debug code should be included in program. Debug code is computer code introduced to computer program to test for errors or to help determine the cause of error.

(iv) Testing of Program. Program should be tested in various conditions, as a program should work properly under different conditions without any problem.

12. Explain Error

An error is a flaw, fault or failure in a computer program that causes it to produce an incorrect or unexpected result, or to behave in unintended ways. Most bugs arise from mistakes and errors made by people in either a program's source code or its design, or in frameworks and environments used by such programs.

There are broadly three types of errors

1. Compile-time Error. All the errors that are detected and displayed by the compiler are known as compile-time errors.

Whenever the compiler displays an error, program will not be able to run. It is therefore necessary that we must fix all the errors
before we can successfully compile and program.

There are two categories of compile-time (i) Syntax errors (ii) Semantic errors.

i. Syntax Error.  A formal set of rules defined for writing a program in a particular language is not followed then the error generated by the compiler is known as syntax error. In other words, syntax errors occur when syntax rules of programming language are violated.

Some of the common examples of syntax are missing semicolon, parenthesis etc.

ii. Semantic Error. This type of compile time errors indicate an improper use of program statement. These errors occur when statements are meaningful. The word 'semantics' relates to meaning of words, sentences, or programs.

For example, use of an undeclared variable come under semantic errors.

2. Run-time Error

If an application is syntactically correct then it is compiled and translated into machine language and ready to be executed. Run-time errors occur during the execution of a program.

These errors will result in the abnormal termination of program. Some of the common examples of run-time errors are number division by zero etc.

3. Logical Error 

In case the program cannot give any error but still giving an incorrect output, it is due to logical errors. These errors occur due to mistakes of the programmer. This is the most difficult task to find and debug a logical error.

For example, when a wrong formula is used to calculate any mathematical expression then it gives a logical error.

Paid Users Only!
Paid Users Only!
Paid Users Only!
Paid Users Only!
Paid Users Only!
Paid Users Only!
Paid Users Only!
Paid Users Only!
Paid Users Only!
Paid Users Only!
Paid Users Only!
Paid Users Only!
Paid Users Only!
Paid Users Only!
Paid Users Only!
Paid Users Only!
Paid Users Only!
Paid Users Only!
Paid Users Only!
Powered By