subject

Assuming that s and t are Strings, which of the following code fragments are such that the value returned by s. indexOf( t ) before the code is executed is equal to the value of the int n after the code is executed? I. int n = -1;
int tSize = t. length();
boolean found = false;
while ( !found && tSize <= s. length() )
{
n++;
if ( t. equals( s. substring( 0, tSize ) ) )
found = true;
else
s = s. substring( 1 );
}
if ( !found )
n = -1;
II. int n = -1;
int sSize = s. length();
int tSize = t. length();
boolean found = false;
while ( !found && n + tSize + 1 <= sSize )
{
n++;
if ( t. equals( s. substring( n, n + tSize ) ) )
found = true;
}
if ( !found )
n = -1;
III. int n = 0;
int sSize = s. length();
int tSize = t. length();
boolean found = false;
while ( !found && n + tSize <= sSize )
{
if ( t. equals( s. substring( n, n + tSize ) ) )
found = true;
n++;
}
if ( found )
n--;
else
n = -1;
A. I only
B. II only
C. III only
D. I and II only
E. I, II, and III

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 23:30
What are listed in the vertical columns across the top of the event editor? a. file names b. conditions c. check marks d. action types
Answers: 1
question
Computers and Technology, 23.06.2019 02:00
For a typical middle-income family, what is the estimated cost of raising a child to the age of 18? $145,500 $245,340 $304,340 $455,500
Answers: 1
question
Computers and Technology, 23.06.2019 13:30
Spoons are designed to be used for: spring hammering. applying body filler. identifying high and low spots. sanding highly formed areas.
Answers: 3
question
Computers and Technology, 23.06.2019 23:00
How do you know if the website is secure if you make a purchase
Answers: 2
You know the right answer?
Assuming that s and t are Strings, which of the following code fragments are such that the value ret...
Questions
question
Mathematics, 03.08.2019 03:40
question
Mathematics, 03.08.2019 03:40
question
History, 03.08.2019 03:50
question
History, 03.08.2019 03:50
Questions on the website: 13722359