viewing paste Unknown #27576 | Text

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
Here is a code fragment which appears in a valid main():
 
   int numGifts;
   double costPerGift;
 
   // numGifts gets a value somehow in code that is not shown.  then ...
 
   if ( numGifts < -10 )
      costPerGift = 3.0;
   else if ( numGifts < 8.5 )
      costPerGift = 2.75;
   else
      costPerGift = 2.5;
For which values of numGifts will costPerGift be 2.75 at the end of the fragment?
 
(Check all boxes that apply - there will be more than one.)
 
    A.  numGifts = -1
    B.  numGifts = 20
    C.  numGifts = 30
    D.  numGifts = 8
    E.  numGifts = 10
    F.  numGifts = 15
 
Viewed 873 times, submitted by Guest.