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, 23.06.2019 06:30
How do you write an argumentative essay about the importance of free enterprise ?
Answers: 1
question
Computers and Technology, 23.06.2019 13:30
Drag the tiles to the correct boxes to complete the pairs. match the errors with their definitions. #name #value #ref when a formula produces output that is too lengthy to fit in the spreadsheet cell arrowright when you enter an invalid cell reference in a formula arrowright when you type text in cells that accept numeric data arrowright when you type in a cell reference that doesn’t exist arrowright reset next
Answers: 1
question
Computers and Technology, 23.06.2019 21:30
Write a fragment of code that reads in strings from standard input, until end-of-file and prints to standard output the largest value. you may assume there is at least one value. (cascading/streaming logic, basic string processing)
Answers: 3
question
Computers and Technology, 24.06.2019 19:30
Which phrase is the best definition of a pivottable a a table containing data that is organized horizontally b a table used to calculate financial pivot values c a tool used to summarize data d a table containing specific formatting
Answers: 1
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
Social Studies, 06.07.2019 03:00
Questions on the website: 13722362