Which of the following tasks cannot be performed using an enhanced for loop? Incrementing the value stored in each element of th
e array. B) Displaying all even element values in an array. C) Calculating the product of all the values in an array. D) Comparing the elements in an array to a specific value.
Incrementing the value stored in each element of the array cannot be performed using an enhanced for loop
Explanation:
The enhanced for-loop helps one to simplify code by adding for-loops that visit every element of an array/collection without expressing specifically how one goes from. It is also referred to as a for-each loop since the loop iterates through each array/collection element.
The enhanced for-loop functions as below:
Iterates through each item in the array or collection as specified
Keeps each item in a variable (item)
Finally, perform the body of the loop.
Hence, the enhanced for-loop does not allow Incrementing the value stored in each element of the array.