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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started