answersLogoWhite

0

Example of semantic errors

Updated: 12/20/2022
User Avatar

Wiki User

11y ago

Best Answer

scores = [51, 47, 53, 97, 27]

summation = 0.0

for score in scores:

summation *= score # Semantic Error.

average = summation / len(scores)

print average # Isn't average. average == 0

User Avatar

Wiki User

11y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

13y ago

if (x==0 && y/x>0) printf ("Oops");

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Example of semantic errors
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

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 a semantic error in vb and give examples?

An example of semantic error is: a+b = c.


What is a semantic web?

The word semantic stands for the meaning of. The semantic of something is the meaning of something. The Semantic Web is a web that is able to describe things in a way that computers can understand.


What is Semantic errors in c?

A semantic error is a logic error. That is, the code may compile and run, but does not perform as you intended. Some semantic errors can be picked up by the compiler, often shown as warning, such as: if (x = 5) // warning: did you mean x == 5? Others are simply impossible for the compiler to spot: int x, y, z; // ... ++z; // add 1 to x In the above code, we meant to increment x, but incremented z instead. The compiler won't notice the error so this will inevitably lead to a runtime error.


What are Semantic errors in a programming language?

Semantic or Syntax errors are errors in the way a programmer has written his code. The code does not conform to language standards and is incorrect. Ex: for(int i = 0, i++, i<10) { } The above is a syntactically incorrect declaration of a for loop in Java. The compiler would not let you compile this code successfully.

Related questions

What are the example of semantic noise?

What are the examples of semantic noise What are the examples of semantic noise


What is lexical and semantic errors?

cars was


How do you understand errors?

Errors are bugs or mistakes.It coulb be syntax or semantic in nature.


How computer handle semantic error?

Semantic error are logical errors. That does mean, it would compile and run without errors. But, the output would be different from the expected output.


Is an adjective before a noun an example of a semantic syntax or linguistic relativity?

no.


What The sun is 93 million miles away is an example of?

Semantic memory


What an example of the sun 93 million miles away?

semantic memory


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 does semantic mean?

semantic:


What is a semantic error in vb and give examples?

An example of semantic error is: a+b = c.


In 1492 Columbus sailed the ocean blue is an example of?

B. semantic memory.


What is example of semantic clues?

Examples of semantic clues include words or phrases within a sentence that provide context or meaning to help readers understand the overall message. For instance, words like "before," "after," "similarly," and "therefore" can offer clues about the relationship between different ideas in a text. Additionally, specific vocabulary related to a topic can provide semantic clues about the subject matter being discussed.