Computers and Technology

Which of the following answer choices best describes the algorithmic purpose of method num? /** Precondition: i==0; */

public static int num(int[] ray, int i)
{
if( i >= ray. length ){
return 0;
}
if( ray[i] % 2 != 0 ){
return 1 + num( ray, i+1 );
}
else{
return 0 + num( ray, i+1 );
}
}

a. The method is counting the number of numbers in ray.
b. The method is counting the number of even numbers in ray.
c. The method is counting the number of occurrences of x in ray.
d. The method is counting the number of odd numbers in ray.
e. The method is summing all of the numbers in ray.

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 08:40, baue4431
What are the three parts to physical security standards for various types of army equipment and the risk level
Answers: 2
image
Computers and Technology, 23.06.2019 22:40, azariah7
22. sata3 allows for data transfer rates of 600 mb/s. explain why you would likely not be able to copy data from one hard drive to another at anywhere close to this speed. also, what could be upgraded on the computer to achieve transfer speeds closer to 600 mb/s
Answers: 1
image
Computers and Technology, 24.06.2019 07:40, daebreonnakelly
What type of multimedia are live news feeds? live news feeds are examples of multimedia.
Answers: 2
image
Computers and Technology, 24.06.2019 10:20, silviamgarcia
Write a program that keeps asking the user for new values to be added to a list until the user enters 'exit' ('exit' should not be added to the list). these values entered by the user are added to a list we call 'initial_list'. then write a function that takes this initial_list as input and returns another list with 3 copies of every value in the initial_list. finally, inside print out all of the values in the new list. for example: input: enter value to be added to list: a enter value to be added to list: b enter value to be added to list: c enter value to be added to list: exit output: a b c a b c a b c note how 'exit' is not added to the list. also, your program needs to be able to handle any variation of 'exit' such as 'exit', 'exit' etc. and treat them all as 'exit'.
Answers: 2
Do you know the correct answer?
Which of the following answer choices best describes the algorithmic purpose of method num? /** Pre...

Questions in other subjects:

Konu
Mathematics, 24.03.2021 22:30
Konu
Mathematics, 24.03.2021 22:30