Please answer each question fully, carefully and thoughtfully.
No credit will be given for unreadable answers, please write neatly.
Answer the questions in any order, but please number each answer.
Make sure that your name is on your test.
(5 points) Describe functional decomposition.
(5 points) What is pseudocode?
(5 points) What is an algorithm?
(5 points) What is a structure chart?
(5 points) Describe how the terms from questions (1-4) are use in the
program design process.
(5 points) What is the flow of control of a program?
How can the flow of control be altered?
(10 points) Describe what happens when each of the following statements
is executed.
ifstream inFile;
inFile.open("foo.data");
inFile >> avar;
if (inFile) {
inFile.close();
(5 points each) For each of the following:
Give the syntax for the control structure.
Describe the flow of control for the control structure.
Describe the purpose of the control structure.
For loop
While loop
Do While loop
If Then Else statement
(15 points) The file, InputFile.dat contains only integers.
Write a program which will compute the following:
The number of integers in the file.
The maximum integer in the file.
The minimum integer in the file.
The average of the integers in the file.
(10 points) Describe the function of, and the difference between
each of the following methods for reading a string.
fileStream >> stringVar;
getline(fileStream, stringVar);
i = 0;
stringVar = "";
do {
fileStream.get(ch);
if (!isspace(ch)) {
stringVar = stringVar + ch;
}
} while (ch != '\n');
(15 points) Write a program which will ask the user for two lower case
letters and print all letters between the two letters. The order of
the letters should be preserved (if the user enters a c, the output
should be a b c, if the user enters c a, the output should be
c b a.