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? a.)

15.) A function can return only one value.

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

a.) We could declare those values globally.

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

c.) We could capture the data to a set of arrays. Since the arrays are passed by reference to the function, the function would not need to return anything.
d.)

All of the above

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

a.) and is an object instantiated of type Random and initiated with a -1
b.) rnd is an object of a random generator
c.) rnd produces a set of random numbers; however the when the object is created it will always produce the same set of random numbers.
d.) All of the above.

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++;

}

d.) None of the above.

Flag this Question

while ( true )

{

...

}

a.) This code will run forever
b.) Unless a break statement is implemented in the bode of the while loop, the code will never run forever.
c.) the expression in the while statement is always true and therefore the loop will be executed for ever.
d.) All of the above

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!