ICSE Class 10 Computer Applications Question 4 of 30

Solved 2024 Question Paper ICSE Class 10 Computer Applications — Question 9

Back to all questions
9
Question

Question 1(ix)

What is the method to check whether a character is a letter or digit?

  1. isDigit(char)
  2. isLetterOrDigit()
  3. isLetterOrDigit(char)
  4. isLETTERorDIGIT(char)
Answer

isLetterOrDigit(char)

Reason — In Java, the method Character.isLetterOrDigit(char ch) is used to check whether a given character ch is either a letter (A-Z or a-z) or a digit (0-9).

Analysing Other Options:

  1. isDigit(char) – This method only checks if the character is a digit, not a letter.
  2. isLetterOrDigit() – Incorrect because this method requires a character parameter.
  3. isLETTERorDIGIT(char) – Java methods are case-sensitive, and method names follow camelCase. This method name does not exist.