Examlex

Solved

Consider the GetArea Method from the Textbook Shown Below: Public

question 38

Multiple Choice

Consider the getArea method from the textbook shown below: public int getArea()
{
If (width <= 0) { return 0; } // line #1
Else if (width == 1) { return 1; } // line #2
Else
{
Triangle smallerTriangle = new Triangle(width - 1) ; // line #3
Int smallerArea = smallerTriangle.getArea() ; // line #4
Return smallerArea + width; // line #5
}
}
Assume the code in line #3 is changed to:
Triangle smallerTriangle = new Triangle(width) ;
This change would cause infinite recursion for which triangles?


Definitions:

Tertiary H Atoms

Hydrogen atoms bonded to a tertiary carbon, which is a carbon atom bonded to three other carbon atoms.

Primary H Atoms

Hydrogen atoms attached to a carbon atom that is in turn bonded to no more than one other carbon atom.

Monobromination Product

A substance obtained by introducing a bromine atom into an organic molecule, typically replacing a hydrogen atom.

1,1,3,3-Tetramethylcyclobutane

1,1,3,3-Tetramethylcyclobutane is a chemical compound featuring a cyclobutane ring substituted with methyl groups at positions 1 and 3.

Related Questions