Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1.What is wrong with this statement? int number = Math.pow(9, 9); There is nothi

ID: 3909752 • Letter: 1

Question

1.What is wrong with this statement?

int number = Math.pow(9, 9);

There is nothing wrong with the statement

2.

for (int a = 0; a < 60; a++) {

array[a] = (int)(Math.random()*(500-1+1)+1);

}

What will be the range of numbers in this array?

3.

What is essential in making sure that your loop is not infinite ?

That your Boolean statement will at some point be false

4.How many elements are in the following array?

      double[][][] catLadysCats= new double [4][8][2];

48

5.What is the conditional required to check whether the length of a string s1 is odd?

if ((s1.length() % 2) != 0)

6.Which of the following means that in order for the conditional to happen, either x must be less than 3 or y must be greater than or equal to 4 ?

a Math.pow needs to be cast to double

Explanation / Answer

1] c] Math.Pow needs to be cast to (int)

Reason: Because if we want the result in int we need to cast Math.pow to integer, only then we can get the integer result.

2] c] Random integers from 1 to 501

Reason: Because according to the syntax for Math.Random first value is Max and other one is min

so while calculating (500-1+1) + 1, first it will retirieve the result for bracket that will be 500, -1+1 is 0 so 500 + 1 gives 501.

3] d] That your Boolean statement will at some point be false

Reason: While using loops if the condition is true, it will enter the loop and it will go on executing till we get result of boolean statement to be true, but once it gets the result as false, it will stop executing which indicates it is not

4] a] 64

Reason: Beacuse length4 * length8 * length 2 gives 64

5] e] if ((s1.length() % 2) != 0)

Reason: Beacuse if the length % 2 is not equal to zero it means its odd, and if it is equal to 0 den it becomes even.

6] a] if ((x < 3) || (y > = 4))

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote