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
True or false: within a database, fields can be added, deleted and edited but never moved.
nata0808 [166]

Answer:true bra

Explanation:

6 0
2 years ago
Can someone plss help me!!
REY [17]

Answer:

HTML elements are delineated by tags, written using angle brackets.

Explanation:

Tags such as <img /> and <input /> directly introduce content into the page.

8 0
2 years ago
A recursive method may call other methods, including calling itself. Creating a recursive method can be accomplished in two step
liq [111]

Answer:

Explanation:

The following code is written in Java. It creates the raiseToPower method that takes in two int parameters. It then uses recursion to calculate the value of the first parameter raised to the power of the second parameter. Three test cases have been provided in the main method of the program and the output can be seen in the attached image below.

class Brainly {

   public static void main(String[] args) {

       System.out.println("Base 5, Exponent 3: " + raiseToPower(5,3));

       System.out.println("Base 2, Exponent 7: " + raiseToPower(2,7));

       System.out.println("Base 5, Exponent 9: " + raiseToPower(5,9));

   }

   public static int raiseToPower(int base, int exponent) {

       if (exponent == 0) {

           return 1;

       } else if (exponent == 1) {

           return base;

       } else {

           return (base * raiseToPower(base, exponent-1));

       }

   }

 

}

4 0
3 years ago
I WILL STAR YOU AND THANKS YOU!!!!!!!!!!!!!!!!
lord [1]
The answer seems to be polymerization.
 
8 0
3 years ago
Additional rows and columns are inserted into a table using the
Paladinen [302]
The Option D , Table Tools Insert
6 0
2 years ago
Other questions:
  • The set of specific, sequential steps that describe exactly what a computer program must do to complete the work is called a(n _
    14·1 answer
  • In which area of engineering does material selection play a vital role a design optimization b forensic engineering c mechanical
    6·1 answer
  • What is the definition of framerate?
    7·1 answer
  • Select two netiquette guidelines. In a paragraph of no less than 125 words, explain why these guidelines make professional onlin
    9·1 answer
  • How does a content management system differ from a basic wysiwyg web authoring tool??
    11·1 answer
  • Which of the following commands would you use to start the program Main with four strings? a. java Main arg0 arg1 arg2 arg3 b. j
    11·1 answer
  • Jack lost all the data he saved on his desktop because of a power outage while working on a presentation. On which of these comp
    15·2 answers
  • [1] Our son has started playing organized T-ball, a beginner’s version of baseball. [2] “Organized” is what parents call it, any
    9·2 answers
  • The computer scientists Richard Conway and David Gries once wrote: The absence of error messages during translation of a compute
    7·1 answer
  • All of the following are true about data science and big data except: a.Digital data is growing at the rate of 2.5 quintillion b
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!