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
adell [148]
3 years ago
6

How many times is the function wordScramble() called in the given program? public class WordScramble { public static void wordSc

ramble(String rem, String scr) { if (rem.isEmpty()) { System.out.println(scr + rem); } else { for (int i = 0; i < rem.length(); ++i) { wordScramble((rem.substring(0, i) + rem.substring(i + 1, rem.length())), (scr + rem.charAt(i))); } } } public static void main(String args[]) { wordScramble("ab", ""); } } 4 2 5 3
Computers and Technology
1 answer:
Ainat [17]3 years ago
6 0

Answer:

The answer is "2"

Explanation:

  • In the given java program code, a class WordScramble is declared, inside the class, a static method wordScramble is declared, that accepts two string parameter that is "rem and scr".
  • Inside the method a conditional statement is used in the if the block it checks rem variable value is empty so, it will add rem and scr value.  Otherwise, it will go to else block in this a loop is defined, which calls the method, which calculates rem length that is 2, and this method call two times to rearrange the values.
  • In the next step main method is defined that calls wordScramble method, which passes only one argument "ab" in its first parameter.
  • This method accepts one string value, in which there are two numbers   "a and b" that's why the method will run two times.  
You might be interested in
Describe the objectives of e-commerce ?​
AnnZ [28]

Answer: eCommerce is to reach the more and right customers at the right time so that more orders can be placed and in turns, high revenue can be generated.

Explanation:

5 0
3 years ago
Which of the following statements is true about mobile devices and procedures?
Zarrin [17]

Answer:

No

Explanation:

No

5 0
3 years ago
John is selling his pizza for $6 per slice in an area of high demand. However, customers are not buying his pizza.
lesya692 [45]
I think John could lower the price of his pizza. He could also put out advertisements. One more thing John could do is increase options for people to customize their pizza.

7 0
3 years ago
Read 2 more answers
When parking uphill on a street with no curb, how should your front wheels be positioned? A. Turned to the left (toward the stre
Shkiper50 [21]
The answer is B. It matters which way you park your car . Your car should also be parallel to the carb but with the wheels inward to the right
8 0
4 years ago
Read 2 more answers
Hurry im TIMED
murzikaleks [220]

Answer:

tone image files

your welcome

8 0
3 years ago
Other questions:
  • A low-pass first-order instrument has a time constant of 20ms. Find the frequency,in hertz, of the input at which the output wil
    12·1 answer
  • What is the most important factors to consider when designing a powerpoint presentation?
    7·2 answers
  • Why do networks need standards?
    12·1 answer
  • Skinner designed a soundproof apparatus, often equipped with a lever or bar, with which he conducted his experiments in operant
    9·1 answer
  • Which is an advantage of setting bookmarks?
    15·1 answer
  • 10 points
    14·1 answer
  • Give an original idea for an app idea to do with sports, please.
    9·1 answer
  • Holly has at most $828 to spend for moving from her old apartment. The moving company charges $80 per hour plus at rate of $300.
    9·1 answer
  • What is the genetic material that organisms pass on to their offspring when they reproduce?
    11·1 answer
  • प्रश्न-20 उचित स्थान पर विराम चिह्न लगाइए
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!