ICSE Class 10 Computer Applications Question 2 of 30

Solved Sample Paper 1 — Question 2

Back to all questions
2
Question

Question 1(ii)

Which of the following might make the Java compiler report a syntax error in a particular line of a program?

  1. The program is typed in the wrong font.
  2. The line contains a comma(,) instead of a dot(.).
  3. It is caused by Java runtime.
  4. Program takes too long to complete.
Answer

The line contains a comma(,) instead of a dot(.)

Reason — In Java, a comma is used to separate items in a list, such as in method arguments or variable declarations. If a dot is expected (e.g., for method calls or accessing object members), and we use a comma instead, it would result in a syntax error.