The weight of each question is given with the question
Use as much paper as you wish, but make your answers are legible.
Please answer each question thoughtfully and carefully.
[10 points] Give the definition for an abstract data type (ATD).
[4 points] What is a C++ class, and how is it related to an ADT?
[2 points] Give the syntax for a C++ class.
[2 points] What is a class member?
[6 points] Describe three basic operations associated with classes.
Name each.
What is an instance of a class?
[10 points] Create a C++ class to emulate a light switch. Your
class should contain a single data item, the status of the switch (on or off)
and should support the following operations:
Creation, default switch off
Creation with a string "off", or "on" to set the state of the switch.
Boolean functions, isOn and isOff
Switch function to change the switch to the other position.
[9 points] Write a routine that given an array of light switch objects,
as well as the size of the array, will compute and return the number of
light switches that are turned on.
[2 points] What does overloading mean?
[4 points] Show how to overload the == operator for your light switch class above.
[2 points] What is a friend function?
[2 points] Write a stream insertion operator for your light switch class.
Output either the word "Off" or "On".
[6 points] Give a brief description of the function of each of the
following items. Make sure you discuss the input and output of each
item.
Preprocessor
Compiler
Linker
[12 points] Describe what is contained in each of the following types
of files. Describe who or what produces the file and
how the file is commonly used
Specification File
Implementation File
Intermediate Source Code
Object File
Library
Executable
[2 points] Draw a diagram that represents the compilation process.
Include all of the terms from the previous two questions.
[2 points] A specification file contains the following code. Describe
what the code does and why it is present.
#ifndef SOME_IDENTIFIER
#define SOME_IDENTIFIER 1
C++ definitions go here
#endif