MCQ Single Best Answer Easy

Q Which of the following returns a String?

ID: #24260 ICSE Computer Application - Class X - 2025 SPECIMEN QUESTION PAPER 66 views
Question Info
#24260Q ID
EasyDifficulty
ICSE Computer Application - Class X - 2025 SPECIMEN QUESTION PAPERTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A length()
  • B charAt(int)
  • C replace(char, char)
  • D indexOf(String)
Correct Answer: Option 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

Challenge a friend or share with your study group.