1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
adoni [48]
3 years ago
5

Consider the program below: public class Test { public static void main( String[] args ) { int[] a; a = new int[ 10 ]; for ( int

i = 0; i < a.length; i++ ) a[ i ] = i + 2; int result = 0; for ( int i = 0; i < a.length; i++ ) result += a[ i ]; System.out.printf( "Result is: %d\n", result ); } // end main } // end class Test The output of this program will be:
Computers and Technology
1 answer:
Anna11 [10]3 years ago
3 0

Answer:

Result is: 65

Explanation:

To analyze this code let us asign line numbers:

  1. public class Test {
  2.    public static void main( String[] args )
  3.    { int[] a; a = new int[ 10 ];
  4.        for ( int i = 0; i < a.length; i++ )
  5.            a[ i ] = i + 2;
  6.        int result = 0;
  7.        for ( int i = 0; i < a.length; i++ )
  8.            result += a[ i ];
  9.        System.out.printf( "Result is: %d\n", result );
  10.    }
  11. }

On line 3, an array of ints is created of size 10

On line 4 and 5 a for loop is used to add values to the array. at the end of the execution of line 4 and 5, the array will contain the following elements: [2, 3, 4, 5, 6, 7, 8, 9, 10, 11]

On line 6 an int variable result is created and initialized to 0

line 7 and 8 allows a for loop through the array adding up all the elements of the array and assigning them to result

Line 9 outputs the value of result (Which is the total sum)

You might be interested in
Which best describes the benefits of renting a home
ANTONII [103]
Is it multiple choice or an essay question? If its an essay question I would say Living alone, being able to rent YOU'RE own home, and probably being able to decorate it the way you want. 
5 0
3 years ago
Read 2 more answers
Which of the following is normally mutually exclusive<br> Read only files<br> Printer<br> WIFI
marin [14]

Answer:

the answer is going to be printer

5 0
2 years ago
I need help with this question. asap please
marissa [1.9K]

Answer:

what are you talking about

Explanation:

can you help me with my question

8 0
2 years ago
. What year did the USA host World Cup? Right answer 1994
Ksivusya [100]

Answer:

USA host World Cup in 1994 1994 FIFA World Cup

Explanation:

USA host World Cup in 1994 FIFA World Cup

it was the 15th edition of FIFA World Cup

and Brazil was won the tournament

Brazil beat Italy by 3–2 in  penalty shoot-out

it was play between 17 June to 17 July and 24 team play this World Cup

and there matches played = 52

and 9 cities host this game

United States of America was chosen as the host by FIFA on the 4 July, 1988

5 0
3 years ago
Based on the chart below, which pie flavors make up approximately one-half of the total? A pie chart shows the following pie fla
Vladimir [108]
Based on the data, a combination of strawberry rhubarb (12%), chocolate mud pie (23%) and cherry (14%) would amount to 49% which is close to half of the pie chart or 50%. Another probable answer is the combination of coconut (9%), banana cream (10%), pumpkin (11%), and other (21%) which is equal to 51%.
8 0
3 years ago
Read 2 more answers
Other questions:
  • The process of converting information, such as text, numbers, photos, or music, into digital data that can be manipulated by ele
    7·1 answer
  • Your computer running Windows 7 is doing some very strange things with the operating system. You are fairly certain it is not a
    10·1 answer
  • What is a binary message
    12·2 answers
  • Suppose you have a 16-bit machine with a page size of 16B. Assume that any unsigned 16-bit integer can be a memory address. Also
    9·1 answer
  • You are given two processors P1 and P2 that execute the same instruction set but have different architectures. The instructions
    9·1 answer
  • How to create a network of relevant prospects?
    5·1 answer
  • Plsss help me<br>give two examples of problems that can occur when sytems do not work properly​
    9·1 answer
  • How many hours do you spend on the Internet per day?
    11·2 answers
  • State whether the given HTML coding is True or False. &lt;HR SIZE=5 COLOR=YELLOW ALIGN=RIGHT WIDTH=75%&gt;​
    9·1 answer
  • which two statements about incoming and outgoing interfaces in firewall policies are true? (choose two.)
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!