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
Use the {blank} to view your presentation the way an audience will see it.
steposvetlana [31]
I would believe it would be A. Slide Show Button
4 0
2 years ago
Read 2 more answers
Write the icon of full justification​
ad-work [718]

Answer:

In the paragraph group, click the Dialog box Launcher. ,and select the Alignment drop - down menu to set your justified text. You can also use the keyboard shortcut , Ctrl + J to justify your text

6 0
2 years ago
Subscribe to epic beast brothers thank you
nikdorinn [45]
No ono moñón Ik Jkjkjk
5 0
3 years ago
Which emails go to the draft folder
castortr0y [4]

Answer:

Hi there, the only emails that go to the draft folder are the emails that you start to write and then you don't finish it so you can go back and finish writing it later.

Explanation:

<h2>Hope this helps!! Please consider marking brainliest! Have a good one!!</h2>
6 0
3 years ago
Read 2 more answers
(9/5)C+32 write QBASIC expessions for this​
grigory [225]

Answer:

REM PROGRAM TO CONVERT TEMPERATURE IN CELCIUS TO FARENHEIT

CLS

INPUT “ENTER TEMPERATURE IN CELCIUS”; C

F = C * (9 / 5) + 32

PRINT “TEMPERATURE IN FARENHEIT=”; F

END

Explanation:

Your formula suggests a celcius to fahrenheit conversion...

8 0
3 years ago
Other questions:
  • Briefly describe "SoftwareEngineering Framework". Do provide examples and diagrams wherenecessary.
    15·1 answer
  • How would you say an hard drive works
    9·2 answers
  • Which of the following is not a common network architecture type?
    9·1 answer
  • It is important to ____ the line in the code editing window in the exact location where you want to insert a code snippet to pro
    10·1 answer
  • "This part of the computer fetches instructions, carries out the operations commanded by the instructions, and produces some out
    15·1 answer
  • What was the major sign that lead Professor Shiller to predict the crash of the housing market​
    6·1 answer
  • If you are a member of a security penetration testing team, and you identify vulnerabilities and exploits, what should you obtai
    11·1 answer
  • Can someone help please
    12·1 answer
  • This is the term for the manual process of editing strips of the film before digital editing was created. The term is still used
    9·1 answer
  • How to edit slides into video.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!