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
Software obtained illegally is called open-source software. true / false
Oxana [17]
False, software obtained illegally is called Pirated Software.
<span>Open source software is software developed by and for the user community, ie. Linux based software is Open Source.</span>
3 0
3 years ago
True or False? At any point in time, an open file has a current file pointer indicating the place where the next read or write o
mr_godi [17]

Answer:

True is the correct answer for the above question.

Explanation:

  • When any document file is opened then every point has some particular address. so there is a pointer which states that where the read operation and the write operation is going on.
  • When any person writes any program to read a file or write a file then there is a need for some variable that is pointed for the reading and the write operation.
  • The document which is used for the write data or read data is also designed and maintained by some software.
  • Hence we can say that there are needs of some variable that point the operation of the file and it is also stated from the above question. Hence the above question statement is a true statement.
5 0
3 years ago
What is the main advantage of using a WYSIWYG("what you see is what you get")editor when constructing a website
Tomtit [17]

Answer:

c

12121212121212121212121212121221212121212121212

7 0
3 years ago
Write a program that asks the user for the name of a text file. the program should display the last 10 lines of the file on the
Tom [10]
The only thing that I know is that after you input the text file, it could either:
-save those lines as a variable
-display the text file
However any more would be dependent on the language.
3 0
3 years ago
In order to protect your computer from the newest virus, which of the following should you do after you've installed a virscan s
NNADVOKAT [17]
After installing your anti-virus, you must do the following to make sure that your computer will be virus free moving forward:

1. Scan every drive of your computer.
2. Scan every program, photo, video, etc before opening those.
3. Avoid visiting restricted sites.
4. Update your antivirus application. This way, the application gets new virus database.
5. Schedule antivirus scanning.
6. If your antivirus application do not have scheduled scanning, plan it.
7. Install antivirus widgets or extension in your web browser.
8. For maximum protection, you can install another antivirus application.
9. Uninstall risky applications.
10. Scan flashdrives before opening or exploing those. Avoid borrowing flashdrives.
11. Avoid inserting your flashdrives to other devices.
12. Defrag your system. Some virus can't be detected because your system's drive may be badly fragmented.

3 0
3 years ago
Other questions:
  • Google Slides saves your work to Google Drive. PowerPoint has the option to save to OneDrive. Both of these solutions are in the
    9·1 answer
  • Your company runs several databases on a single MySQL instance. They need to take backups of a specific database at regular inte
    12·1 answer
  • What are the consequences of plagiarism?
    7·2 answers
  • A spreadsheet has some values entered: Cell A1 contains 10, cell A2 contains 14, A3 contains 7. You enter in cell A4 the followi
    8·1 answer
  • What are ip addresses? why are these important for forensic scientists?
    5·1 answer
  • Describe an energy problem a city in 2050 will face
    6·1 answer
  • Simplify 0.2×0.03055 to 3 decimal places​
    15·2 answers
  • Write a program that converts or calculates values. Use the following guidelines to write your program:
    9·1 answer
  • What is problem scoping
    14·1 answer
  • Write a function sumOfMultiples, that inputs two integers - seed and cap. The function should return the sum of all the multiple
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!