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
What are backup storage device of computer ?​
ira [324]
Sd/ external hard drives
7 0
2 years ago
Read 2 more answers
A database on a mobile device containing bands, sub-bands and service provider IDs allowing the device to establish connection w
VashaNatasha [74]

Answer:

A. PRL

Explanation:

Mobile phone technologies like CDMA , GSM etc, are used by cell/ mobile phone to transmit and receive signals. With the limitation of fluctuation, a mobile phone was made to adapt to this problems, thereby combining this broadbands like CDMA, GSM,4G LTE etc gave rise to PRL (Preferred roaming list) database to hold information needed to establish connection to the correct cell tower for these broadbands.

3 0
4 years ago
Rachael has been posting negative comments on several of her peers' social media pages. Which of the six Ps is Rachael abusing?
posledela
The answer is D. Personification
4 0
4 years ago
While it might be considered "old-school," which action should you take if you are unsure how a page will print, even after look
coldgirl [10]

Answer:

The correct answer is D

4 0
3 years ago
Imagine you are asked to set up a network for connecting 50 computers in an office environment. Discuss the type of network you
Contact [7]
Here's an outline

(I suck at writing)

hope this helps!!

7 0
3 years ago
Other questions:
  • Angela wrote some lines of code that she wants to test. She will need to use __________. IDLE open source a prompt a file path
    15·2 answers
  • Which statement is used to create a file object that will append data to an existing file? BufferedWriter salesdata =
    9·2 answers
  • After a worksheet has been displayed in page layout view, page breaks are indicated by ________ in normal view.
    14·1 answer
  • 5. What are the two main functions performed by UPS​
    12·1 answer
  • we studied FIFO, Priority, Round Robin (RR), and Weighted Fair Queueing (WFQ) packet scheduling disciplines. Which of these queu
    12·1 answer
  • Mila received a new DVD player that she is trying to connect to the back of her television by feel alone. The first stage of mem
    11·1 answer
  • When power is completely removed from your computer
    11·1 answer
  • Which tags do you use to write the header and items of an ordered list on a web page?
    14·1 answer
  • How many parts make up a web address? One To Three​
    6·1 answer
  • Which of the following was the first computer-animated film to win animated film to win an academy award?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!