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
Bumek [7]
3 years ago
10

Consider the recursive method whose definition appear below. Why? public static String mysteryString (String s){ if(s.length()==

1) return s; else return s.substring(s.length() – 1) + mysteryString(s.substring(0, s.length() – 1)); } What is the result of the following call?
System.out.println(mysteryString("computer"));
Computers and Technology
1 answer:
Marizza181 [45]3 years ago
6 0

Answer:

retupmoc

Explanation:

1.) Anwser will be retupmoc

because

public static String mysteryString(String s){

if(s.length() == 1){

return s;

}

else{

return s.substring(s.length() -1) + mysteryString(s.substring(0, s.length()-1));

}

}

In this program input is "computer" . So the function mysteryString(String s) it does

return s.substring(s.length() -1) + mysteryString(s.substring(0, s.length()-1));

so when it enters the first time ??s.substring(s.length() -1) and it will be give you 'r' then it calls the function recursively by reducing the string length by one . So next time it calls the mysteryString function with string "compute" and next time it calls return s.substring(s.length()-1)? + mysteryString(s.substring(0,s.length-1)) so this time it gives "e" and calls the function again recursively . It keeps on doing till it matched the base case.

so it returns "retupmoc".

You might be interested in
What occurs in a steam engine?
VARVARA [1.3K]
Fist one correct.
second wrong because not all heat is used for work, some of it lost to other.
third wrong because fuel burn inside is called combustion engine
 <span />
7 0
3 years ago
Read 2 more answers
Clickstream tracking tools collect data on customer activities at web sites (true/false)?
Galina-37 [17]

Clickstream tracking tools collect data on customer activities at websites- true.

<h3>what is the website?</h3>
  • A website, often known as a website, is a collection of web pages and associated material that is published on at least one web server and given a shared domain name.
  • The World Wide Web is the aggregate name for all publicly accessible websites.
  • A company's internal website for its workers is an example of a private website that can only be viewed via a private network.
  • Most websites focus on a single subject or objective, including news, education, business, entertainment, or social networking.
  • The navigation of the website, which frequently begins with a home page, is aided by hyperlinks between web pages.

To learn more about website, refer to the following link:

brainly.com/question/9060926

#SPJ4

3 0
1 year ago
(Game Design) A number of elements in a specific order is:
mash [69]

Yes the ansewer is c bc you can look it up!

7 0
3 years ago
Read 2 more answers
Alt text is considered a(n ____ attribute because it provides access to everyone who visits your site.
Vikentia [17]
Alt text is considered an accessibility attribute...
8 0
3 years ago
The three logical operators recognized by most search engines are
Kisachek [45]
The three basic logical operators recognized by the most search engines are AND, OR and NOT. They are known as Boolean operators. <span>You can use Boolean operators in keywords on the internet in both advanced and customs searches on many search engines.</span>




8 0
3 years ago
Other questions:
  • This is the main work area of your computer.
    7·1 answer
  • 2 negative impact of excessive use of computer even in solving mathematical problem.
    11·1 answer
  • Why aren’t I leveling up? I have enough points and even a brainliest. Could an expert please help me!! I am really confused.
    10·1 answer
  • I need help!!!!
    13·2 answers
  • Traceability of requirements is helpful in the followingexcept
    5·1 answer
  • Write a Python program that reads the CSV file, compares the population estimates of every row for 2010 and 2017 and computes th
    10·1 answer
  • Which one of the following statements is true regarding the fetch-execute cycle? Each step of the fetch-execute cycle is perform
    15·1 answer
  • What is the advertising photographer’s main objective in creating an image?
    11·1 answer
  • If we assume the modern view of existential import, why is the following syllogism invalid? No computer is made of clay. All com
    15·1 answer
  • The software that displays the resulting web pages is​
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!