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
A computer which links several pcs together in a network is called
Nadusha1986 [10]
Is it called a, "server".
8 0
3 years ago
If a hypothesis is strongly supported by the scientific community based on compelling experiment results, it becomes a————
SOVA2 [1]
I'm pretty sure it becomes a fact.

6 0
3 years ago
Read 2 more answers
Need help ASPA!!!!!!!!!
professor190 [17]
Answer is D the internet
7 0
3 years ago
Read 2 more answers
What is the recommended size for bulleted text? 12–22 24–40 44–66 54–80
algol [13]
44–66

According to sources, the most probable answer to this query is 44–66 point size.
This is because the eyes and the illustration should match the proportion of distance and height factors.
Thank you for your question. Please don't hesitate to ask in Brainly your queries. 
5 0
3 years ago
When you sustain program implementation by staying true to the original design, it is termed A. Goals and objectives B. Program
Naya [18.7K]

Answer:

Program fidelity

Explanation:

7 0
3 years ago
Other questions:
  • All of the following are vertical alignment options except __middle , top, center, or_bottom_.
    12·1 answer
  • . ____________is/are the JSP ImplicitObject(s).sessionapplicationconfigAll of GivenNone of Given
    9·1 answer
  • The information provided in text aids can help us to understand a text’s content before we even read it.
    8·1 answer
  • Work-based learning can be defined as educational experiences that focus on
    6·1 answer
  • Which of the following items in the folder window allows users to view locations which have been visited before?
    6·1 answer
  • How many MB are there in 1000 KB?
    11·2 answers
  • PLEASE HELP. Nobody has been helping me, i need to resolve this code issue for game design
    8·1 answer
  • Which type of protocol provides a way to transfer files from one computer to another over any tcp/ip network, such as a lan or t
    14·1 answer
  • Q2: Mark True or False in the corresponding Answer sheet (0.5 point each)
    8·1 answer
  • _is the joining of two or more electrical conductors by mechanically twisting the conductors together or by using a special spli
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!