Q. | the following program segment is intended to find the index of the first negative integer in arr [0] ... arr [ N-1], where arr is an array of N integers. int i = 0;
while (arr [i] >= 0)
{
i++;
}
location = i ;
This segment will work as intended
|
|||||||
|
Answer: | Option C | |
Explaination: |
If arr contains no gegative intergers, the value of i will eventually exceed n-1, and arra (I) and arr (i) will cause an Array IndexOutOf BoundsException to be thrown . |
Discussion
Your Comments Goes here... |
Name | Discussion |
---|