Thursday, 25 March 2010

Identify two important features of a structured program.


Q: Identify two important features of that a program must satisfy to be called as a structured program.

Ans.: - First, a structured program uses three type of program constructs i.e. selection, sequence and iteration. Structured programs avoid unstructured control flows by restricting the use of GOTO statements. Secondly, structured program consists of a well partitioned set of modules. Structured programming uses single entry, single-exit program constructs such as if-then-else, do-while, etc. Thus, the structured programming principle emphasizes designing neat control structures for programs.

Explain about 'Structured Programming


Q: Explain about 'Structured Programming:
Ans:
  • A program is called structured
-        when it uses only the following types of constructs:
*        sequence,
*        selection, 
*        iteration
  • Unstructured control flows are avoided.(example GOTO statement)
  • Consist of a neat set of modules.
  • Use single-entry, single-exit program constructs.
  • However, violations to this feature are permitted:
-        due to practical considerations such as:
*        premature loop exit to support exception handling.
  • Structured programs are:
-        Easier to read and understand,
-        easier to maintain,
-        require less effort and time for development.
  • Research experience shows:
-        programmers commit less number of errors
*        while using structured if-then-else and  do-while statements
*        compared to  test-and-branch constructs.

Important advantages of structured programming.

Structured programs are easier to read and understand. Structured programs are easier to maintain. They require less effort and time for development. They are amenable to easier debugging and usually fewer errors are made in the course of writing such programs.