ICSE Class 10 Computer Applications Question 19 of 30

Solved Sample Paper 2 — Question 19

Back to all questions
19
Question

Question 1(xix)

Assertion (A) next() can read the input only till the space.
Reason (R) next() only gets to the line break.

  1. Both Assertion (A) and Reason (R) are true and Reason (R) is a correct explanation of Assertion (A).
  2. Both Assertion (A) and Reason (R) are true and Reason (R) is not a correct explanation of Assertion (A).
  3. Assertion (A) is true and Reason (R) is false.
  4. Assertion (A) is false and Reason (R) is true.
Answer

Assertion (A) is true and Reason (R) is false.

Reason — Assertion (A) is true because the next() method reads input until it encounters a space character by default. Reason (R) is false because next() stops reading at the first whitespace character (which includes spaces, tabs, and line breaks), not just at line breaks.