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
anygoal [31]
3 years ago
6

Consider the partially-filled array named a. What does the following loop do? (cin is a Scanner object)int[] a = {1, 3, 7, 0, 0,

0};int size = 3, capacity = 6;int value = cin.nextInt();while (size < capacity && value > 0){a[size] = value;}
1. Reads up to 3 values and places them in the array in the unused space.
2. Reads one value and places it in the remaining first unused space endlessly.
3. Reads up to 3 values and inserts them in the array in the correct position.
4. Crashes at runtime because it tries to write beyond the array.
Computers and Technology
1 answer:
lozanna [386]3 years ago
4 0

Answer:

Option 2: Reads one value and places it in the remaining first unused space endlessly.

Explanation:

Given the code as follows:

  1. int[] a = {1, 3, 7, 0, 0, 0};
  2. int size = 3, capacity = 6;
  3. int value = cin.nextInt();
  4. while (size < capacity && value > 0)
  5. {
  6.              a[size] = value;  
  7. }

The a is an array with 6 elements (Line 1). The program will prompt the user for an integer and assign it to variable <em>value </em>(Line 3).

The while loop have been defined with two conditions, 1) <em>size < capacity </em>and <em> value > 0</em>. The first condition will always be true since the size and capacity are <em>constant</em> throughout the program flow and therefore<em> size</em> will always smaller than capacity.

Hence, if user input an integer larger than 0, the while loop will infinitely place the same input value to the remaining first unused space of the array, <em>a[3]</em>.

You might be interested in
The development methodology where each part of a project is done in order after each other is called:
Oksanka [162]

Bruh this a duplicate

8 0
3 years ago
Suppose you were assigned to develop a logical model of the registration system at a school or college. Would you be better off
BaLLatris [955]

Answer:

top down approach

Explanation:

Top down approach is process of breaking down system into sub-system which helps in formulating the overall system. At the end every sub system can be refined with more details.

While bottom up approach is process of gathering systems to design large complex system.

Top down is better as basic information is present and resources can be utilized effectively without impacting maintennance and operations.

6 0
3 years ago
Where can buy a piece of robots for my class
PSYCHO15rus [73]
You’d be better off just searching robot parts on google
6 0
3 years ago
Define Proportional spacing fornt.​
givi [52]

Answer:

Alphabetic character spacing based on the width of each letter in a font. ... Proportional spacing is commonly used for almost all text. In this encyclopedia, the default text is a proportional typeface, and tables are "monospaced," in which all characters have the same fixed width.

hope this answer helps u

pls mark me as brainlitest .-.

7 0
3 years ago
After the recursive sorting step, ____ does not need to combine the sorted sub-arrays.
loris [4]

After the recursive sorting step, merge sort does not need to combine the sorted sub-arrays.

<h3>What is merge sort?</h3>

Merge sort is an efficient, general-purpose, comparison-based sorting algorithm in computer science.

Most implementations yield a stable sort, which means that the order of equal elements in the input and output is the same.

Merge Sort can be used to sort linked lists. Merge Sort is a stable sort, which means that the same element in an array retains its original position in relation to the others.

Thus, a merge sort does not need to combine the sorted sub-arrays after the recursive sorting step.

For more details regarding a merge sort, visit:

brainly.com/question/13152286?referrer=searchResults

#SPJ4

6 0
2 years ago
Other questions:
  • The ________ occurs when the user presses the enter key without typing a value for an input operation.
    5·1 answer
  • What is software that helps a computer operate efficiently and keeps track of data on a computer?
    14·1 answer
  • A fast food chain that wants to inform consumers about its latest dollar menu item will most likely use ___ to do so. ____ may i
    7·2 answers
  • The Cursor is blinking in a white area on the Screen. This area where text will appear in the ____.
    10·2 answers
  • A single instruction carried out by a computer is called a what?
    5·1 answer
  • What values can represent a bit
    8·1 answer
  • Select all the correct answers.
    14·1 answer
  • Can you anyone please help me​
    13·1 answer
  • Choose the response that best completes the following statement.
    5·1 answer
  • Design algorithm and the corresponding flow chart for adding the subject score of 5, total value and rank.​
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!