Examlex

Solved

What Does the Following Method Compute? Assume the Method Is

question 40

Multiple Choice

What does the following method compute? Assume the method is called initially with i = 0
Public int question9(String a, char b, int i)
{
If (i = = a.length( ) ) return 0;
Else if (b = = a.charAt(i) ) return question9(a, b, i+1) + 1;
Else return question9(a, b, i+1) ;
}


Definitions:

°C

A unit of temperature on the Celsius scale, a temperature scale originally known as the centigrade scale, with 0°C denoting the freezing point of water and 100°C its boiling point at sea level.

Atm

A unit of pressure defined as being equal to the pressure exerted by the Earth's atmosphere at sea level; approximately 101.325 kPa.

Volume

The amount of space that a substance or object occupies, or that is enclosed within a container.

°C

a unit of temperature on the Celsius scale, a measure relative to 0°C for the freezing point and 100°C for the boiling point of water at sea level.

Related Questions