This question evaluates a candidate's understanding of numerical methods, floating-point precision, and implementation of approximate functions when producing a square root rounded to one decimal place.
Given a non-negative real number x, implement a function sqrt1dp(x) that returns rounded (or truncated—clarify with interviewer) to one digit after the decimal point.
x = 2
→
1.4
x = 9
→
3.0
x = 0
→
0.0
x
can be non-integer.