ARJUN'S KHAN ACADEMY PROGRAMMING UNIT TEST UPDATED 2025-2026 QUESTIONS AND ANSWERS SOLVED & VERIFIED 100%
A digital artist is creating an animation with code. Their code needs to convert polar coordinates to
cartesian coordinates, using these formulas:
x = r × cos( θ )\\y = r × sin( θ )x=r×cos(θ)y=r×sin(θ)
The environment provides these built-in procedures:
NameDescriptionsin(angle)Returns the sine of the given angle.cos(angle)Returns the cosine of the given
angle.
In their code, theta represents the current angle and r represents the current radius.
Which of these code snippets properly implements the conversion formulas? Ans✔✔- x ← r *
cos(theta)
y ← r * sin(theta)
Yong is making a program to help him figure out how much money he spends eating.
This procedure calculates a yearly cost based on how much an item costs, and how many times a week
he consumes it:
PROCEDURE calcYearlyCost(numPerWeek, itemCost) { numPerYear ← numPerWeek * 52 yearlyCost ←
numPerYear * itemCost RETURN yearlyCost }
Yong wants to use that procedure to calculate the total cost of his breakfast beverages:
hot tea, which he drinks 5 days a week and costs $2.00
boba, which he drinks 2 days a week and costs $6.00
Which of these code snippets successfully calculates and stores their total cost?
Note that there are 2 answers to this question. Ans✔✔- totalCost ← calcYearlyCost(2, 6.00) +
calcYearlyCost(5, 2.00)
Category | Study Material |
Comments | 0 |
Rating | |
Sales | 0 |