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
yKpoI14uk [10]
3 years ago
15

Write a recursive function next_pow2(n) that returns the smallest integer value p such that for a non-negative value n. For exam

ple: function call return value next_pow2(0) 0 next_pow2(1) 0 next_pow2(2) 1 next_pow2(3) 2 next_pow2(4) 2 next_pow2(5) 3 next_pow2(6) 3 next_pow2(7) 3 next_pow2(8) 3 next_pow2(9) 4 next_pow2(255) 8 next_pow2(256) 8 next_pow2(257) 9
Computers and Technology
1 answer:
Finger [1]3 years ago
8 0

Answer:

Explanation:

The following code is written in Python and is a recursive function as requested that uses the current value of p (which is count in this instance) and raises 2 to the power of p. If the result is greater than or equal to the value of n then it returns the value of p (count) otherwise it raises it by 1 and calls the function again.

def next_pow2(n, count = 0):

   if (2**count) < n:

       count += 1

       return next_pow2(n, count)

   else:

       return count

You might be interested in
Howard is leading a project to commission a new information system that will be used by a federal government agency. He is worki
Ann [662]

Answer:

The correct answer is A.

Explanation:

Given the example in the question, Howard is at the step of implementing security controls.

There are five official steps for the risk management framework.

  1. Categorizing The Information System: In this step, the IT system's objectives are assigned based on the current mission or project.
  2. Selecting Security Controls: After the risk assesment is done, the security controls for technical, hardware and software problems are decided according to the outcome.
  3. Implementing Security Controls: In this step, the points that were decided in the step before are put into action.
  4. Authorizing The Information System: Authorization for the risk management is approved and monitored.
  5. Monitoring Security Controls: The authorities keep monitoring the process and makes any necessary changes and updates.

The process that is explained in the question is step 3, which is given in option A.

I hope this answer helps.

5 0
3 years ago
Which of the following applications can be used as a data source for a Microsoft® Word® mail merge? A.Outlook Contacts B.Microso
Xelga [282]
<span>Word can pull data from a variety of data sources to perform a mail merge. As part of the Microsoft Office suite, Word easily accepts data from Outlook, Excel, and Access, and other data sources such as web pages, OpenDocument text files, and delimited data files stored as plain text. And if you don't have an existing data source, you can create a new one in Word.
ALL OF THE ABOVE

</span>
8 0
3 years ago
Read 2 more answers
Edhesive 9.10 Question 3
Ede4ka [16]

Answer:

your on unit 9 of edhesive?

Explanation:

5 0
3 years ago
Read 2 more answers
What happens to formulas with relative cell references when they are copied using the fill handle?
Masteriza [31]
The correct answer is D
4 0
4 years ago
2. Because technology is always changing, there are new applications being developed constantly. (1 point)
Zepler [3.9K]
True because we need new tech
4 0
3 years ago
Read 2 more answers
Other questions:
  • Heatsinks used to protect cpus in computers from overheating, are shaped so that their surface area is very large. why is that?
    5·1 answer
  • You support Richman Investments, a brokerage firm that employs 20 brokers. Each broker has his own client computer, and the firm
    15·1 answer
  • A/an ___________ is a scheduling tool that sets the standard and nonworking time for the project and is used to assess how tasks
    6·1 answer
  • When discussing the data-modeling building blocks, anything (a person, a place, a thing, or an event) about which data are to be
    15·1 answer
  • The show ip dhcp binding command displays _____. (Points : 5) the MAC table cache information
    7·1 answer
  • A reference parameter differs from an output parameter in that a reference parameter ______________________ but an output parame
    5·1 answer
  • What are registers in ICT used for?
    5·1 answer
  • True false.
    10·2 answers
  • Which insert image option allows a user to compile, modify, and add captions to images?
    5·2 answers
  • Which is NOT true?<br> 9 + 4 = 17 - 4<br> 8 + 7 = 14 + 3<br> 11 = 19 - 8<br> 5 + 8 = 20 - 7
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!