Which of the following is true regarding Java syntax and semantics?

Which of the following is true regarding Java syntax and semantics?

a) a Java compiler can determine if you have followed proper syntax but not proper semantics
b) a Java compiler can determine if you have followed proper semantics but not proper syntax
c) a Java compiler can determine if you have followed both proper syntax and semantics
d) a Java compiler cannot determine if you have followed either proper syntax or semantics
e) a Java compiler can determine if you have followed proper syntax and can determine if you have followed proper semantics if you follow the Java naming convention rules


Answer:  a.

Explanation:  Compilers for all languages have the ability to detect syntax errors because improper use of the syntax leads to situations where the compilers cannot translate the code properly.  However, compilers are unable to follow the semantics of a program because this requires a degree of understanding what the program is intended to do and computers have no sense of understanding (at least at this point).


Java

Learn More Multiple Choice Question :