Courseiva
Question 89 of 481
Primitives, Strings and OperatorsmediumMultiple ChoiceObjective-mapped

1Z0-811 Primitives, Strings and Operators Practice Question

A banking application uses a method to calculate interest: double calculateInterest(double balance) { return balance * 0.05; }. The method is called with an int argument: int accountBalance = 1000; double interest = calculateInterest(accountBalance); System.out.println(interest); The output is 50.0, but the expected output is 50.0. However, the developer notices that if the method is changed to return int, the output becomes 50.0 as well. Which statement about implicit casting is true?

⚠ Common exam trap

Oracle often tests the misconception that implicit casting can happen in both directions (widening and narrowing) or that the return type determines the cast direction; the trap here is that candidates may think the `double` result is cast to `int` when the return type changes, but in fact the implicit cast occurs on the argument, not the result.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

The int argument is implicitly cast to double.

When a method expecting a `double` parameter is called with an `int` argument, Java performs implicit widening primitive conversion (casting) from `int` to `double`. This is safe because `double` can represent all `int` values without loss of precision. The `int` value 1000 is automatically converted to `1000.0` before being used in the calculation.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • The double result is implicitly cast to int.

    Why it's wrong here

    Narrowing would require explicit cast.

  • The int argument is implicitly cast to double.

    Why this is correct

    Correct widening conversion.

  • The code fails to compile because of type mismatch.

    Why it's wrong here

    Compiles fine.

  • The multiplication result is automatically rounded.

    Why it's wrong here

    Not automatic rounding.

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Last reviewed: Jun 30, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

This 1Z0-811 practice question is part of Courseiva's free Oracle certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the 1Z0-811 exam.