Question: Given the following code segment, which of the following will cause an infinite loop? Assume that temp is an ivariable initialized to be greater than
Given the following code segment, which of the following will cause an infinite loop? Assume that temp is an ivariable initialized to be greater than zero and that arr is an array of integers. for (int k = 0; k< arr.length; k++){ while (arr[k ] < temp ) { arr[ k] = arr[k ] * 2; } } whenever arr contains a value equal to temp when all values of arr are larger than temp O This code will always cause an infinite loop. O whenever arr contains negative number
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
