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]
3 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]3 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
(a) What is the meaning of word 'computer (b) Cive a reason for the evolution of computer (c) Write a weakness of a computer (d)
djverab [1.8K]

Answer:

see down -

Explanation:

a ) Computer is an electronic device for storing and processing data, typically in binary form, according to instructions given to it in a variable program.

b ) A reason is that people wanted better and efficient calculating devices. This started from the abacus to ENIAC and UNIVAC. Also, modern computers work on the principle of input-process-output and George Boole's logic.

c ) A weakness of a computer is that it isn't so open-minded like human brains. They can't make logical answers and created to give a specific set of answers. They also can't read real human emotions.

d ) Full form of CCTV is Closed Circuit Television. Full form of MRI is Magnetic Resonance Imaging.

Give 5 stars and Brainliest if I am correct on all answers.

6 0
2 years ago
What is the name of the most expensive car and how much is it and what are its features
11Alexandr11 [23.1K]

Answer:

Bugatti La Voiture Noire: $18.68 million or Rs 132 crore

Explanation:

Transmission: 7-Speed Dual-Clutch.

Horsepower: 1,500 hp.

Torque: 1,180 lb-ft.

0-60: Under 3 Seconds.

1/4 Mile: Under 10 Seconds.

Top Speed: TBD.

7 0
3 years ago
What best describes the advantage of using the model of a food web?
Arturiano [62]
The correct option is SHOW A NETWORK OF FOOD CHAINS.
Scientists used food web models to show the networks of living organisms that are involved in a food chain.
Food chains models are used to represent real ecosystems, with these models, scientists can measure and test for generalized patterns in real food chains.
3 0
3 years ago
Read 2 more answers
Short note about micro miniaturzation​
Ghella [55]

Answer:

the manufacture of extremely small versions of electronic devices.

3 0
2 years ago
Read 2 more answers
Write common ICT tools​
Naddika [18.5K]
  • computers
  • laptops
  • printers
  • scanners
  • software programs
  • data projectors
  • and interactive teaching box.

4 0
2 years ago
Other questions:
  • Integrated circuits are made up of _____ that carry the electrical current.
    14·1 answer
  • Which of these is a social consequence of effective communication
    12·1 answer
  • Can someone help me, please
    7·1 answer
  • What is the basic difference between a printer and a plotter?​
    12·1 answer
  • When does information become a liability for an organization
    6·1 answer
  • What is a slide master ?
    8·2 answers
  • Translate each statement into a logical expression. Then negate the expression by adding a negation operation to the beginning o
    15·1 answer
  • Breaking code rules is only a problem once in a while. Group of answer choices True False
    12·1 answer
  • The elements in a long array of integers are roughly sorted in decreasing order. No more than 5 percent of the elements are out
    12·1 answer
  • 100 POINTS!!!!!!!
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!