Computer Science, asked by greenbuzz1122, 4 months ago

Three examples of logical error and Three examples of syntax error​

Answers

Answered by shoyamroka43
0

Answer:

A logic error (or logical error) is a mistake in a program's source code that results in incorrect or unexpected behavior. ... For example, assigning a value to the wrong variable may cause a series of unexpected program errors. Multiplying two numbers instead of adding them together may also produce unwanted results.

Explanation:

Syntax errors are mistakes in using the language. Examples of syntax errors are missing a comma or a quotation mark, or misspelling a word. MATLAB itself will flag syntax errors and give an error message.

Answered by Aryan257553
0

Answer:

Example 1: Errors in the performed computation:

public static int sum(int a, int b) {

 return a - b ;

}

// this method returns the wrong value wrt the specification that requires

// to sum two integers

Example 2: Non termination:

String s = br.readLine();

while (s != null) {

 System.out.println(s);

}   // this loop does not terminate.

Syntax errors are mistakes in using the language. Examples of syntax errors are missing a comma or a quotation mark, or misspelling a word. MATLAB itself will flag syntax errors and give an error message.

Similar questions