Use as much paper as you wish, but make your answers are legible.
Please label your answers with the question number.
Please answer each question thoughtfully and carefully.
Basic Data Types
[4 points] Describe the internal and external representations of a character.
[5 points] Write a complete c++ function that takes a character and shifts it to the right three characters (a->d, b->e, ..., x->a, y->b, z->c) you should NOT write a huge case, or if-else-if statement.
Typedef/Using
[2 points] Why would a programmer provide a new name for a type?
[2 points] The book tells us that the string header file performs the following
typedef std::size_t size_type;
What does this line do?
[2 points] Provide the corresponding using statement for the above typedef statement.
Enumerations
[4 points] Describe a situation where a programmer should declare an enumerated type.
[4 points] Give the code to declare a strong enumerated type to hold the seasons of the year (winter, spring, summer, fall) as a SeasonT. Include NONE as the last season.
[5 points] Write a function which given a SeasonT, returns the next season in order. If the season is NONE, return NONE.
Compiling with Multiple Files: Practice
[2 points] What should be placed in a header file?
[2 points] What should be placed in an implementation file?
[2 points] Why should using namespace std; not be placed in a header file?
[4 points] What is the purpose of the guards in a header file? Give the syntax for at least one guard method.
Compiling with Multiple Files: Theory
[9 points[ Describe the function of the following parts of a compiler. Include the input and output for each part.
Preprocessor
Compiler Proper
Linker
[3 points] Draw a diagram that shows the relationship between these compiler components.