viewing paste Unknown #27590 | Text

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Consider the code fragment (assumed to be in a program in which all variables are legally defined):
 
   int num1;
   double num2;
   double answer;
 
   // program gets num1 and num2 from user, and values received
   // are always non-zero numbers between +1 and +100 (code not shown)
 
   ...
 
   // compute precise quotient:
   answer = (double) ( num1 / num2 );
 
After the assignment statement the variable answer, will hold the most precise quotient possible, accurate to several digits to the right of the decimal point  ...
 
        A.      ...  NEVER, regardless of what  values num1 and num2 hold.
        B.      ...  SOMETIMES, i.e., for some, but not all, values of num1 and num2.
        C.      ...  ALWAYS, regardless of what values num1 and num2 hold (as long as they are in the stated range).
 
Viewed 546 times, submitted by unknown.