C++ Arrays – Flashcards

Unlock all answers in this set

Unlock answers
question
int scores[25];
answer
Declare an array named scores of twenty-five elements of type int .
question
char streetAddress [80];
answer
Write a statement that declares an array of char named streetAddress that contains exactly eighty elements .
question
Another variable or array will very likely be unexpectedly modified.
answer
Suppose v is an array with 100 int elements. If 100 is assigned to v[100], what happens?
question
a[0]
answer
Given the array a, write an expression that refers to the first element of the array .
question
a[33]
answer
Given an array a, declared to contain 34 elements , write an expression that refers to the last element of the array .
question
salarySteps[4]=160000;
answer
Assume that an array of integers named salarySteps that contains exactly five elements has been declared . Write a statement that assigns the value 160000 to the last element of the array salarySteps.
question
a[k]=15;
answer
Assume that an array of int named a has been declared with 12 elements and that the integer variable k holds a value between 0 and 6. Assign 15 to the array element whose index is k.
question
a[k+1]=9;
answer
Given that an array of int named a has been declared with 12 elements and that the integer variable k holds a value between 0 and 6. Assign 9 to the element just after a[k].
question
double taxRates[5]={0.10,0.15,0.21,0.28,0.31};
answer
Declare an array named taxRates of 5 elements of type double and initialize the elements (starting with the first) to the values 0.10, 0.15, 0.21, 0.28, 0.31, respectively.
Get an explanation on any task
Get unstuck with the help of our AI assistant in seconds
New