nerdexam
Python_Institute

PCEP-30-02 · Question #92

What is the result of the following operation? ``python 1 + 1.0 ``

The correct answer is A. 2.0. When Python adds an integer (1) and a float (1.0), it implicitly converts the integer to a float before performing the operation - a process called implicit type coercion - yielding 2.0, a float. Option D (2) is wrong because the result retains the float type, not int; Python…

Question

What is the result of the following operation?
1 + 1.0

Options

  • A2.0
  • B11.0
  • CThe operation is illegal in Python
  • D2

How the community answered

(63 responses)
  • A
    75% (47)
  • B
    3% (2)
  • C
    14% (9)
  • D
    8% (5)

Explanation

When Python adds an integer (1) and a float (1.0), it implicitly converts the integer to a float before performing the operation - a process called implicit type coercion - yielding 2.0, a float. Option D (2) is wrong because the result retains the float type, not int; Python never silently drops the decimal when a float is involved. Option B (11.0) would only occur with string concatenation ("1" + "1.0"), not numeric addition. Option C is wrong because Python explicitly supports mixed int/float arithmetic through implicit promotion.

Memory tip: "Float is contagious" - any arithmetic expression that touches a float produces a float result.

Community Discussion

No community discussion yet for this question.

Full PCEP-30-02 Practice