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
balu736 [363]
3 years ago
10

Consider the following recursive method: public int someFun(int n) { if (n <= 0) return 2; else return someFun(n-1) * someFun

(n-1); } (a) When the program calls someFun(5), how many times will someFun(3) be called? (b) What does this method calculate when the input parameter n is a non-negative integer?
Computers and Technology
1 answer:
Stella [2.4K]3 years ago
3 0

Answer:

(a) someFunc(3) will be called 4 times.

(b) For non negative number n someFunc method calculates 2^2^n.

Explanation:

When you call someFunc(5) it will call someFunc(4) two time.

So now we have two someFunc(4) now each someFunc(4) will call someFunc(3) two times.Hence the call to someFun(3) is 4 times.

someFunc(n) calculates someFunc(n-1) two times and calculates it's product.

someFunc(n) = someFunc(n-1)^2..........(1)

someFunc(n-1)=someFunc(n-2)^2..........(2)

substituting the value form eq2 to eq 1.

someFunc(n)=someFunc(n-2)^2^2

       .

       .

       .

       .

= someFunc(n-n)^2^n.

=2^2^n

2 raised to the power 2 raised to the power n.

You might be interested in
When creating an electronic slide presentation, Lee should avoid
Amanda [17]

I believe the answer is <u>Using sound effects between slides.</u>

Using sound effects between slides can cause for a distraction, and if you are in college, your professor may not score your presentation as well as if it were made without sound effects. Hope this helps!

5 0
3 years ago
A coworker asks your opinion about how to minimize ActiveX attacks while she browses the Internet using Internet Explorer. The c
uysha [10]

Answer:

Security Tab is the correct answer.

Explanation:

The Security Tab will enable the users to authorize anyone to use that file or directory.Many clients deleted the security tab because After that nobody can alter the security privileges on the device.

  • With the help of the Security tab, we will minimize the ActiveX attacks on Internet Explorer. This option is available in the Internet Options of the dialog box.
  • Other options are incorrect because they are not related to a given scenario.
8 0
3 years ago
What are the 2 levels of formatting in a word document
goldfiish [28.3K]

Answer:

Paragraph Styles and character formatting (font, color, etc.)

7 0
2 years ago
You can use the ____ to change the order of the wat windows are stacked.
djyliett [7]

Answer:

A

Explanation:

6 0
3 years ago
In contrast to data in a database, data in a data warehouse is described as subject oriented, which means that it _____.
jonny [76]

Answer:

focuses on a certain subject

Explanation:

it means that it focuses on that one subject and none others

Hope it helps c:

6 0
3 years ago
Other questions:
  • The term _____ best describes the level of technology skills needed in today’s business world.
    15·1 answer
  • Opportunity cost is the least desirable alternative given up as a result of a decision.
    6·1 answer
  • Only the _________ can add users with passwords and limit user access to selected areas.
    5·1 answer
  • Define the missing method. licenseNum is created as: (100000 * customID) licenseYear, where customID is a method parameter. Samp
    14·2 answers
  • Which of these statements regarding​ time-cost tradeoffs in CPM networks is​ true?
    6·1 answer
  • How to Calculate the area of a rectangle in python
    13·2 answers
  • Why are people's visions of utopias and dystopias subjective?
    9·1 answer
  • (1) Prompt the user to enter two words and a number, storing each into separate variables. Then, output those three values on a
    10·1 answer
  • How is the pattern matching done in the SQL?
    5·2 answers
  • How can you prevent someone with access to a mobile phone from circumventing access controls for the entire device
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!