1. Suppose int i = 5, which of the following can be used as an index for array double t[100]?
2. Analyze the following code: #include using namespace std; void reverse(const int list[], const int size, int newList[]) { for (int i = 0; i < size; i++) newList[i] = list[size - 1 - i]; } int main() { int list[] = {1, 2, 3, 4, 5}; int newList[5]; reverse(list, 5, newList); for (int i = 0; i < 5; i++) cout << newList[i] << " "; return 0; }
| The program displays 1 2 3 4 6. |
| The program displays 1 2 3 4 5 and then raises an ArrayIndexOutOfBoundsException. |
| The program displays 5 4 3 2 1. |
| The program displays 5 4 3 2 1 and then raises an ArrayIndexOutOfBoundsException. |
3. What will be displayed by the following code? char s2[7] = "Dallas"; char s1[14] = "Dallas"; strcat(s1, s2); cout << s1;