AP Computer Science a Quiz: Math Class
1 questions · exam conditions
0:00
Math ClassQuestion 1 of 1

A building height uses height = distance * Math.sin(Math.toRadians(angleDeg)); why call Math.toRadians first?

Because Math.sin expects its argument in radians, not degrees.
Because Math.sin only works for angles between 0 and 90 degrees.
Because Math.toRadians returns the sine value directly as a double.
Because Math.toRadians prevents integer division when computing height.
← Back to quizzes

AP Computer Science a Quiz

AP Computer Science a Quiz: Math Class

Practice Math Class in AP Computer Science a with focused quiz questions that help you check what you know, review explanations, and build confidence with test-style prompts.

What this quiz covers

This quiz focuses on Math Class, giving you a quick way to practice the rules, question types, and explanations that matter most for AP Computer Science a.

How to use this quiz

Try each quiz question before looking at the correct answer. Use the explanations to review missed ideas, then come back to similar questions until the pattern feels familiar.

All questions

Question 1

A building height uses height = distance * Math.sin(Math.toRadians(angleDeg)); why call Math.toRadians first?

  1. Because Math.sin expects its argument in radians, not degrees. (correct answer)
  2. Because Math.sin only works for angles between 0 and 90 degrees.
  3. Because Math.toRadians returns the sine value directly as a double.
  4. Because Math.toRadians prevents integer division when computing height.

Explanation: This question assesses understanding and application of Java Math class methods within the context of AP Computer Science A. The Math class in Java provides static methods for performing basic numeric operations such as exponentiation, square root, and trigonometric functions. In this scenario, students must understand why Math.toRadians is called before Math.sin when working with degree measurements. Choice A is correct because Math.sin expects its argument in radians, not degrees, so conversion is necessary for correct results. Choice B is incorrect because Math.sin works for any angle in radians, not just 0-90 degrees. Encourage students to always check whether trigonometric inputs are in degrees or radians, as using degrees directly in Math.sin will produce incorrect results. Practice with real-world trigonometry problems helps reinforce the importance of unit conversion.