After which of the following assignment statements will the variable answer ALWA
ID: 3909688 • Letter: A
Question
After which of the following assignment statements will the variable answer ALWAYS-- for any int value of numl hold an integer value without any fractional digits? By integer, here, we don't care whether it is stored in an int type, like -3, 240, or a float type, like -3.000 or 240.0. All those are considered integers. If there is no fractional digits to the right of the decimal place after the computation, it's an integer Check all that will always result in answer having an integer value, regardless of what num1 is. There will be HELPFUL HINT: You are not looking for the most accurate answer here, but the opposite: CHECK only the expressions that will always give an integer anwer. floatC (num1+1) // 100) answer answer - int (numl 1 3.3) answer - int( (num1 + 1.5) / 99.9999) / 5 answer num1 3.3 answer float( int (num1/ 3.3)Explanation / Answer
(Ans-) In the above example , only (ii) option is correct. All the other four options can or will give float answer.
for option(i) , answer=float( (num1 + 1) // 100) , when num1=100 , it will answer 1.0 which is a float value .So this option is wrong.
for option(ii), answer=int(num1/3.3), it will always give int value as answer. So this option is correct.
for option(iii), answer= int((num1 + 1.5)/99.9999)/5 , it also give a float value=0.2 when num1=100 , So this option is also wrong.
for option(iv),answer=num1/3.3 , it also give float value =30.303030303030305 when num1=100, So this option is also wrong.
for option (v),answer=float(int(num1/3.3)), it also give float value=30.0 when num1=100, So this option is also wrong.
Therefore , Only option (II) is the CORRECT option.