0%
0 / 4 answered
Unit Testing Practice Test
•4 QuestionsQuestion
1 / 4
Q1
Consider the Array
int[] arr = {1, 2, 3, 4, 5};
What are the values in arr
after the following code is executed?
for (int i = 0; i < arr.length - 2; i++)
{
int temp = arr<u>i</u>;
arr<u>i</u> = arr<u>i+1</u>;
arr<u>i+1</u> = temp;
}
Consider the Array
int[] arr = {1, 2, 3, 4, 5};
What are the values in arr
after the following code is executed?
for (int i = 0; i < arr.length - 2; i++)
{
int temp = arr<u>i</u>;
arr<u>i</u> = arr<u>i+1</u>;
arr<u>i+1</u> = temp;
}