Preprocessor Directives

  1. T/F: Preprocessor directives transform the program before compilation.
  2. T/F: The #define will modify each instance matching the name to the value assigned to it.
  3. T/F: The #include is a preprocessor directive.
  4. T/F: Preprocessor directives can be used for conditional compilation based on the type of machine executing the program.
  5. T/F: NULL is defined as 0 (zero).
  6. T/F: #define must be declared at the top of the program after all #include statements.
  7. What is the modifier to use to define constants?
  8. What is the modifier to use to define macros?
  9. Define a constant named PI with the first 5 decimal values for PI.
  10. Define a macro named square to calculate the square of a number.
  11. Define a macro named getCircumference and write a line of code to make use of the macro you just defined.
  12. Define a flag for debugging, and write a code fragment that prints whether or not debugging is on, and show the command line to run your program with and without debugging.
  13. Give an example using the #elif structure.
  14. What must you end your ifdef with? ifndef? if?
  15. How are preprocessor directives used to include/exclude parts of a program? Give examples of each.