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
Who is the first British in Europe ​
Vera_Pavlovna [14]

Answer:

"The British" are people statically from Great Britain in the UK.

7 0
3 years ago
4.
KATRIN_1 [288]

Income inequality and  Digital literacy prevents many people from having access to technology and the Internet.

<h3> How does digital system affect people's lives?</h3>

People do not have access to internet because of poor economic and social problems, such as fewer job opportunities, less competitive economies and others.

Other Factors such as digital literacy and low income levels, geographical restrictions, lack of zeal to use technology are known to have contributed to the digital division in the country.

Learn more about Income inequality from

brainly.com/question/24554155

6 0
3 years ago
10 points giveaway!!!!!!!!!!!!!!!!
AlekseyPX

Answer:

k

Explanation:

4 0
3 years ago
Read 2 more answers
Summarize who you believe cyber criminals are, and why?
sergij07 [2.7K]

Answer:

 The cyber criminals are the people that are engaged with getting the data in an unapproved way and furthermore mischief to the association henceforth are considered as cyber criminals.

Cyber criminals are people or groups of individuals who use innovation to committed the malicious exercises on computerized frameworks or systems with the aim of taking the organization data or individual information and producing benefit.

There are many types of cyber criminals that are:

  • Internet stalkers
  • Cyber terrorist
  • Identity thieves

5 0
4 years ago
FILL IN THE BLANK.
Veseljchak [2.6K]

Answer:

It is measured in megahertz (MHz) and gigahertz (GHz).

Hope this helps.

3 0
3 years ago
Other questions:
  • Which of the following can you NOT apply for at any FLHSMV office? A. Certificate of title B. License plates C. Vehicle registra
    15·2 answers
  • The merge process involves which two types of files?
    9·2 answers
  • You have begun a new project and want to keep all of the work you're doing on the project in its own directory. You will create
    8·2 answers
  • Mary needs to choose the _____ menu in order to place the text in a desirable fashion around the image
    12·2 answers
  • The American Footwear and Apparel Group exerts pressure
    12·1 answer
  • Function countValues = CreateArray(endValue) % endValue: Ending value of countValues
    7·1 answer
  • Define foreign key. What is this concept used for?
    6·1 answer
  • You are not sure if a certain word has an"e"at the end<br>​
    11·1 answer
  • How goes design again ones attention?
    6·1 answer
  • You have a spreadsheet of x values that need to
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!