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...
Answer the following statements true (T) or false (F)
1) Objects can hide their implementation from other objects. 2) The data components of a class are called instance variables. 3) Instances of a class are called class variables. 4) Programmers should not take into consideration that their code will be modified.
Large sound and video files cause the most trouble for users with low-____ connections.
A. bandwidth B. resolution C. frequency D. intensity
Style rules that appear later have more weight.
a. Selector b. Specificity c. Inheritance d. Order
Metacharacters that specify the quantity of a match qualifiers.
Answer the following statement true (T) or false (F)