Skip to main content

Java Topic Practice

Casting and Math.random

Practice mode with 15 Java-focused questions, immediate answer checks, and explanations.

For practice use only.

Casting and Math.random MCQ Practice

Casting and Math.random Java practice with 15 questions, code tracing, and a worked explanation for every answer.

Question 1 of 15

Answered 0 of 15

Choose one answer.

Code Tracing 01 - Casting and Math.random: track the final printed value.

int completed = 18;
int bonus = 5;
int days = 3;
double average = (double) (completed + bonus) / days;
System.out.printf("%.6f", average);
Choose one answer.