# Tracing Array of Integers Practice Quiz

If you’re preparing for the Computer Science AP-A Exam, you’ll want to be very good with arrays. Here’s a small little quiz to get you some practice.

What is output by the following Java code?

```int[] nums = {29, 7, 56, 19, 26, 22, 54, 53};
int s = 0;
for (int i=1; i<nums.length; i++) {
if (nums[i] < s) {
s = nums[i];
}
}
System.out.println(s);
```

What is output by the following Java code?

```int[] nums = {29, 7, 56, 19, 26, 22, 54, 53};
int s = 0;
for (int i=1; i<nums.length; i++) {
if (nums[i] > s) {
s = nums[i];
}
}
System.out.println(s);
```

What is output by the following Java code?

```int[] a = {29, 7, 56, 19, 26, 22, 54, 53};
int[] b = {1, 7, 5, 3, 4, 2, 0, 6};

int s = 0;
for (int i=1; i<b.length; i+=2) {
s += a[b[i]];
}
System.out.println(s);
```

What is output by the following code?

```int[] nums = {1, 4, 3, 2, 7, 8};
int s = -5;
for (int i=1; i<nums.length; i+=2) {
s += nums[i];
}
System.out.println(s);
```

What is the output from the following Java code?

```int[] a = {29, 7, 56, 19, 26, 22, 54, 53};

int s = 0;
for (int i=a.length - 1; i>0; i--) {
s += a[i];
}
System.out.println(s);
```

Question 1 of 5