?

AP® Computer Science A

Free Version

Upgrade subject to access all content

Moderate

Evaluating Numeric Expression with Math Class and Array

APCSA-BEDEKJ

Given an array of integers named nums, when will the following statement result in w being a positive non-zero number?

int w = Math.abs(nums[0] + nums[nums.length-1])/10;
A

When nums is an empty array.

B

When nums has only one element with a value of 5.

C

When the first element in nums is a 6 and the last element is a -5.

D

When nums is an array of a 100 elements, each with a value from -4 to 4, both inclusive.

E

When nums is an array of non-repeating integers from 0 to 9, in descending sequence.