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
Phantasy [73]
3 years ago
12

What set of code correctly initializes all elements of the array ar to the value 0, given the declaration

Computers and Technology
1 answer:
Veronika [31]3 years ago
7 0

Answer:

The correct answer is:

C. ndx = 0;

while (ndx < 3) {

ar[ndx] = 0;

ndx++;

}

Explanation:

The declaration given is:

int ar[3];

This means the array consists of three locations and is named as ar.

We know that the indexes are used to address the locations of an array and the index starts from 0 and goes upto to 1 less than the size of the array which means the indexes of array of 3 elements will start from 0 and end at 2.

Now in the given options we are using ndx variable to run the while loop.

So the code to assign zero to all elements of array will be

ndx = 0;

while(ndx<3)

{

ar[ndx] = 0;

ndx++;

}

Hence, the correct answer is:

C. ndx = 0;

while (ndx < 3) {

ar[ndx] = 0;

ndx++;

}

You might be interested in
What is the role of consumers in determining what is produced in a market economy
gregori [183]

Consumer preferences and resource scarcity determine which goods are produced and in what quantity; the prices in a market economy act as signals to producers and consumers who use these price signals to help make decisions.

(i got this from google btw)

hope this helped :) pls give branliest

3 0
4 years ago
Read 2 more answers
5. Write a program to remove any duplicate letters from a word and display the new word maintaining the original order. For exam
dexar [7]

Answer:

word = input('Enter a single word: ', 's');

n = length(word);

nodupWord = [];

for i = 1:n

  dup = false;

  c = word(i);

  for j = 1:i-1

      if word(j) == c

          dup = true;

          break;

      end

  end

  if ~dup

      nodupWord = [nodupWord, c]; %add the non-duplicate char to end

  end

end

disp(['Adjusted word: ', nodupWord])

Explanation:

The code is in Python.

3 0
3 years ago
Running fewer applications at once is a way to resolve which type of bottleneck?
vichka [17]
The answer is <span>memory.  </span>Running fewer applications at once is a way to resolve the bottleneck in <span>memory.  </span>Run fewer programs at the same time and restarting a PC regularly, is a good way to clear out its memory.
6 0
3 years ago
What does this icon mean? <br> Plz hurry it’s for a school quiz you will get a brainly
Vera_Pavlovna [14]

Answer:

Filter data

Explanation:

If u dont believe me here is a pic

8 0
3 years ago
Repayment of a direct plus loan begins:
just olya [345]
The answer is D I hope i'm right


4 0
4 years ago
Read 2 more answers
Other questions:
  • when applying styles to a document, which features of the style can be modified in the themes grouping?
    9·2 answers
  • In certain programming languages, comments appear between delimiters such as /# and #/. Let C be the language of all valid delim
    15·1 answer
  • In a TCP session hijacking attack, if the server is waiting for data starting from sequence number X, but we used X 100 in our a
    13·2 answers
  • What laws are broken when you hack someone?
    9·1 answer
  • The Hydrosphere contains (4 points)
    10·1 answer
  • When an item is gray that means...
    15·2 answers
  • If any one answered this i will give brilientst what is stimulation program​
    6·1 answer
  • In a typical day, what types of Computer-Mediated Communication do you use?
    8·1 answer
  • A company Digicom Parts manufactures 2 types of unique products for laptop and desktop computers. It manufactures 10 types of la
    15·1 answer
  • What security setting can cause a mobile device to erase installed apps and data if the passcode is incorrectly entered a number
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!