Question
5. Determine whether the following array declarations are valid. If a declaration is valid, determine the size of the array. a. int list[] = {18,
5. Determine whether the following array declarations are valid. If a declaration is valid, determine the size of the array. a. int list[] = {18, 13, 14, 16}; b. int x[10] = {1, 7, 5, 3, 2, 8}; c. double y[4] = {2.0, 5.0, 8.0, 11.0, 14.0}; d. double lengths[] = {8.2, 3.9, 6.4, 5.7, 7.3}; e. int list[7] = {12, 13, , 14, 16, , 8};
6. What is the output of the following C++ code? #include
7. Is each of the following a valid or invalid array definition? (If a definition is invalid, explain why.) a) int numbers[10] = {0, 0, 1, 0, 0, 1, 0, 0, 1, 1}; b) int matrix[5] = {1, 2, 3, 4, 5, 6, 7}; c) double radii[10] = {3.2, 4.7}; d) int table[7] = {2, , , 27, , 45, 39}; e) char codes[] = {'A', 'X', '1', '2', 's'}; f) int blanks[]; g) char name[6] = "Joanne";
8. Given the following array definition: int values[] = {2, 6, 10, 14}; What does each of the following display? a) cout << values[2]; b) cout << ++values[0]; c) cout << values[1]++; d) x = 2; cout << values[++x];
9. Fill in the table below so it shows the contents of the following array: int table[3][3] = {{2, 3}, {7, 9, 2}, {1}};
10. Consider the following array definition: int values[5] = { 4, 7, 6, 8, 2 }; What does each of the following statements display? cout << values[4] << endl; __________ cout << (values[2] + values[3]) << endl; __________ cout << ++values[1] << endl; __________
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started