Of the following, which is NOT a logical error?
Pick an option to check yourself, or open the answer below.
Show answer & explanation
Correct answer: D. Using commas instead of the two required semicolons in a for loop header
Explanation
Using commas instead of the two semicolons in a for header is a syntax error caught by the compiler, so it is not a logical error. Using = instead of ==, forgetting to initialize counters and dividing by zero are mistakes in the program's logic.
More Programming Languages and Computer Graphics questions
- Which statement is false?
- What does the following C function f() return? int f(unsigned int N) { unsigned int counter = 0; while (N > 0) { counter += N & 1; N = N >>…
- Consider the following recursive Java function: public static String F(int N) { if (N <= 0) return "-"; return F(N - 3) + N + F(N - 2) + N;…
- Match List I (programming terms) with List II (meaning). List I: A. JNDI, B. RMI, C. JDK, D. JRE. List II: I. Runtime support for running J…
- Match List I (programming paradigms) with List II (characteristics). List I: A. Imperative, B. Object-oriented, C. Logic, D. Functional. Li…
- Suppose you have eight black-and-white images taken with a 1-megapixel camera and one 8-colour image taken with an 8-megapixel camera. How…