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
Masteriza [31]
4 years ago
9

Which of these loops will initialize each element in the array ar to hold the value 4 ?A. for (int i = 1; i < ar.length; i++

) ar[i] = 4;
B. for (int i = 0; i <= ar.length; i++ ) ar[i] = 4;
C. for (int i = 0; i < ar.length - 1; i++ ) ar[i] = 4; 0%
D. for (int i = 0; i < ar.length; i++) ar[i] = 4;
Computers and Technology
1 answer:
Dima020 [189]4 years ago
8 0

Answer:

Option (d) is correct.

Explanation:

In java language "ar.length" is used to tells the size of the array. The array is used to declare more than one variable. Its index value is started from 0. so when a user needs to initialize the value of an array, they need to start the index value at 0. because ar[0] indicates the first variable of an array.

In option (d), index value is started from 0 and ends with (array_size-1). so it gives the accessed to all the variable of an array and the statement "ar[i]=4;", initialize the value 4 to all array variable.  

while another option is not valid because--

  • In option a, Index value starts from 1 which accesses the second variable of an array.
  • In option b, the statement "i<= ar.length;", gives an unbound array exception because it took the size greater than the array size.  
  • In option c, statement "i<ar.length-1;", can not give accessed to the last element of an array.

You might be interested in
_______ memory allows data to be both read from and written to easily and rapidly.
Serhud [2]
Visual memory allows data to be both read from and written to easily and rapidly.
3 0
3 years ago
A tax return preparer, routinely publishes a schedule of the fees she charges her clients. For how long must keep copies of the
Alenkinab [10]

Answer:

It is advised for the tax return preparer to keep the records for 3 years from the date she  filed your for the return or two (2) years from the date she paid the tax

Explanation:

It is advised for the tax return preparer to keep the records for 3 years from the date she  filed your for the return or two (2) years from the date she paid the tax.

This will create enough time for any form of amendment should the case arise within the period of filing this tax. if also creates avenue for claim of credit or refund, or in a case where the IRS want to assess additional tax.

The information above reflects the period of restriction that apply to income tax returns. Unless otherwise stated, the years refer to the period after the return was filed. Returns filed before the due date are treated as filed on the due date.

5 0
3 years ago
The purpose of an experiment is often based on ? A. new theories B. observations C. opinions of famous scientists D. beliefs of
ioda
B
Observation
Experiments are based on observations because it can help you determine or visualize many thing

6 0
3 years ago
What is the full form of computer​
Annette [7]

Answer:

Common Operating Machine Purposely Used for Technological and Educational Research

Explanation:

4 0
3 years ago
Read 2 more answers
DO YOU EVER FEEL LIKE A PLASTIC<br> DRIFTING THROUGH THE WIND, WANTING TO START AGAIN
Anna35 [415]

Answer:

what exactly is the question because I don't see anything

4 0
3 years ago
Read 2 more answers
Other questions:
  • Which of the following statements is false? Speaking to your computer is a form of input. Playing a video is an example of outpu
    10·1 answer
  • A(n) ____ is a collection of one or more program statements combined to perform some action
    14·1 answer
  • Write a method called evenBeforeOdd that accepts an array of integers and rearranges its elements so that all even values appear
    15·1 answer
  • Know when the double, int, String, and char data types are best used. Example: I would store a social security number in a strin
    7·1 answer
  • The user can set their own computer hostname and username. Which stage of the hardware lifecycle does this scenario belong to?
    6·1 answer
  • Which area of study involves microeconomWhich area of study involves microeconomics? A. a nation's ability to meet consumer dema
    10·1 answer
  • To see the formula in a cell, look at the___
    5·1 answer
  • Instruction: weird I know (~ ̄³ ̄)~
    5·1 answer
  • The formula in cell C9 is B9*F10. On copying this formula to cell Z9, what will be the formula​
    5·1 answer
  • 3. It is important to make certain that your employees are aware of the work ethic
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!