FUNDAMENTALS OF COMPUTER

COMPUTER PROGRAMMING FUNDAMENTALS

PROGRAMMING LANGUAGES

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
A program may never contain both syntax and logic errors.
A
False
B
True
C
Either A or B
D
None of the above
Explanation: 

Detailed explanation-1: -A program can contain both syntax and logic errors. Q. Which statement best describes logic errors? An error in a program that causes it to produce incorrect ouputs but not a crash.

Detailed explanation-2: -A syntax error occurs when we make a mistake in our coding, such as forgetting a semicolon to indicate the end of a statement. A logic error is harder to find. This occurs when we have all the correct syntax but we coded a portion of the program with an error, such as maybe, divide by zero.

Detailed explanation-3: -Logic errors, like syntax errors, also prevent a program from running in its intended fashion, but a program with a logic error is capable of running until completion. Generally, a program with a logic error creates an incorrect or undesirable output.

Detailed explanation-4: -Since computer programs must follow strict syntax to compile correctly, any aspects of the code that do not conform to the syntax of the programming language will produce a syntax error. A logic error (or logical error) is a ‘bug’ or mistake in a program’s source code that results in incorrect or unexpected behaviour.

There is 1 question to complete.