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

15.) A function can return only one value. What can we do if more than one value

ID: 3824913 • Letter: 1

Question

15.) A function can return only one value.

What can we do if more than one value is computed and needs to be returned?

b.) We could create an array if all of the values are of the same data type, and return the array.

All of the above

16.) Random rnd = new Random(-1);

17.) A while loop and a for loop both can perform the same function.

for (int i = 0; i < N; i++) { statements }

Select the equivalent code using a while loop.

a.) while (i < N)

{

statements;

i++;

}

b.) int i = 0;

while (i < N)

{

statements;

}

c.) int i = 0;

while (i < N)

{

statements;

i++;

}

Flag this Question

while ( true )

{

...

}

a.) We could declare those values globally.

Explanation / Answer

15. b.) We could create an array if all of the values are of the same data type, and return the array.

16. a.) and is an object instantiated of type Random and initiated with a -1

17.

c.) int i = 0;

while (i < N)

{

statements;

i++;

}

-> c.) the expression in the while statement is always true and therefore the loop will be executed for ever.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote