ICSE Class 10 Computer Applications Question 40 of 46

String Handling — Question 4

Back to all questions
4
Question

Question 4

The indexOf() method returns the position of the ............... .

  1. first occurrence of the specified character
  2. last occurrence of the specified character
  3. null character
  4. '\n' character
Answer

first occurrence of the specified character

Reason — The indexOf() method returns the index (position) of the first occurrence of the specified character in a string.