A supplied mass-transfer calculation specifies the following simultaneous updates for masses in kilograms:
Initially, C variables a and b have type double and contain 12.0 kg and 8.0 kg, respectively. Both equations must use the values from before the update. Which block correctly implements one simultaneous update?
b = 0.20 * a + 0.90 * b; a = 0.80 * a + 0.10 * b;
a = 0.80 * a + 0.10 * b; b = 0.20 * a + 0.90 * b;
double old_a = a; a = 0.80 * a + 0.10 * b; b = 0.20 * old_a + 0.90 * b;
Unlock full course notes by signing up
Following a Stored Temperature Estimate
A temperature-monitoring program updates a stored estimate using each new reading:
The factor 0.20 is the specified dimensionless update weight. Calculate the final value of estimate_K. Neglect intermediate rounding and answer in K, to two decimal places.
Tracing Signed Measurement Conversions
A positioning controller uses the following C function to convert a signed displacement in millimetres into an integer count. Determine the integer actually returned for each displacement in the table. Enter exact integers; trace the implementation without replacing its conversion with a different rounding rule.
All listed displacements and the divisor are exactly representable in binary floating point, and every result is within the range of int.
Finding Two Interacting Implementation Errors
A device operates at 90 W, 150 W, and 120 W during three consecutive intervals. Each power value is constant throughout its complete 250 ms interval. The required energy calculation is
with time expressed in seconds so that energy is in joules. A programmer writes:
Tracking Calibration Changes Across a Function Call
A technician runs the following C code on two sensor readings stored in millivolts. Determine the values of sample_mV[0], sample_mV[1], and baseline_mV immediately after calibrate returns. Give each value in mV, to one decimal place.