1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Nana76 [90]
3 years ago
6

Assuming that s and t are Strings, which of the following code fragments are such that the value returned by s.indexOf( t ) befo

re 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
Computers and Technology
1 answer:
KengaRu [80]3 years ago
5 0

Answer:

What programming language is this

Explanation:

You might be interested in
A secret information for using email is ____________
babymother [125]

wekipedia \:

6 0
3 years ago
Read 2 more answers
Is the type of vision useful in sending motion and objects outside normal vision
nlexa [21]
Yes it is in fact it is usful
8 0
3 years ago
A digital _ Is a good place for students to read an out of print book
bonufazy [111]

Answer:

Library

Explanation:

7 0
3 years ago
Read 2 more answers
Greg works for an online games development company. He is not a net freak, but occasionally he visits online literature sites an
BartSMP [9]
Yes, because nobody is supposed to access non-work related sites during office hours
5 0
3 years ago
Read 2 more answers
In my 4.3 Code practice: Question 1.
Yuki888 [10]

Answer:

you have the (while) code in whenever it is greater than 0, print hug. if less than, then nothing so flip the inequality thing around again.

Hope this helps plz hit the crown

4 0
3 years ago
Other questions:
  • A. True
    8·2 answers
  • What is a search engine and how is it different from a browser?
    6·1 answer
  • ____ errors occur when a formula is written incorrectly, when a mistake is made with a decision condition, or when the wrong var
    11·1 answer
  • What type of hardware enables users to interact with a computer? Check all that apply. the CPU the hard disk drive the keyboard
    9·2 answers
  • The Circular Flow Model includes serveral actors. Which of the following is NOT listed in the Circular Flow Model?
    12·1 answer
  • What is a computer is a network?
    7·2 answers
  • Which of the following statements is false? a. As of Java SE 8, any interface containing only one method is known as a functiona
    6·1 answer
  • Fill in the blank with the correct response.<br> A _<br> is an unknown network.
    12·1 answer
  • The question is provided in the image below.
    15·1 answer
  • Olivia is an amputee who wears a prosthetic right hand. Which technology would most help her operate a computer?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!