

MCQOPTIONS
Saved Bookmarks
1. |
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. | <pre><code class="csharp">String str = "She sells sea shells on the sea-shore"; int i; i = str.SecondIndexOf("s");</code></pre> |
B. | <pre><code class="csharp">String str = "She sells sea shells on the sea-shore"; int i, j; i = str.FirstIndexOf("s"); j = str.IndexOf("s", i + 1);</code></pre> |
C. | <pre><code class="csharp">String str = "She sells sea shells on the sea-shore"; int i, j; i = str.IndexOf("s"); j = str.IndexOf("s", i + 1);</code></pre> |
D. | <pre><code class="csharp">String str = "She sells sea shells on the sea-shore"; int i, j; i = str.LastIndexOf("s"); j = str.IndexOf("s", i - 1);</code></pre> |
E. | <pre><code class="csharp">String str = "She sells sea shells on the sea-shore"; int i, j; i = str.IndexOf("S"); j = str.IndexOf("s", i);</code></pre> |
Answer» D. <pre><code class="csharp">String str = "She sells sea shells on the sea-shore"; int i, j; i = str.LastIndexOf("s"); j = str.IndexOf("s", i - 1);</code></pre> | |