What is a computer program and programming statement?

Concept of Program

A program is a collection of instructions or statements used to complete a set of tasks. It's a set of instructions that tells a computer how to complete a specific task. A statement is another name for instruction, and a program is made up of several statements. A program is made up of a core module and sub-modules, all of which are saved as files. Instructions may be found in some files, while data may be found in others.

Some examples of program files are:

  • Executable file (.exe or .com): This part of the program sends commands to the processor which then executes those commands of the file. The extension of their files is .exe or.com.
  • Dynamic Link Library file (.dll): This is a partial executable file that doesn't execute on its own. These files' commands are shared by multiple programs.
  • Initialization files (.ini): Configuration information like size and starting point of a window, the color of the background, user’s name, and so on is contained in this file.
  • Help files (.hlp or .chm): This file contains help information about the programs.

Features / Qualities of a Good Program

Integrity: It implies that the program's calculations must be extremely precise. For the supplied input, it must provide the intended output. It must complete the task in accordance with the specifications.

Clarity:The program should be easy to understand in order to facilitate future maintenance. This can be done by in-line or external documentation. In in-line documentation, the function of each piece of code is defined within the program itself. A separate report in the external documentation contains the working principle of each inside the application.

Simplicity: The program should be able to express the logic in a relatively straightforward manner. This feature enhances integrity and clarity. The same problem can be handled in two or more ways; nonetheless, the simplest solution must be chosen.

Efficiency: The program should have a good balance of time and space consumed; that is, it should execute as quickly as possible while requiring the least amount of memory.

Modularity: The program should be divided into logical, self-contained sections. If the entire program is broken down into smaller modules, it is much easier to grasp what is going on inside.

Generality: It should be adaptable and simple to use across a variety of platforms.

Robustness: As much as possible, the program should be fault-tolerant. A program cannot be completely error-free. As a result, it must be designed in such a way that, if an unavoidable condition arises, it can deal with it without crashing.

Security: A program must be secured enough so as to avoid tampering with unwanted people. All program flaws must be avoided to the greatest extent possible.

Documented:Documentation aids in the seamless running of the system for users, as well as future modifications and maintenance.

Differences between Program and Software:
Program Software
It is a set of instructions that instructs the computer to perform a specific job. It is a collection of instructions, programs, and data which instruct the computer on how to solve computer problems.
It is a component of the software. It is a logical unit driving the
computer system.
It is independent. To develop software, collections
of programs are needed.
A programmer creates programs. Software is created by groups of
programmers as a team.
It is not generally licensed for sale. It is generally licensed under a company.
It cannot be divided in accordance with needs and uses. It can be divided into various needs and uses like application software, utility software, system software, etc.
Example: SYS, FoRMAT.SYS, interest calculations, etc. Example: MS Word, Adobe Photoshop, Internet Explorer,

Concepts of Programming Statement

An instruction (also called code) written in the high-level language to do a specific task in a program is called a programming statement. Each programming statement instructs the computer to perform a certain activity, such as input, output, calculation, or logical decision-making. When a program is built, a single high-level statement may result in multiple machine-language instructions. Keywords, variables, operators, control structures, data types, library functions, user-defined functions, and so on can all be found in programming statements.

Image of computer programming

In programs, there are three different sorts of programming statements.

Simple statement: It's a single-line expression that's used to carry out an assignment, calculate, or test logical decisions, and it's a fundamental feature of a program.Example:
X=10 --> assign integer values 10 to X variable
a>=50 --> logical statement to check whether a is greater than or equals 50 or not.

Compound statement: A compound statement is defined as a statement that consists of two or more individual instructions.
A= l*b
where one instruction is for multiplication of l and b and another instruction is for assigning multiplication value to the variable A.

Control Statement: A Control Statement is a statement that affects the flow of execution of a program. Control statements, which are the basic building blocks of high-level languages, are also known as control structures. There are 3 types of control statements. They are Sequence, Selection, and Iteration (repetition).

Testing and Debugging:
Programs are not always perfect. Some programs have inherent restrictions that result in errors, which are referred to as bugs. Debugging is the process of detecting and repairing errors after they have been discovered. Debugging is the process of locating and correcting flaws in software. Testing is the process of ensuring that the program accomplishes the intended task. These two processes are crucial in the creation of a program, despite the fact that they are time-consuming.

There are several stages of testing. They are:

  • Unit testing involves the individual components’ testing.
  • Integration testing is the testing of individual components as they are assembled.
  • System testing involves the whole final form of program testing.
  • User acceptance testing involves the user testing the program to see that it is the result that is required.

Debugging is basically done to find:

  • Syntax error: The error which occurs when the instruction of the program does not match the structural rule of the programming language is called syntax error.
  • Semantic error: Semantic errors are the errors that cause the wrong output due to wrong calculation or wrong input of data.
  • Run-time error: Runtime error is an error that occurs during the execution or runtime of a program. Such errors appear when the computer is asked to divide by zero or when the variable is assigned a large value that is beyond its capacity. The program execution is terminated due to a run-time error.

Syntax and Semantics:

The rule that we use while writing code is called Syntax. The syntax is the grammatical rules of writing the programming statement. In other words, syntax is the rule that tells us whether a string is a valid program or not. The error which is detected by the computer if we violate the rule of writing a programming statement is called a Syntax error.

The rule that gives meaning to programs is called Semantics and the error which occurs in program logic is called Semantic error. It is also called logical error. The computer does not notice the semantic problem, and the compiler correctly compiles it. The problem is only seen after the program has been run and the incorrect output has been produced. As a result, finding the semantic or logical fault is extremely difficult because no effective approach for detecting logical errors has yet been discovered.

For example:

Statements Descriptions
I eat fruits. Syntactically & Semantically correct.
I eat a laptop. Syntactically correct but Semantically incorrect.
I eats laptop. Both Syntactically & Semantically incorrect.

Also, when a program is running, it is said to be at runtime and if any error occurs while the program is executing, it is called aRun-time error. For example: peripheral devices may not be turned on.

Post a Comment

Please do not enter any spam link in the comment.

Previous Post Next Post