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
ololo11 [35]
2 years ago
8

For the recursive method below, list the base case and the recursive statement, then show your work for solving a call to the re

cur() method using any parameter value 10 or greater.
public static int recur(int n)
{
if(n < 1)
{
return 3;
}
else
{
return recur(n / 5) + 2;
}
}

Computers and Technology
1 answer:
Paul [167]2 years ago
3 0

Answer:

(a): The base case: if(n<1)

(b): The recursive statement: recur(n / 5)

(c): Parameter 10 returns 7

Explanation:

Given

The above code segment

Solving (a): The base case:

The base case is that, which is used to stop the recursion. i.e. when the condition of the base case is true, the function is stopped.

In the given code, the base case is:

<em>if(n<1)</em>

Solving (b): The recursive statement:

The recursive statement is the statement within the function which calls the function.

In the given code, the recursive statement is:

<em> recur(n / 5)</em>

<em />

Solving (c): A call to recur() using 10

The base case is first tested

if (n < 1); This is false because 10 > 1

So, the recursive statement is executed

<em>recur(n/5) +2=> recur(10/5)+2 => recur(2)+2</em>

2 is passed to the function, and it returns 2

if (n < 1); This is false because 2 > 1

So, the recursive statement is executed

<em>recur(n/5) +2=> recur(2/5)+2 => recur(0)+2</em>

2 is passed to the function, and it returns 2

<em />

if (n < 1); This is true because 0 < 1

This returns 3

So, the following sum is returned

Returned values = 2 + 2 + 3

Returned values = 7

You might be interested in
Which statement best describes a social impact of computing on the world?
DiKsa [7]

Answer: Smartphones have changed the way people communicate through text messages and emojis.

Explanation:

it would only make sense that this is the correct answer because globally smartphones are used for communication, considering the fact that we dont tend to write letters to people across the country as our main source of communication, or in a different continent all together. The steady growth of technology has clearly made getting in touch with people of all nations much easier.

3 0
2 years ago
Data mining must usestatistics to analyze data.<br> True<br> False
Rasek [7]

Answer: True

Explanation: In data mining, they use statistics component for the analyzing of the large amount of data and helps to deal with it. Statistics provide the techniques for the analyzing, evaluating and dealing with the data that is known as data mining.Data statistics provide the help to organize large data in a proper form and then analyze it. Thus, the statement given is true that data mining must use statistics to analyse data.

4 0
2 years ago
350 square feet requires 1 gallon of paint. Assign gallons_paint with the amount of paint required for wall_area. Sample output
Marina CMI [18]
Here's a solution in node.js. Can be easily transcribed to other languages:

var paint_per_sqf = 1/350;
var wall_area = 250.0;
var gallons_paint = wall_area * paint_per_sqf;

console.log(wall_area.toFixed(1) + " square feet wall will need:");
console.log(gallons_paint.toFixed(12) + " gallons of paint");


4 0
2 years ago
Riodic Table
Ksenya-84 [330]

Answer:

riodic Table

A museum wants to store their valuable documents in cases that contain a gas that will protect the documents.

She should not choose one of the other gases because they are too

The museum director should choose

Explanation:

I didn't understand

8 0
3 years ago
Few companies today could realize their full-potential business value without updated ________. Select one: a. IT investments ma
Alenkasestr [34]

Answer:

b. IT infrastructures and services

Explanation:

IT infrastructure or information technology infrastructure refers to the various components involved in the functioning of an IT enabled operations. These components include; hardware, software, network resources, etc.

It is usually internal to an organization and deployed within the confines of its own facilities.

6 0
3 years ago
Other questions:
  • The layout button is located in the ____ group on the home tab?
    14·1 answer
  • __________ ensure that hardware and software produced by different vendors work together.
    14·1 answer
  • What is a Better Computer?<br> A. Alien<br> B. Microsoft<br> C. Windows<br> D. Apple
    11·2 answers
  • Greg is the network administrator for a large stadium that hosts many events throughout the course of the year. They equip usher
    7·1 answer
  • The largest type of computer system with the most extensive storage capacity and the fastest processing speeds is a ________.
    7·1 answer
  • Select the correct answer
    5·2 answers
  • Which of the following activities does an effective team do?
    15·2 answers
  • What statement best describes entrepreneurship?
    7·2 answers
  • Please answer this question​
    8·1 answer
  • What is the action of extracting data fragments and then reassembling them in order to recover a file?.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!