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
An important goal of biosecurity training is to: Prevent laboratory accidents that could expose personnel to hazardous agents. P
Anestetic [448]

Answer:

Educate laboratory directors on their role in providing a safe working environment.

Explanation:

A lab is an abbreviation for laboratory and it can be defined as a building that is equipped with scientific equipments and apparatus, which are used for performing scientific experiments, manufacturing of chemicals and drugs, research, testing and analysis of hypothesis in order to establish a theory.

Generally, laboratory scientists, technicians, students and anyone going into a laboratory are expected to obey the rules and regulations guiding the laboratory.

Hence, an important goal of biosecurity training is to educate laboratory directors on their role in providing a safe working environment.

6 0
3 years ago
What document type would be best to communicate sales items from a business to potential customer?
Mandarinka [93]

Answer: Flyer

Explanation: A flyer is a type of advertisement that is used to give out information about a certain product, event, or business. This can help communicate with potential customers.

8 0
3 years ago
Malware is any malicious software installed on a computer or network without the owner’s knowledge.
Naya [18.7K]

Answer: True

Explanation: Malware is literally short for malicious software. The name that is given to any type of software that could harm a computer system or collect a user's data.

Hope it helped please mark as brainliest!

8 0
3 years ago
Which of the following is a strength of fiscal policy?
Fynjy0 [20]
The answer to your question is b crowding out effect
7 0
3 years ago
A(n) ______ is a type of collaborative website that allows users to create, add, modify, or delete website content.
andrey2020 [161]
<span>A wiki is this type of site. The users can, anonymously or with a profile, add to or delete content already posted. This gives the community the ability to add to the overall knowledge base on a specific subject. The site tracks changes through IP addresses to make sure that changes are not done maliciously.</span>
8 0
3 years ago
Other questions:
  • What is the purpose of the BBC option in a email?
    7·1 answer
  • vulnerability is a feebleness which allows an attacker to condense a system's information assurance to security,is it true or fa
    14·1 answer
  • Text messaging is an example of nonverbal communication. Please select the best answer from the choices provided. T F
    7·2 answers
  • In Android system, an e-mail application that shows a list of new emails, composes an email, or reads an email is called (A) Ser
    9·1 answer
  • What percentage of people with internet access use emojis?
    11·1 answer
  • Assume that the following method header is for a method in class A.
    15·1 answer
  • A third-grade teacher at Potter Elementary School wants a program that allows a student to enter the amount of money a customer
    14·1 answer
  • Given two variables, is Empty of type boolean, indicating whether a class roster is empty or not, and number Of Credits of type
    10·1 answer
  • Victor works for a telemarketing company that is on a very tight budget. He has been tasked with finding a method for the compan
    7·2 answers
  • Moving your Sprite from right to left is considered the X coordinate?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!