What is the output of the following code (assuming it is embedded in a correct and complete program)?
```
char letter[5] = {'o', 'k', 'c', 'e', 'g'};
for(int i = 4; i >= 0; i-- )
cout << letter[i];
cout << endl;
```
a) okceg
b) gecko
c) ecko followed by a character from an out of bounds access.
d) kceg followed by a character from an out of bounds access.
e) Correct answer not listed. Specify what the output is.
b) gecko
a) traverses the array in the opposite direction than the code specifies. c)
presumably starts at the 4 th position maybe because it counts 1 as the first array item,
so runs so off the end of the array. This one does run in the right direction. d) is like
c) but it runs the wrong direction.
You might also like to view...
Word documents can be saved as ________ that can be viewed by web browsers such as Internet Explorer
A) prototypes B) web pages C) main documents D) templates
The Margins button is found on the ________ group under the Page Layout tab
A) Page Background B) Page Setup C) Theme D) Paragraph