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
Which TWO of these correctly describe a Trojan horse malware?
mina [271]
The first one and last one
6 0
2 years ago
Read 2 more answers
The natural functions of Earth seem all _____ in one way or another.
Sonja [21]
Would it be Similar ?
4 0
3 years ago
What are some common options to sort a mail merge recipient list?
Anni [7]

Answer:

by city

by ZIP code

by last name

4 0
2 years ago
Read 2 more answers
Marcus creates a HTML webpage on his favourite game, football. On clicking the word “football” another website containing the in
igomit [66]

please mark me as the brainlest answer please

if you do it then I will answer your all questions.

4 0
2 years ago
Windows Hello supports multiple biometric authentication methods, including facial recognition. What is the failsafe method to a
Orlov [11]

Answer:

The failsafe method when facial recognition method is unavailable is the Personal Identification Number (PIN) method.

Explanation:

The Personal Identification Number (PIN) option is available for setup for cases when other biometric authentication methods fail due to several reasons.

6 0
3 years ago
Other questions:
  • Para saan po yung points dito?
    15·1 answer
  • On an Android device, where can a user find the correct app to use to sync contacts and apps among devices?
    10·1 answer
  • How to access files on different computer same network
    14·1 answer
  • _____ is used to temporarily hold small units of program instructions and data immediately before, during, and after execution b
    10·1 answer
  • dam is writing a program that: 1) has the user guess a number, and 2) tells the user how many guesses it took to get the correct
    9·1 answer
  • Selective colleges choose to have in-person meetings to learn more about the applicants. These meetings are called:
    8·2 answers
  • In _____, a program running on a Web server creates a Web page in response to a request for specific information from a Web clie
    7·1 answer
  • You are testing a printer you just installed, so you use the operator panel on the printer to print a test page. Later, you use
    13·1 answer
  • What is the most common type of storage device for transferring files from one computer to another?
    10·1 answer
  • You are the system administrator for Precision Accounting Services, which employs 20 accountants and 25 accounting assistants. T
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!