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
Ganezh [65]
3 years ago
10

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 (value > 0){a[size] = value;size++;value = cin.nextInt();}1. May crashe at runtime because it can input more elements than the array can hold2. Reads up to 3 values and inserts them in the array in the correct position.3. Reads one value and places it in the remaining first unused space endlessly.4. Reads up to 3 values and places them in the array in the unused space.
Computers and Technology
1 answer:
boyakko [2]3 years ago
8 0

Answer:

Option 1: May crash at runtime because it can input more elements than the array can hold

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 (value > 0)
  5.        {
  6.            a[size] = value;
  7.            size++;
  8.            value = cin.nextInt();
  9.        }

From the code above, we know the <em>a</em> is an array with six elements (Line 1). Since the array has been initialized with six elements, the capacity of the array cannot be altered in later stage.

However, a while loop is created to keep prompting for user input an integer and overwrite the value in the array started from index 3 (Line 4- 9). In every round of loop, the index is incremented by 1 (Line 7). If the user input for variable <em>value</em> is always above zero, the while loop will persist.  This may reach a point where the index value is out of bound and crash the program. Please note the maximum index value for the array is supposedly be 5.  

You might be interested in
1. Which markup language adds the ability to use video without requiring the user to download add-ons?
aniked [119]

HTML5

HTML5 has fewer plug-ins like the ability to standardize how audio and video are presented on a Web page. It introduces the <video> element designed to remove the need to install 3rd party add-ons and plug-ins like adobe flash player. It also adds the <audio> element  too that allows pages to smoothly add audio files.

3 0
3 years ago
What properties make it suitable to be used for musical instruments?
Stolb23 [73]
<h2>Many properties can be listed out viz. durability, quality, the sound that it produces also depends on the material that is used, etc.</h2>

Explanation:

1. If you take wood then I would say maple, rosewood, cedar, walnut can be used to make "String instruments".

Reason:

The wood that we choose should be perfect and should give long-life to use the instrument.

2. If we consider about strings, then I would suggest that the material that you choose should be "ductile and hard".

Reason:

Thin wires can be drawn.

3. In case of Brass, it should be "malleable metal", so that the outcome of the instrument will satisfy the need.

7 0
3 years ago
Which Additional Authorization List item can replace the hook at the end of the winch cable for fastening the cable to some load
satela [25.4K]

Answer:

Shackle

Explanation:

A winch may be defined as a mechanical device which is used to pull in or let out the rope or cable maintaining its tension. It can also adjust the tension of the cable or the rope.

It is mainly used in tow trucks, elevators and steam shovels.

Shackle is one of the additional authorization list of a vehicle with a winch which can be used to replace the hook of the cable of the winch.

8 0
3 years ago
PLEASE HELP WILL MARK BRAINLIEST ASAP
Charra [1.4K]

Answer:

This is a heading

Explanation:

This is a paragraph does not exist. You would simply use p for paragraph. Therefore This is a heading is the correct answer.

8 0
2 years ago
Which technology concept uses computer resources from multiple locations to solve a common problem?​
umka2103 [35]

Answer:

Distributed memory systems

Distributed memory systems use multiple computers to solve a common problem, with computation distributed among the connected computers (nodes) and using message-passing to communicate between the nodes.

Explanation:

5 0
3 years ago
Other questions:
  • _________ is the process of scanning the network to find out which Internet Protocol (IP) addresses are attached to potentially
    9·1 answer
  • What is a color that cannot be created by mixing other colors together?
    15·2 answers
  • Why is Abraham called the Father of Believers?
    6·1 answer
  • When the continue statement is encountered in a loop, all the statements in the body of the loop that appear after it are ignore
    5·1 answer
  • What is the second stage of information processing cycle​
    10·2 answers
  • 5. The command to add new layout to the slide is present in<br>tab.​
    15·1 answer
  • What is the correct order for writing the 3 dimensions for a 3D object? Here are the 3 dimensions:
    15·1 answer
  • The term Linux Intrusion Detection System ( LIDS) refers to a command that allows an administrator to run processes as root with
    5·1 answer
  • SUB2 WWolfPlays on yt <br><br><br> true or false if false ima cri
    8·2 answers
  • One word for The characters typed by a user using a<br> keyboard.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!