Computers and Technology

A recursive method may call other methods, including calling itself. A recursive method has: 1. a base case -- a case that returns a value or exits from a method without performing a recursive call.
2. a recursive case -- calling the method again with a smaller case..
Study the recursive method given below.
For example, this call recursiveMethod (5); returns 15:
public static int recursiveMethod (int num) (
if (num == 0)
return 1;
else {
if (numX2!=0)
return num * recursiveMethod (num -1);
else
return recursiveMethod (num-1);
}
}
1 What is the base case?
2. What does the following statement check?
3. What does the method do?

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 17:20, jashaikamatuteowwp1p
Q-1 which of the following can exist as cloud-based it resources? a. physical serverb. virtual serverc. software programd. network device
Answers: 3
image
Computers and Technology, 21.06.2019 21:40, DisneyGirl11
Which is a benefit of getting information from a government website? a. the information will be easy to understand. ob. the information will be the most current. oc. the information can be trusted.
Answers: 1
image
Computers and Technology, 23.06.2019 03:30, mem81
How can you repin an image on your pinterest pin board a. click on the "repin" button b. click on the "add pin" button c. click on the "upload a pin" button d. click on the "save pin" button.
Answers: 2
image
Computers and Technology, 24.06.2019 02:00, akatherine1738
What is a loop? a. a collection of function definitions at the top of a program b. a line of code that defines a variable and assigns it a value c. a program that opens the turtle graphics window d. a block of code that repeats a specific number of times
Answers: 1
Do you know the correct answer?
A recursive method may call other methods, including calling itself. A recursive method has: 1. a b...

Questions in other subjects:

Konu
Mathematics, 26.10.2020 14:00
Konu
Mathematics, 26.10.2020 14:00