subject

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.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 09:00
Which best describes the condition under which the unicode output is the same as plain text?
Answers: 3
question
Computers and Technology, 23.06.2019 02:30
Which component acts as a platform on which application software runs
Answers: 2
question
Computers and Technology, 23.06.2019 15:20
In a game with three frames, where will the objects on layer 1 appear? a. next to the play area b. in the middle of the game c. behind everything else d. in front of everything else
Answers: 1
question
Computers and Technology, 23.06.2019 20:30
Column a of irma’s spreadsheet contains titles for each row, but her document is too big and will be printed three pages across. she wants to be sure that every page will be understood. what can irma do to with this problem?
Answers: 3
You know the right answer?
Consider the partially-filled array named a. what does the following loop do? (cin is a scanner obj...
Questions
question
English, 08.07.2019 19:00
question
Mathematics, 08.07.2019 19:00
Questions on the website: 13722363