MCQ Practice Single Best Answer Topic: ICSE Computer Application - Class X - 2025 SPECIMEN QUESTION PAPER

Q Which of the following returns a String?

Question ID
#24260
Subchapter
ICSE Computer Application - Class X - 2025 SPECIMEN QUESTION PAPER
Action
Choose one option below

Choose Your Answer

Click an option to check whether your answer is correct.

  • A length()
  • B charAt(int)
  • C replace(char, char)
  • D indexOf(String)
Correct Answer: C

Explanation

(a) length()

  • For a String, length() returns an int (number of characters).
    ✅ Not a String.


(b) charAt(int)

  • Returns the character (char) at a given index.
    ✅ Not a String.


(c) replace(char, char)

  • Returns a new String with characters replaced.
    This one returns a String.


(d) indexOf(String)

  • Returns the int index of the substring (or -1 if not found).
    ✅ Not a String.

Share This Question

Share this MCQ with your friends or study group.