General Concepts of Programming Methodology

Syntax Errors

Concepts of Programming Methodology

Programming is basically solving a particular problem by giving coded instructions to the computer. Furthermore, the whole scenario of the programming cycle involves writing, testing, troubleshooting, debugging, and maintaining a computer program. Moreover, a good program should have clarity and simplicity of expressions, should make use of the proper name of identifiers, contain comments, and have a proper indentation. Besides, it should be free from all types of errors such as syntax errors, run time errors, and logical errors.

Programming Process Cycle

The steps of programming are as follows:

Writing

This step involves writing the desired output of the code. besides, drawing a flowchart depicting all the steps from beginning to end. Then the programmer writes the first copy of the code on the programming software.

Testing

This step is about testing the code against the test cases. If the output is according to desired test cases, the code is correct.

Troubleshooting

After testing the program we perform the error correction in this step.

Debugging

It is the process of finding the exact location of the error in the code. Errors can be of different types such as syntax errors, run time errors, and logical errors.

Running

After all these steps the program is run to get the desired output.

What is an efficient program?

A program that gives the correct desired output for every input, including the wrong input is efficient. Moreover, it should produce correct results in less time and use less memory space. Besides, an efficient program should have clarity and simplicity of expressions, should make use of the proper name of identifiers, contain comments, and have a proper indentation. Besides, it should be free from all types of errors such as syntax errors, run time errors, and logical errors. Here, we will study syntax errors in detail.

Running and Debugging Programs

After writing a program, we need to run and test the program. Testing means running each instruction and checking the validity of output. Furthermore, after testing we can know about the errors in the program. Besides, then we can solve and correct these errors and make the program error-free. We can do this by debugging the program. This means finding the location of the error and then resolving it by making necessary changes. There can be several types of errors therefore, running and debugging programs are necessary.

Browse more Topics Under General Concepts of Programming Methodology

Syntax Errors

We can define these types of errors basically as grammatical errors. Like in any other language, each programming language has its own set of rules and way of writing the program. Moreover, these rules are per the grammar of each programming language. Furthermore, if the programmer violates any of these rules this is the syntax error. These errors can be as follows:

  • missing semicolons
  • unbalanced parenthesis
  • missing operators
  • indentation
  • error in the structure of the program

Besides, most of the IDEs (Integrated Development Environments) identifies such errors while you are writing the program. Therefore, you can correct them at the spot only else, the compiler detects the error and notifies during compilation.

For example,

                    

int a;

print("value of variable a is",a)



Here, ';' is missing from the print statement.

Hence, the compiler gives the error and doesn’t show the output until we rectify it.

Frequently Asked Questions (FAQs)

Q1. What is the running and debugging of programs?

A1. Running is to run the program to get the output. While debugging is finding the location of an error.

Q2. Name the types of errors.

A2. Types of errors are as follows:

  • Syntax error
  • Logical/Semantic error
  • Runtime error

Q3. State true or false:

A semantic error is the violation of syntax rules of a programming language.

A3. False, this type of error is the syntax error, not the semantic error.

Q4. Find the syntax error in the following code.

                    

int a=1, b=3;

if(a>b)

{

printf ("yes");

else

{

printf ("no");

}

A4. Missing braces in the ‘if’ block.

Q5. List some possible syntax errors.

A5. Certain syntax errors can be as follows:

  • missing semicolons
  • unbalanced parenthesis
  • missing operators
  • indentation
  • error in the structure of the program

Q6. What is a syntax error?

A6. We can define these types of errors basically as grammatical errors. Each programming language has its own set of rules and ways of writing the program, if the programmer violates any of these rules this is the syntax error.

Share with friends

Customize your course in 30 seconds

Which class are you in?
5th
6th
7th
8th
9th
10th
11th
12th
Get ready for all-new Live Classes!
Now learn Live with India's best teachers. Join courses with the best schedule and enjoy fun and interactive classes.
tutor
tutor
Ashhar Firdausi
IIT Roorkee
Biology
tutor
tutor
Dr. Nazma Shaik
VTU
Chemistry
tutor
tutor
Gaurav Tiwari
APJAKTU
Physics
Get Started

Leave a Reply

Your email address will not be published. Required fields are marked *

Download the App

Watch lectures, practise questions and take tests on the go.

Customize your course in 30 seconds

No thanks.