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
Betsy loves her job. On a daily basis she problem-solves and uses her creative side to fix situations centered around setting up
vladimir2022 [97]
 
The answer would be an A/V Specialist, because Betsy is working with technical equipment on a TV set.
6 0
3 years ago
Read 2 more answers
The physical parts or components of a computer system is called .
dmitriy555 [2]
Answer:
Motherboard

Explanation:
Motherboard is the main component of a computer. It connects with other parts of the computer including drive disks, RAM and CPU and any other expansion slots :)

(Hope it helped)
4 0
3 years ago
Which of the following is an example of a negative externality
ddd [48]
A negative externality is when a good costs much greater than what the consumer pays for it. Since you did not provide the possible answers, use this explanation to find the correct answer among the ones you might have.
7 0
3 years ago
What is the role of the digital cinematographer?
dlinn [17]
<span> is the person in charge of actually shooting the film. He is the head of the camera and lighting departments, and as such he has a big </span>role<span> in the making of any movie

</span>
3 0
3 years ago
Read 2 more answers
In business documents, spacing between columns needs to be _____. 0.25 inches as little as possible as wide as possible proporti
LenKa [72]
In business documents, spacing between columns needs to be proportional to the text because when spacing between columns, you don't want your text or writing to be too far apart but you want it pretty close/equivalent so the text can be correct.
7 0
3 years ago
Read 2 more answers
Other questions:
  • The U.S. continues to become more dependent on the global domain within the information environment consisting of the interdepen
    14·1 answer
  • A haiku is a three-line poem in which the first line contains five syllables, the second line contains seven syllables, and the
    12·1 answer
  • Assume that input file references a Scanner object that was used to open a file. Which of the following while loops shows the co
    6·1 answer
  • The power ratio 1.774 is equivalent to how many dB?
    15·1 answer
  • To celebrate earth day, the employees of a company plan to reduce their carbon footprint in the workplace. Identify the changes
    5·2 answers
  • Research and describe a recent development in theater and film lighting and explain how the technology can be used. (Maybe limit
    8·2 answers
  • Which interpersonal skill is the most important for a telecom technician to develop?
    7·1 answer
  • When text is used as a Hyperlink, it is usually underlined and appears as a different color.
    11·1 answer
  • What are the local, state, and national opportunities that may be available to those who participate in CTSOs?
    9·1 answer
  • Five programs are currently being run in a computer. Program 1 is using 10 GiB of RAM, program 2 is using 5 GiB of RAM, program
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!