Describe the four basic elements of counter-controlled iteration.
What will be an ideal response?
Counter-controlled repetition requires a control variable (or loop counter), an initial
value of the control variable, an increment (or decrement) by which the control variable
is modified each time through the loop, and a loop-continuation condition that
determines whether looping should continue.
You might also like to view...
Which of the following is not a disadvantage of trying to modify a sequential access file?
a. Modifying data can potentially destroy other data. b. It may be necessary to rewrite every record in the file to make a slight change. c. Things that are stored in the same number of “raw data” bytes internally may not take up the same amount of space in a file. d. Overwriting a record with another record of the same size is very difficult.
Which of the following function calls is valid for the function prototype?
int calculation (int m, char p, float q); // function prototype ) cout << calculation (3, “yes”, 2.0); b) cout << calculation (5, p, 4.5); c) cout << calculation (5, ‘s’); d) cout << calculation (10, ‘r’, 7.0);
In Photoshop, with the GIF/PNG8 format, the ____ setting should be avoided unless you want a stylized look.
A. Palette B. Loss C. Remove unused colors D. Sharpen color edges
What would be the purpose of creating a more general abstract class called AbstractCollection?
A. to group methods used by a single subclass B. to hide the details of the methods used in your abstract classes C. to create objects from a client application D. to group methods that can be used for other types of collections