Multiple Choice
Consider the getArea method from the textbook shown below: public int getArea()
{
If (width <= 0) { return 0; } // line #1
If (width == 1) { return 1; } // line #2
Triangle smallerTriangle = new Triangle(width - 1) ; // line #3
Int smallerArea = smallerTriangle.getArea() ; // line #4
Return smallerArea + width; // line #5
}
Assume line #3 is changed to this:
Triangle smallerTriangle = new Triangle(width + 1)
When calling the getArea method on a Triangle object with width = 4, what result will be produced?
A) area for all triangles will be computed to be too high
B) area for all triangles will be computed to be too low
C) area will only be incorrect for a triangle objects with width = 1
D) infinite recursion will occur for triangle objects with width >= 2
Correct Answer:

Verified
Correct Answer:
Verified
Q27: Consider the recursive version of the fib
Q28: Consider the method powerOfTwo shown below: public
Q29: In recursion, the non-recursive case is analogous
Q30: The method below generates all substrings of
Q31: If recursion does not have a special
Q33: Would switching the special case order affect
Q34: Given the following code snippet: public static
Q35: Consider the getArea method from the textbook
Q36: Consider the getArea method from the textbook
Q37: Consider the getArea method from the textbook