FUNDAMENTALS OF COMPUTER

COMPUTER PROGRAMMING FUNDAMENTALS

PROGRAMMING LANGUAGES

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Which of these pseudocode statements is an example of a logic error?
A
FOR x=0 TO 10 STEP-1
B
FOR x=0 TO 10 STEP 1
C
FOR x=10 TO 0 STEP-1
D
FOR x=0 TOO 10 STEP 1
Explanation: 

Detailed explanation-1: -Logic errors occur when there is a fault in the logic or structure of the problem. Logic errors do not usually cause a program to crash. However, logic errors can cause a program to produce unexpected results.

Detailed explanation-2: -A logical error is a mistake in reasoning by the programmer, but it is not a mistake in the programming language. An example of a logical error would be dividing by 2.54 instead of multiplying to convert inches to centimeters.

Detailed explanation-3: -A syntax error occurs when a programmer writes an incorrect line of code. Most syntax errors involve missing punctuation or a misspelled name. If there is a syntax error in a compiled or interpreted programming language, then the code won’t work.

Detailed explanation-4: -What is a syntax error? A6. We can define these types of errors basically as grammatical errors. Each programming language has its own set of rules and ways of writing the program, if the programmer violates any of these rules this is the syntax error.

There is 1 question to complete.