Strings

Q1:
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"?

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);

E
String str = "She sells sea shells on the sea-shore"; 
int i, j;
i = str.IndexOf("S"); 
j = str.IndexOf("s", i);

ANS:C -

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

No answer description is available. Let's discuss.



img not found
img

For help Students Orientation
Mcqs Questions

One stop destination for examination, preparation, recruitment, and more. Specially designed online test to solve all your preparation worries. Go wherever you want to and practice whenever you want, using the online test platform.