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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started