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
How has the dependence on technology made humanity less intelligent?​
shepuryov [24]

Answer:

People now rely on the internet for answers.

Nobody truly learns stuff and keeps it with them anymore. They know they can just search it again, and get the answer.

3 0
3 years ago
PLEASEEE HELPPP
yan [13]

Answer:

to prevent anyone from discovering it

hope this helps you

<h2>❤itz Indian heart ❤</h2>
3 0
3 years ago
Computers are able to think like human beings true or false?
Temka [501]

Answer:

False. Cuz they work the way they are programmed, which can be like a human being, but is not exactly it. They are built this way so they work as what the user thinks. (e.g. being sure to delete a file/recommending what the user might like)

make me brainliestt :))

7 0
3 years ago
the first day anna read a quarter of the book. on the second day she read a third of the remainder. noticed that after two days
Misha Larkins [42]

Answer:

160 pages

Explanation:

Day\ 1 = \frac{1}{4}

Day\ 2 = \frac{1}{3}Remainder

Left = 80

Required

The number of pages

Let the number of pages be x.

So, on day 1; we have:

Day\ 1 = \frac{1}{4}x

After day 1, there are:\frac{3}{4}x left ----------------- i.e x - 1/4x

On day 2, we have:

Day\ 2 = \frac{1}{3} * \frac{3}{4}x

Day\ 2 = \frac{1}{4}x

At this point, we have:

Day\ 1 = \frac{1}{4}x

Day\ 2 = \frac{1}{4}x

Left = 80 ---- pages left

The summation of all must equal x, the book pages

Day\ 1 + Day\ 2 + Left = Total\\

\frac{1}{4}x + \frac{1}{4}x+ 80= x

Simplify the left-hand side

\frac{1}{2}x+ 80= x

Collect like terms

x - \frac{1}{2}x= 80

Simplify

\frac{2-1}{2}x= 80

\frac{1}{2}x= 80

Multiply by 2

2 * \frac{1}{2}x= 80*2

x = 160

4 0
3 years ago
Given a UNIX file system with 1024-byte blocks, how many disk accesses are needed to access bytes 2500-2503 of a file (assume th
cestrela7 [59]

Answer:

(A) 1

Explanation:

In UNIX the file system the file system is a central part of the operating system. The file system is for storage and retrieval of information. Programs that form the UNIX system also stores information in files.

UNIX file systems supports three files namely: ordinary file, directory files, device files or special files.

If we need to access bytes 2500-2503 it means the bytes are within the third block. So we will need only one access.

Note this is because the file control block (inside) is within the memory. If file control block was not in the memory we would have needed more disk accessses.

7 0
3 years ago
Other questions:
  • Ted reads a sentence: The man said that it would take 10 to 12 days for a reply. He believes the hyphen symbol can replace the w
    11·1 answer
  • The rules of thumb designers use when creating a wireframe page
    8·1 answer
  • The Printer Event 1 P1 requests and is allocated the printer R1. 2 P1 releases the printer R1. 3 P2 requests and is allocated th
    10·1 answer
  • NOTE: in mathematics, the square root of a negative number is not real; in C therefore, passing such a value to the square root
    15·1 answer
  • To properly insert a memory module, you must locate the direction of the ______ .
    14·1 answer
  • For businesses and organizations under recent compliance laws, data classification standards typically include private, confiden
    11·1 answer
  • You are in charge of an event at work. You want to plan and schedule events and resourse. What type of software should you use?
    14·2 answers
  • The span was so long, the height so great, and the enterprise likely to be so costly, that few thought of it as something begun
    9·2 answers
  • Describe the different
    12·1 answer
  • Ple Choice Worth 5 points)
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!