Java OCA OCP Practice Question 744

Question

Given the following code:

int rate = 10; 
XXX amount = 1 - rate/100*1 - rate/100; 

What can XXX be?

Select 1 option

  • A. only int or long
  • B. only long or double
  • C. only double
  • D. double or float
  • E. long or double but not int or float.
  • F. int, long, float or double


Correct Option is  : F

Note

P:Note that none of the terms in the expression 1 - rate/100*1 - rate/100; is double or float.

They are all ints. So the result of the expression will be an int.

Since an int can be assigned to a variable of type int, long, float or double, amount can be int, long, float or double.




PreviousNext

Related