Question: Which of the following is the correct way to find out the index of the second 's' in the string "She sells sea shells on the sea-shore" ?

Options

A : String str = "She sells sea shells on the sea-shore" ; int i; i = str.SecondIndexOf( "s" );

B : String str = "She sells sea shells on the sea-shore" ; int i, j; i = str.FirstIndexOf( "s" ); j = str.IndexOf( "s" , i + 1 );

C : String str = "She sells sea shells on the sea-shore" ; int i, j; i = str.IndexOf( "s" ); j = str.IndexOf( "s" , i + 1 );

D : String str = "She sells sea shells on the sea-shore" ; int i, j; i = str.LastIndexOf( "s" ); j = str.IndexOf( "s" , i - 1 );

Click to view Correct Answer

Previous ||

Strings - General Questions more questions

Which of the following statement is correct about a String....

Which of the following will be the correct output for....

If s1 and s2 are references to two strings then....

Which of the following statements are correct about the String....

Which of the following statements are correct?

The space required for structure variables is allocated on stack.

Creating empty structures is allowed in C#.NET.

Which of the following will be the correct output for....

Which of the following is the correct way of setting....

Which of the following is the correct way to define....

Arrays - General Questions more Online Exam Quiz

Floating Point Issues - General Questions

Attributes - General Questions

Classes and Objects - General Questions

Collection Classes - General Questions