14.1k views
3 votes
What statement will call a ball to be drawn in a random location?

a) drawBall(randomX(), randomY());
b) drawBall(getRandomPosition());
c) setBallPosition(randomX(), randomY());
d) randomizeBallPosition();

User Luke Liu
by
7.5k points

1 Answer

2 votes

Final answer:

The correct statement for drawing a ball in a random location is 'drawBall(randomX(), randomY())', which utilizes functions to generate random coordinates and then draws the ball at that location.

Step-by-step explanation:

The statement that will call a ball to be drawn in a random location is a) drawBall(randomX(), randomY()). This statement suggests two functions, randomX() and randomY(), which likely generate a random X and Y coordinate, respectively.

The function drawBall then takes these coordinates as arguments to place the ball in a random location on the screen or canvas where this code is meant to execute.

User Ninjasmith
by
8.7k points