ICSE Class 10 Computer Applications
Question 3 of 10
Solved 2022 Semester 2 Question Paper ICSE Class 10 Computer Applications — Question 3
Back to all questions6
Reason — indexOf() returns the index of the first occurrence of the specified character within the string and lastIndexOf() returns the index of the last occurrence of the specified character within the string. Since a string begins with index 0, the given methods are evaluated as follows:
"SUCESS".indexOf('S') + "SUCCESS".lastIndexOf('S')
⇒ 0 + 6
⇒ 6