Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications Dexa 2021 Workshops Biokdd Iwcfs Mlkgraphs Al Cares Protime Alsys 2021 Virtual Event September 27 30 2021 Proceedings

Authors: Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil ,Bernhard Moser ,Atif Mashkoor ,Johannes Sametinger ,Anna Fensel ,Jorge Martinez-Gil ,Lukas Fischer

1st Edition

3030871002, 978-3030871000

More Books

Students also viewed these Databases questions