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
vodka [1.7K]
4 years ago
10

What does a contain after the following code runs?int[] a = {1, 3, 7, 0, 0, 0};int size = 3, capacity = 6, value = 5;int pos = 0

;for (pos = 0; pos < size; pos++)if (a[pos] < value) break;for (int j = size; j > pos; j--)a[j] = a[j - 1];a[pos] = value;size++;
Computers and Technology
1 answer:
Lady bird [3.3K]4 years ago
3 0

Answer:

a={5,1, 3,7, 0, 0}

Explanation:

when the code runs,

a={1, 3, 7, 0, 0, 0} , size=3, capacity=6 ,value=5,pos=0.

When loop starts pos is zero for pos 0,1 if conditon is true and loop breaks and moves to next loop.

On first iteration pos is 0 and j is 3. it moves element at 3rd index to 2.

On second iteration pos is 0 and j is 2. it moves element at 2nd index to 1.

On third iteration pos is 0 and j is 1. it moves element at 1st index to 0.

On fourth iteration pos is 0 and j is 0.Hence the condition for loop is false and the code inside does not run. This behavior  is followed until loop completes all iterations

As pos is not changing after each iteration 0th index is 5.

You might be interested in
Write a program whose input is a string which contains a character and a phrase, and whose output indicates the number of times
shusha [124]

Answer:

The program in Python is as follows:

print("Enter a character followed by a phrase",end='')

word = input(": ")

char = word[0]

print("Occurrence: "+str((word.count(char))-1))

Explanation:

The prints an instruction to the user on how to input to the system

print("Enter a character followed by a phrase",end='')

This prompts and gets the user for input

word = input(": ")

This extracts the character from the input string

char = word[0]

This counts and prints the number of occurrence of the extracted character

print("Occurrence: "+str((word.count(char))-1))

6 0
3 years ago
What are the texture of metamorphic​
Flauer [41]

Answer:

This seems to be a Geography question, However, I am answering. The Metamorphic rock textures lies in two larger groups. They are the Non-Foliated and the Foliated.

Explanation:

The answer above explains everything. However, we need to understand the Foliation, and exactly what it is. It is actually developed in the rock through parallel alignment of various minerals(platy), like muscovile, chlorite and biotite, as well as minerals which are needle type such as homblende or feldspars, which are the various tabular minerals.

5 0
3 years ago
Complete the following statement: Sustainability is: Choose all that apply.This task contains the radio buttons and checkboxes f
const2013 [10]

Answer:

E. Leading the way to a new kind of future for the environment, the economy, and society.

Explanation:

We can look at Sustainability to mean the way of meeting our own needs without compromising the ability of future generations to meet their.

In sustainability the focus is not on the now only, rather it puts into consideration the fate the future generation will face.

Hence, it is Leading the way to a new kind of future for the environment, the economy, and society.

8 0
4 years ago
The calculation of GDP is the sum of: Consumption, Investment, Government Spending, and Net Exports. What is the simple formula
12345 [234]
The correct answer is B
3 0
3 years ago
If you experience a denial-of-service attack, you can use firewall logs to determine the _______ from which the attack originate
suter [353]
<span>The answer is IP address.  If you experience a denial-of-service attack, you can use firewall logs to determine the IP address from which the attack originated.</span>
6 0
3 years ago
Read 2 more answers
Other questions:
  • Re-write the following arithmetic expressions as Scheme expressions and show the result of the Scheme interpreter when invoked o
    13·1 answer
  • A short circuit locator should be periodically run along the cords used in a shop to check for shorts and open circuits. A.)True
    12·2 answers
  • The process of providing and denying access to objects is called:
    5·1 answer
  • 80 points two simple computer questions
    13·2 answers
  • You recently created several new user accounts in the Sales OU and configured them with the appropriate group membership, logon
    12·1 answer
  • Which philosopher believed that if we carefully examine the contents of our experience, we find that there are only two distinct
    10·1 answer
  • Roblox published a series of videos to help their audience use their creation engine, what are they called?
    7·2 answers
  • Use a for/else loop to traverse through the key names in the dictionary below in order to find Mr. Potatohead’s mailing address.
    7·1 answer
  • You are writing code to store the length of a side of a square. Which one is a good variable name
    9·1 answer
  • An Accenture healthcare client is interested in implementing an Artificial Intelligence (AI) solution to improve patient care, b
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!