Debugging, logic error, syntax error, program development life cycle, etc.

Answer the following Questions, Debugging, logic error, syntax error, program development life cycle, etc.

  • What is debugging?

Here we answer the following questions. Debugging is the process of finding and correcting errors also known as bugs. Errors can cause a problem in the software. Also because of errors software does not run properly. Once we remove the bugs from the software or program it will run smoothly.

 

  • What is a logic error?

A logic error is a term that refers to the errors in the program where there is a problem in logic. And it gives us a different output and not the excepted one. In logic error, it will give you output. And will not throw an error.

Lets take an example,
int a=20, b=10;
cout<<”Sum of A and B is: “<<a*b;
So here, it will give us the output but not the excepted one. Here we expect the output should be 30. But what we are going to have is 200. So this term is called a logic error.

 

  • What is a syntax error?

In simple words, if there is an error in the syntax then it is called a syntax error. And if there is an error in the syntax how can a program run. So in a syntax error, there is not the successful execution of the program can be seen.

Lets take an example,
int a=11;
cout<“Value of A is:”<<a
So here the cout syntax is wrong. It should be ‘cout<<‘. So the program will throw an exception at the run time. And thus this term is called a syntax error.

 

  • What are the phases of the program Development Life Cycle?

In the program Development Life Cycle, there are in total five Phases. Which are as follow:

      • Analyzing: In this phase, there is an analyzing of the resources and the requirement which is needed in the program.
      • Designing: This phase includes the designing of the project or software.
      • Coding: Here coding of the project is happening.
      • Testing and debugging: In this phase, there is testing as well as debugging means finding the error. And try to execute the code.
      • Implementation and Maintenance

 

  • What are the differences between run-time error and compile-time error?

Some differences in run-time and compile-time errors are:

      • There is a difference in the compiler. In Compile-time errors are detected by the compiler. But in the run time errors are not detected by a compiler.
      • The next difference is Compile-time errors are also known as static and early binding errors. And the run time errors are
      • known as dynamic and late binding error.
      • The last difference between them is Compile-time errors are easy to identify. But Run time errors are hard to identify.

 

 

Given the following set of tasks, create an algorithm to accomplish the following tasks. You may write algorithms using pseudo-codes or you can flowcharts. Answer the following Questions

  • Logging into your laboratory’s computer

Algorithm:

      • Start
      • Open Login Page
      • Fill Login Details.
      • Check login details.
      • If details are correct move forward or else go to step no 7
      • Verify username and password
      • End

 

  • Getting the sum of three numbers

Algorithm:

      • Start
      • Input three variables a,b and c. Also one variable to store sum i.e. ‘sum’.
      • Take a three-number input from the user.
      • Sum=a+b+c
      • Wait for execution
      • End

 

  • Getting the average of three numbers

Algorithm:

      • Start
      • Take four variables. a,b,c for numbers and one Avg.
      • Take three number inputs from the user.
      • Avg=a+b+c/3
      • Wait for execution
      • End

 

 

Also read, Provide an algorithm to solve recurrence and its complexity.

Share this post

Leave a Reply

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