nerdexam
Python_Institute

PCEP-30-02 · Question #88

The result of the following division: ``python 1 / 1 ``

The correct answer is B. is equal to 1.0. In Python 3, the / operator always performs true division, returning a float even when dividing two integers that divide evenly - so 1 / 1 yields 1.0, not 1. Option A is wrong because the expression is perfectly valid Python with no runtime error. Option C is wrong because 1…

Question

The result of the following division:
1 / 1

Options

  • Acannot be evaluated
  • Bis equal to 1.0
  • Cis equal to 1
  • Dcannot be predicted

How the community answered

(24 responses)
  • A
    4% (1)
  • B
    83% (20)
  • C
    4% (1)
  • D
    8% (2)

Explanation

In Python 3, the / operator always performs true division, returning a float even when dividing two integers that divide evenly - so 1 / 1 yields 1.0, not 1. Option A is wrong because the expression is perfectly valid Python with no runtime error. Option C is wrong because 1 (an integer) would only result from floor division using the // operator (1 // 1 == 1). Option D is wrong because the result is entirely deterministic - Python's division semantics are well-defined.

Memory tip: Think of / as "always floats" - if you see a single slash, expect a decimal point in the result. Use // when you want a whole number.

Community Discussion

No community discussion yet for this question.

Full PCEP-30-02 Practice