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
A URL suffix is called a domain name.
Marta_Voda [28]
<span>A URL suffix is called a domain name. This statement is False.
</span>URL or Universal Resource Locator is just the same as the domain name. The URL suffix or the domain name suffix is known as the Generic Top-Level Domain (gTLD). It describes the type of organization a website is. Like for example '.org', '.gov', '.edu'
5 0
3 years ago
Which of the following is NOT a good way to reduce pollutants in paint shops?
Citrus2011 [14]

Automobile repair shops produce many types of waste -- some hazardous, some not necessarily hazardous but still potentially damaging to the environment if not handled properly, and all requiring proper treatment and/or disposal at significant cost to the business. A list of the types of waste that the shop owner or manager must contend with would include:

solvents (paints and paint thinners)

antifreeze

scrap metal

batteries and other auto parts

oils and oil filters

fuels of various types

acids and alkalis (contaminated rags and towels)

Whatever the nature and characteristics of the waste may be, it all has one thing in common: All waste represents loss of resources and loss of money.

4 0
3 years ago
__________ is a computer tool for evaluating the risk of exposure to wildfires.
Brut [27]

Answer:

The statement is true

Explanation:

5 0
2 years ago
Read 2 more answers
Password ____ traverse the network searching for passwords from remote authentication systems.
irga5000 [103]

The correct answer is scanners.

<h3>what is password?</h3>

A password is a group of letters and numbers that is used to confirm a user's identity throughout the authentication process. Passwords are frequently used in conjunction with usernames; they are created to be known only by the user and grant access to a device, application, or website on their behalf. Letters, numbers, and special characters can all be used in passwords, and their length can vary.

When a password contains more than one word, it may be referred to as a passphrase. When a password contains solely digits, such as a personal identification number, it may be referred to as a passcode or passkey (PIN).

learn more about password refer:

brainly.com/question/15569196

#SPJ4

3 0
1 year ago
Which feature of spreadsheet software will make it easier for you to find the average number of calls made per hour for each emp
max2010maxim [7]

Answer:

It's formula and functions

Explanation:

6 0
4 years ago
Other questions:
  • Which option allows you to view slides on the full computer screen? A) new slide B) slide show C) slide sorter
    11·2 answers
  • Mention any six profession related to tourism
    6·2 answers
  • Crashing almost always accelerates the schedule while increasing project risk, whereas fast tracking almost always accelerates t
    10·1 answer
  • Print "Censored" if userInput contains the word "darn", else print userInput. End with newline. Ex: If userInput is "That darn c
    14·1 answer
  • Complete function PrintPopcornTime(), with int parameter bagOunces, and void return type. If bagOunces is less than 2, print "To
    5·1 answer
  • Write an algorithm to sum all numbers between 0 and 1000 that are divisible by ,7​
    8·1 answer
  • I try to make an account so I can have some help, but it always says "We’re sorry, but we are not able to complete your registra
    13·1 answer
  • Reflection image and design
    12·1 answer
  • Which type of service offers a preconfigured testing environment for application developers to create new software applications
    13·1 answer
  • General Electric saves $1.6 billion per year by using its private corporate network that links its 340,000 employees. Another na
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!