Skip to main content
Engineering LibreTexts

3.17: Practice: Functions

  • Page ID
  • Review Questions

    True / False

    1. In addition to the term function as the name of a subprogram, the computer industry also uses macro, procedure and module.
    2. Generally, functions fall into two categories: Program Control and Specific Task.
    3. Hierarchy Charts and Structure Charts are basically the same thing.
    4. Program Control functions are used to simply subdivide and control the program.
    5. The void data type is rarely used in C++.
    6. Making source code readable is only used by beginning programmers.
    7. Scope refers to a brand of mouthwash.
    8. User-defined specific task functions are usually placed into a user-defined library.
    9. Local and global data storage is associated with the concept of scope.
    10. Creating a header file for user-defined specific task functions is a difficult task.
    11. The stack is part of the computer’s memory used for storage of data.
    12. The standard library is a set of specific task functions that have been added to the programming language for universal use.
    13. Programmers should not have confidence that standard library functions work properly.
    14. It would be easier to write programs without using specific task functions.


    1. true
    2. true
    3. true
    4. true
    5. false
    6. false
    7. false – Although Scope is a brand of mouthwash; we are looking for the computer-related definition.
    8. true
    9. true
    10. false – It may seem difficult at first, but with a little practice it is really quite easy.
    11. true
    12. true
    13. false
    14. false

    Short Answer

    1. Create a hierarchy chart for the function example program found in this chapter.
    2. Review the programs you have already created for this course. Based on coding standards for your selected programming language, identify some problems that make your code “undocumented”, “unreadable” or wrong in some other way.


    Complete the following activities using pseudocode, a flowcharting tool, or your selected programming language. Use separate functions for input, each type of processing, and output. Avoid global variables by passing parameters and returning results. Create test data to validate the accuracy of each program. Add comments at the top of the program and include references to any resources used.

    1. Create a program to prompt the user for hours and rate per hour and then compute gross pay (hours * rate).[1], or create a program that asks the user for their monthly income and then calculate and display their annual income (monthly income * 12).