1.

What will be the value of x from the following code snippet? A, B = 10,3X = A if (A/B==3) else Bprint(X)(B) 10(C). True(D) False(A) 3​

Answer»

(A) 3Explanation:In LINE 1,VALUE 10 is stored in A, and value 3 is stored in B.In line 2,it says, if A/B==3, value of A is stored in X, else, value of B is stored in X.The main thing to NOTICE over here is,A/B is a normal division which give the value in decimals.So, A/B=10/3 gives 3.33333... which is not equal to 3.As A/B is not equal to 3, The value of B is stored in X; i.e., X=3Note: X WOULD have been stored with the value of A, if we use floor division (A//B), which rounds up the value of decimal too the nearest lowest integer.



Discussion

No Comment Found