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]
2 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]2 years ago
5 0

Answer:

What programming language is this

Explanation:

You might be interested in
Scripting languages are distinguished by their ____ types.
vodomira [7]
I believe the answer is font.
3 0
3 years ago
When a business is using methods that help it use its time and resources the best they can, what are they exercising?
maria [59]
<span>B. Efficiency

(</span><span>effective training </span><span>techniques)</span>
3 0
3 years ago
Read 2 more answers
Joel has left his computer unattended while answering a phone call . A TV repairer in his house tries to surf through the applic
Triss [41]
<span>Joel is a victim of a security breech. By leaving his computer unattended and not locked, he allowed for another person to use his credentials to access (or attempt) to access information that would otherwise be restricted to him. The fact that the unauthorized person did not find the information he was seeking does not minimize the risk.</span>
5 0
2 years ago
The disk drive is a secondary storage device that stores data by _____ encoding it onto a spinning circular disk.
Lisa [10]
Magnetically





------------------------------
8 0
3 years ago
HELP PLEASE!!!Salman wrote a SMART goal for class. Part of the goal includes the fact that he will complete Ms. Murray's extra-
kirill115 [55]

Answer:

the answer is specific

Explanation:

5 0
3 years ago
Read 2 more answers
Other questions:
  • While trying to solve a network issue, a technician made multiple changes to the current router configuration file. The changes
    7·1 answer
  • Which of the following is a collection of honeypots used to present an attacker aneven more realistic attack environment?a. Padd
    6·1 answer
  • Describe some ways that you personally use information technologies differently than you did just a few years ago
    11·1 answer
  • Information technology has powerful effects on social behavior. Which of the following issues should NOT be expected when intera
    11·1 answer
  • A unique ability of people which sets them far apart from animals is:
    8·1 answer
  • SOLVE IN C:
    10·1 answer
  • If a file you are opening for appending does not exist, the operating system will detect the missing file and terminate the oper
    14·1 answer
  • What is the value of the variable named result after the following code executes?
    10·1 answer
  • How are 1gls different from 2gls​
    10·1 answer
  • WHAT ARE THE USES OF COMPUTER SCIENCE AND INFORMATION TECHNOLOGY
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!