Question: 1. Consider the following declarations : int [] beta = { 10, 5, 7, 2, 0, 4, 3}? What is stored in beta after the

1.

Consider the following declarations:

int [] beta = { 10, 5, 7, 2, 0, 4, 3}?

What is stored in beta after the following statements executes:

for (int i = 1; i < beta.length; i++)

beta[i] = beta[i-1] * beta[i];

2.

Suppose list is an array of six elements of type int. what is stored in the array list after the following Java code executes?

int[] list = new int[6];

list[0] = 5;

for (int i=1; i< list.length; i++) {

list[i] = i + i * 5;

if (i < 4)

list[i] = 2 * list[i] list[i-1];

}

3. Given the existence of an array called list declared as followes:

int[] list = {25,-45,88,3,10,-5,48,66,15,20,-24,100,16,-31,70,7};

Write a loop to sum all of the elements in the array.

4.

Given the existence of an array called list declared as followes:

int[] list = {25,-45,88,3,10,-5,48,66,15,20,-24,100,16,-31,70,7};

Write a loop to print all of the negative elements in the array.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!