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
A technician is working at a client's office after hours and needs two cables to finish the work but does not have immediate acc
svetlana [45]

Answer:

The following are the answers of the given scenario.

  • Crimper
  • Cable tester
  • Cable stri.pper

Explanation:

After hours, the specialist operates at that same customer's workplace as well as wants several wires to complete the job, although it would not provide direct links for pre-built wires. The wire required seems to be a dial-up link from the dial-up network to an original analog POTS port on a wall. Another wire would be to attach an Ethernet from the device to that of the current keystone port on that same wall.

Thus, Crimper, Cable Tester and Cable Stri.pper are the same equipment that the specialist needs to use to create the wires as well as then check whether these all operate correctly.

3 0
3 years ago
ENG103 DISCUSSION BOARD 5
ehidna [41]
Plagiarism is a crime, flat out. It is unethical and immoral to copy, verbatim, another persons work and claim it as your own, especially for scholastic uses. In order to avoid plagiarism, it is important that we give accurate references and paraphrase, rather that copy and paste information. It is important to consider the widespread effect of plagiarism. It effects all involved: The student, the owner of the information, the instructor, and even the site from which the information was stolen. Use the proper channels and be honest when completing assignments goes a long way. We must do what we can to prevent plagiarism, starting with ourselves and our own research. <span />
5 0
3 years ago
Given the option of receiving a generic r_sum_ or a tailored r_sum_, employers prefer generic r_sum_s.
krek1111 [17]
<span>It is false that given the option of receiving a generic r_sum_ or a tailored r_sum_, employers always prefer generic r_sum_s. This is false because rarely do employers need something generic from you - they'd always want you to present them with a specific result because that is more important to them than receiving something general and common.</span>
3 0
3 years ago
have a folder on your Windows computer that you would like to share with members of your development team. Users should be able
sladkih [1.3K]

Answer:

Create a group and make all user accounts members of the group.

Explanation:

8 0
3 years ago
Why might a programmer want to define his or her own functions? What are some potential disadvantages? How might new functions m
Genrish500 [490]

Answer:

We have to define our functions as well, and that is known as the user-defined functions. And to be precise we should not worry at all, as there is no potential disadvantage of the functions we define on our own. The only disadvantage can be that it might not be in a standard format. However, we have design patterns now, and each programmer knows the required format hence. However, for a layman, this can be a problem. And that is the only potential disadvantage related to the user-defined function.Explanation:

6 0
2 years ago
Other questions:
  • What is used for World Wide Web?
    7·1 answer
  • "If someone really wants to get at the information, it is not difficult if they can gain physical access to the computer or hard
    11·1 answer
  • Modify the provided code file to create a workout tracking program that lets the user enter (from the console) the distance they
    6·1 answer
  • Please help with the question no. 5 and 7 please help ​
    6·1 answer
  • Sequential codes may be used to represent complex items or events involving two or more pieces of related data.
    7·1 answer
  • Vendors who use open source as part of their product offerings can expect to bring new products to the market faster because: Gr
    11·1 answer
  • You're working in a table that has three columns and five rows. Since the first row will be a header row, you want it to span al
    6·1 answer
  • Larry does not want to save his internet browsing details on his computer. What files should Larry delete to clear his informati
    13·2 answers
  • Have y’all enjoyed The new hero floryn from Mobile legends
    6·1 answer
  • Which quality should an experiment have to be replicable and valid? O clearly detailed results O a well-cited research paper O s
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!