Computers and Technology

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;
size++;
value = cin. nextint();
}

1. reads one value and places it in the remaining first unused space endlessly.
2. crashes at runtime because it tries to write beyond the array.
3. reads up to 3 values and places them in the array in the unused space.
4. reads up to 3 values and inserts them in the array in the correct position.

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 16:00, carlosleblanc26
This statement accurately describes how headlines should be placed in business documents.
Answers: 3
image
Computers and Technology, 22.06.2019 18:00, alyssacyamamoto8050
Budgets you to do all of the following expect a) send frivolously b) avoid over spending c) gain financial independence d) examine your priorities and goals
Answers: 2
image
Computers and Technology, 22.06.2019 20:50, ashiteru123
What is the difference between windows 7 and windows 10?
Answers: 1
image
Computers and Technology, 23.06.2019 14:00, LuvIsRage2
Technician a says that with self-adjusting clutch systems, the release bearing constantly rotates. technician b says that the ball bearing portion of the release bearing should be lubricated with high-temperature grease during routine maintenance. which technician is correct?
Answers: 2
Do you know the correct answer?
Consider the partially-filled array named a. what does the following loop do? (cin is a scanner obj...

Questions in other subjects:

Konu
Mathematics, 04.02.2020 01:48
Konu
Mathematics, 04.02.2020 01:48
Konu
Chemistry, 04.02.2020 01:48