General Concepts of Programming Methodology

Runtime 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, runtime 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, runtime errors, and logical errors.

Running

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

Browse more Topics Under General Concepts of Programming Methodology

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 programs are necessary.

Runtime Errors

These types of errors are detected during the runtime. Moreover, such errors cause unusual termination of the program. Some examples of such errors are as follows:

  • dividing a number by 0
  • infinite loop
  • wrong input by the user

We can call such errors bugs. Moreover, they occur during the debugging of the program. There can be various such errors such as input/output errors, undefined object errors, division by zero errors, etc.

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.

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.

Difference between Compile-time Errors Runtime Errors

The differences between compile time and run time errors are as follows:

Compile-time Errors Runtime Errors
  • Such errors are syntax errors. Moreover, the compiler detects these errors itself.
  • Such errors are not detected by the compiler. Moreover, we get the wrong output due to these errors.
  • We cannot run the code successfully till we correct these errors. Therefore, they stop the program from running.
  • We cannot get the desired output until we correct these errors. Hence, they stop the program from producing correct results.
  • Examples can be a missing semicolon, missing braces, undefined identifiers, etc.
  • Examples can be division by zero, infinite loop, etc.

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. What are runtime errors?

A3. These types of errors are detected during the runtime. Moreover, such errors cause unusual termination of the program.

Q4. Give some examples of a runtime error.

A4. Some examples of such errors are as follows:

  • dividing a number by 0
  • infinite loop
  • wrong input by the user

Q5. What else can we name a runtime error.

A5. We can also call a runtime error a bug.

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.