Question 75 of 97
Q.What will the following expression be evaluated to in Python ? print(6/3 + 4**3//8-4)
(a) 6.5
(b) 4.0
(c) 6.0
(d) 4
Odisha ChseCBSE Class XII Board 2023MCQ· 1mImportance★★★★★
77% · 75/97 Questions
You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.
Start your 14-day free trial to unlock the full solution →6/3 + 4**3//8 - 4 evaluates as 2.0 + 8 - 4 = 6.0 — a float, because / in Python 3 always returns a float. Correct option: (c) 6.0.
Concept — precedence and result types
Two rules decide this question:
- Precedence:
**(exponent) binds tightest; then/and//(evaluated left to right);+and-come last. - Types: true division
/always returns afloatin Python 3 (6/3is2.0, not2), while//between two ints returns anint. Any arithmetic mixing a float with an int produces a float.
Step-by-step trace
| Step | Sub-expression evaluated | Result | Expression so far |
|---|---|---|---|
| 1 | 4**3 (highest precedence) | 64 | 6/3 + 64//8 - 4 |
| 2 | 6/3 (leftmost of /, //) | 2.0 (float!) | 2.0 + 64//8 - 4 |
| 3 | 64//8 | 8 (int) | 2.0 + 8 - 4 |
| 4 | 2.0 + 8 | 10.0 | 10.0 - 4 |
| 5 | 10.0 - 4 | 6.0 | 6.0 |
Run it:
print(6/3 + 4**3//8-4)
Output:
6.0
Why the other options are wrong …
Unlock everything free for 14 days
- Full step-by-step solutions
- Concept-first explanations
- Methods, shortcuts & mistakes
- PYQ mapping + timed mock tests
Full access for 14 days. No credit card required.