1(v)
What is the output of the following statement:
“MONOPOLY”.lastIndexOf(‘O’);
- (a)1
- (b)3
- (c)2
- (d)5
Show SolutionHide Solution↓
5
Reason — In the string "MONOPOLY", the character 'O' occurs at indexes 1, 3, and 5 (indexing starts from 0). The lastIndexOf('O') method returns the last occurrence of 'O', which is at index 5.