Java OCA OCP Practice Question 1429

Question

Given the following code snippet:

int rate = 10; 
int t = 5; 
XXX amount = 1000.0; 
for (int i=0; i<t; t++){ 
      amount = amount* (1 - rate/100); 
} 

What can XXX be?

Select 1 option

  • A. int
  • B. long
  • C. only double
  • D. double or float
  • E. float


Correct Option is  : C

Note

XXX amount = 1000.0; will be valid only if XXX is double.




PreviousNext

Related