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
How will the health care professions be affected by all the computerized and technical advances concerning disabilities?
goldenfox [79]

Answer: Technology has placed at the disposal of the healthcare community various potent tools to improve patient care. Since EHRs are easily available to physicians, they can access complete medical histories of patients and make the most well-considered medical decisions.

Explanation:

4 0
3 years ago
D. What is the work of the following features:<br>1. Foot note​
Bess [88]

Answer:

In footnotes, information is separated by commas, while in the bibliography, it is separated by periods.

In footnotes, the author's first name is listed first, while in the bibliography, the author's last name is listed first.

The titles of books and journals are put in italics.

The titles of articles are put in quotation marks.

All key words in titles are capitalized.

Explanation:

3 0
2 years ago
What are the data types used in C programming with examples
Zepler [3.9K]
I don’t really understand what you are trying to ask. Try posting a picture along with your question
5 0
3 years ago
Write a program that takes an integer n as a parameter and sums all of the multiples of 2 or 5 from 1 to n. For example, if n =
Alex

Answer:

// here is code in c++.

#include <bits/stdc++.h>

using namespace std;

// main function

int main() {

// variable

int num;

int tot_sum=0;

cout<<"enter a number: ";

// read the value of n

cin>>num;

// check the multiple of 2 or 5 from 1 to n

for(int x=1;x<=num;x++)

{

// if multiple of 2 or 5 then add them

   if(x%2==0 ||x%5==0)

   {

       tot_sum=tot_sum+x;

   }

}

// print the sum

cout<<"sum of multiple of 2 or 5 is:"<<tot_sum<<endl;

return 0;

}

Explanation:

Read the number "n" from user.Check every number from 1 to n, if it is a multiple of 2 or 5 then add them to "tot_sum".When the for loop end, "tot_sum" will have sum of all the number which are either multiple of 2 or 5.Print the sum.

Output:

enter a number:11

sum of multiple of 2 or 5 is:35

4 0
2 years ago
Which girl is he baddest 1. Shawty 2.Lisa 3.Ashley
Ainat [17]

Answer:

. . . . . . . S H A W T Y.. . .. . .

3 0
3 years ago
Other questions:
  • Write a program which capitalize every character after full stopin a given sentence
    11·1 answer
  • What is infinite recursion?
    7·1 answer
  • Businesses use spreadsheets to keep track of financial________.
    14·1 answer
  • A disk takes 1 ms per track seek time, and the head is currently on track 70. Assume it takes 5 ms to service a request once the
    10·1 answer
  • Keli is unable to find a shape that meets her needs. Which feature in Power Point should she use to create shapes that are compl
    6·1 answer
  • If you delete a conversation many times with someone like this, will you stop receiving messages from them?
    13·1 answer
  • Briefly describe the traditional definition of the digital divide. What is it and who is affected, positively and adversely? How
    15·1 answer
  • Most effective way of closing email is<br>​
    7·2 answers
  • question 1 scenario 1, question 1-5 you’ve just started a new job as a data analyst. you’re working for a midsized pharmacy chai
    8·1 answer
  • Consider the following variable declarations and initializations.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!