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]
4 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]4 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
I am in desperate need to graduate. Overloaded with tons of online homework to be completed before the school year ends. I don't
Alenkinab [10]

What school do you go to?

8 0
3 years ago
1. Which of the following is a result of a successful negotiation?
Alik [6]
Maybe a Win win outcome
7 0
4 years ago
Read 2 more answers
To move or copy a range of cells, select the correct order:
Karo-lina-s [1.5K]

Answer:

Correct Order

2. Select the cell or range you want to move or copy.

1. Move the pointer over the border of the selection until the pointer changes shape.

3. To move the range, click the border and drag the selection to a new location, or to copy the range, hold down the Ctrl key and drag the selection to a new location.

Explanation:

To move or copy range of cells in MS Excel, You first select the cell/range you want to move or copy, hover the mouse pointer and take note when it changes shape, then finally click the border (when you noticed the change of shape of the pointer) and hold down the ctrl key and drag it to the destination location.

6 0
3 years ago
NEED HELP NOW 66 POINTS WILL MARK BRAINLIEST!! For the independent reading all you have to do is pick a grade six book that you
nlexa [21]
1a
2a
3b
4d
5c
6d
7b
8c
9a
10c
6 0
3 years ago
Reply emailing a student who is asking about audio materials​
Sergeeva-Olga [200]

Answer:

The student because you are replying to the student.

Explanation:

4 0
3 years ago
Read 2 more answers
Other questions:
  • The most commonly used traffic control devices used in road construction and maintenance work areas are
    10·1 answer
  • An example of a ______ in the United States are computer hackers, whose members engage in actions that subvert authority, disrup
    6·1 answer
  • 3. In a 32-bit CPU, the largest integer that we can store is 2147483647. Verify this with a
    12·1 answer
  • 1) APPLICATION BASED QUESTION:-
    5·1 answer
  • What is a non-example of job skill
    13·1 answer
  • ___________ is a computer programming language.
    9·2 answers
  • How are computers connected to one another?
    5·2 answers
  • Using only AND, OR and inverter gates to implement the above Boolean equation, how many gates are needed
    8·1 answer
  • Time management is the ability to use time effectively.
    13·2 answers
  • What can you achieve if you divide your search engine marketing account into relevant campaigns and ad groups?.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!