Test 1 CSCI 130 Summer 2013


  1. Algorithms
    1. [2 points] What is an algorithm? Give the definition.
    2. [4 points] How is an algorithm employeed in the development process?
  2. Programming Tools
    1. [2 points] What is a text editor?
    2. [2 points] Name the primary task of a compiler.
    3. [2 points] What is a secondary task of a compiler?
  3. Identifiers
    1. [2 points] What is an identifier?
    2. [6 points] Give the rules for constructing an identifier and an example which violates each rule. State how your example violates the rule.
  4. Constants and Variables
    1. [2 points] Give the syntax for declaring a named constant.
    2. [2 poitns] Give the syntax for declaring a variable.
    3. [2 points] How is a variable different from a constant?
  5. Data Types
    1. [2 points] What is a data type?
    2. [2 points] Describe the string data type.
    3. [2 points] What is the difference between a character and a string?
  6. [4 points] Justify why it is better to use the constant SALES_TAX than the floating point literal 0.06 in a program.
  7. [10 points] Write a complete C++ program which will prompt the user for two positive integers a and b and print a/b as a mixed number. If the numbers are 4 and 3, the output would be 4/3 = 1 and 1/3, while the input 6 and 2 will output 6/2 = 3 and 0/2. You may assume that b will not be 0.