Computer Applications
Study the method and answer the given questions.
public void sampleMethod()
{ for (int i=0; i < 3; i++)
{ for (int j = 0; j<2; j++)
{int number = (int)(Math.random() * 10);
System.out.println(number); }}}
- How many times does the loop execute?
- What is the range of possible values stored in the variable number?
Related Questions
Give the output of the following:
Math.sqrt(Math.max(9,16))The output of the following code is:
System.out.println(Math.ceil(6.4) + Math.floor(-1-2));- 3.0
- 4
- 3
- 4.0
The AMB hotel gives the amount to be paid by the customer as an integer, which of the following Math method rounds off the bill in decimals to an integer?
- Math.round()
- Math.pow()
- Math.ceil()
- Math.abs()