answersLogoWhite

0


Best Answer

Answer:

Syntax Error - Occurs when the code isn't formatted or typed correctly. i.e. In python, typing If instead of if because it only recognizes lowercase.

Logical Error - Occurs when there is a fallacy of reasoning. i.e. In python, typing if x < 0 and x > 5. Since a value can't be less than 0 and greater than 5, a logical error will occur.

Answer:

a) Syntax Error

Definition : An error cause by violation of the programming language used.

Symptoms : Code fails to compile (error message from compiler)

b) Logical Error

Definition : An error caused by violation of logic (range, comparison, etc.). This error will NOT crash the program.

Symptoms : Unexpected output

c) Runtime Error/Execution Error

Definition : Any error, normally logical error that cause the program to crash.

Symptoms : Program crashes.

User Avatar

Wiki User

9y ago
This answer is:
User Avatar
More answers

User Avatar

Wiki User

16y ago

A syntax error means that a language was used incorrectly: if you forget to put certain symbols in source code, the machine will not be able to read it. A logic error means though the language was used correctly, there was a misunderstanding: if you want a, where b=c+a and you give a = b-a instead of a = b-c, then you will get the wrong answer, but have used the correct language.

This answer is:
User Avatar

User Avatar

Wiki User

15y ago

The compiler doesn't. A syntax error is the type of error a compiler will detect and tell you about. A logic error means that you made a mistake in implementing your algorithm, and you won't notice it until you decide to test your program to make sure it's working as expected.

This answer is:
User Avatar

User Avatar

Wiki User

8y ago

Syntax errors are compile time errors while logic errors are runtime errors. A syntax error is essentially a statement that makes no sense to the compiler, such that the program will not compile. This could be something as simple as a typo, but can be anything that breaks the language "grammar", such as using a type that has not yet been defined or using a variable that has not yet been declared.

A logic error is a runtime error that causes the program to misbehave, producing errant output. There are many causes of runtime errors, but ultimately it is simply a breakdown in your logic or reasoning. Programs often contain assumptions, but it pays to always test those assumptions with assertions, preferably with static assertions which can be tested at compile time. In this way you not only test your logic, you also document your reasoning, which leads to cleaner and more readable code. Never use a comment to demonstrate your logic because compilers simply do not understand comments (they are ignored). Also, if a function or class may throw an exception, always assume that it will throw that exception and handle it accordingly.

This answer is:
User Avatar

User Avatar

Wiki User

13y ago

A syntax error is an error in your code which the compiler (or pre-compiler) cannot parse. It is a type of compile time error.

If your program compiles without error and an issue appears at run time (such as a bad upwards polymorphic cast) that prevents the program from continuing that is a run time error.

This answer is:
User Avatar

User Avatar

Wiki User

8y ago

Syntax errors occur at compile time. Logic errors occur at runtime.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the differences between a logical error and syntax error?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

How do you correct syntax error logical error?

Your IDE should include syntax checking, which highlights errors as they occur (similar to a grammar/spell checker in a word-processor). Attempting to compile a program that contains a syntax error will fail to compile, but it should provide a list of all the errors that need to be fixed. If the error is an obvious one, the error list may include a solution to the problem, but you must make the necessary changes manually -- the syntax checker won't modify any code for you, even if the error is an obvious one, such as using . instead of -&gt; on a pointer.


What is error 601?

On a RadioShack TRS 80, It is a Syntax Error "Syntax Error 601"


Any violation in the syntax of a program statement is called logic error?

No. A violation in the syntax of a program statement is called a syntax error.


Is syntax error a compilation error?

Not entirely. A compilation error can contain a syntax error, but what a syntax error actually is, is an error in how the coding is spelled. For example, say you are trying to program a router. You type in the code, of which you know it's the correct code, but receive an error. You proofread the code and notice that one or more of the words are not spelled correctly. This would be a syntax error. They can also take the form of misplacing the words in the code's syntax.


Difference between semantic error and logical errors?

Syntax Error: error due to missing colon, semicolon, parenthesis, etc. Syntax is the way in which we construct sentences by following principles and rules. Example: In C++, it would be a syntax error to say int x = "five"; This will not compile because it does not follow the syntax of the language and does not make any sense to the compiler. Semantic Error: it is a logical error. it is due to wrong logical statements. Semantics is the interpretations of and meanings derived from the sentence transmission and understanding of the message. Semantics errors are Logical, while Syntax errors are code errors. Example: A semantic error would compile, but be incorrect logically: const int pi = 12345; Your program will likely compile and run without error but your results will be incorrect. (Note that these types of errors are usually much harder to debug)

Related questions

What is difference between syntx error and logical error?

A syntax error is when you break the grammar rules of the language, such as forgetting to terminate a C++ statement with a semi-colon. A logical error is when your code does not perform as expected, typically due to an assumption that proves to be incorrect.


What is the difference between a compilation error and logic error?

errors which come during compilation is known as compilation error. here we get syntax errors only not logical errors like division by zero. logical error occur during run time example:if you write a program for division with zero you will not get compilation error but during execution you will error


How do you correct syntax error logical error?

Your IDE should include syntax checking, which highlights errors as they occur (similar to a grammar/spell checker in a word-processor). Attempting to compile a program that contains a syntax error will fail to compile, but it should provide a list of all the errors that need to be fixed. If the error is an obvious one, the error list may include a solution to the problem, but you must make the necessary changes manually -- the syntax checker won't modify any code for you, even if the error is an obvious one, such as using . instead of -&gt; on a pointer.


What is the syntax error and logic error?

Syntax Error - Occurs when the code isn't formatted or typed correctly. i.e. In python, typing If instead of if because it only recognizes lowercase. Logical Error - Occurs when there is a fallacy of reasoning. i.e. In python, typing if x &lt; 0 and x &gt; 5. Since a value can't be less than 0 and greater than 5, a logical error will occur.


Difference between syntax error and execution error?

Syntax error is when something is wrong with how a code is written. An execution error occurs when the program comes up to something that it cannot handle because it does not have the code for it.


What is error 601?

On a RadioShack TRS 80, It is a Syntax Error "Syntax Error 601"


Differences between fraud and error?

differences between errors and frauds


Any violation in the syntax of a program statement is called logic error?

No. A violation in the syntax of a program statement is called a syntax error.


Is syntax error a compilation error?

Not entirely. A compilation error can contain a syntax error, but what a syntax error actually is, is an error in how the coding is spelled. For example, say you are trying to program a router. You type in the code, of which you know it's the correct code, but receive an error. You proofread the code and notice that one or more of the words are not spelled correctly. This would be a syntax error. They can also take the form of misplacing the words in the code's syntax.


What are the ratings and certificates for Syntax Error - 2003?

Syntax Error - 2003 is rated/received certificates of: Australia:M


Difference between semantic error and logical errors?

Syntax Error: error due to missing colon, semicolon, parenthesis, etc. Syntax is the way in which we construct sentences by following principles and rules. Example: In C++, it would be a syntax error to say int x = "five"; This will not compile because it does not follow the syntax of the language and does not make any sense to the compiler. Semantic Error: it is a logical error. it is due to wrong logical statements. Semantics is the interpretations of and meanings derived from the sentence transmission and understanding of the message. Semantics errors are Logical, while Syntax errors are code errors. Example: A semantic error would compile, but be incorrect logically: const int pi = 12345; Your program will likely compile and run without error but your results will be incorrect. (Note that these types of errors are usually much harder to debug)


What is an Example of syntax error?

date