Test 1 CSCI 130 Fall 2015

  1. Algorithms
    1. [2 points] What is an algorithm? Give the definition.
  2. Programming Tools
    1. [2 points] Describe the edit-compile-execute cycle. Where is encountered?
    2. [4 points] Name a class of tool which is used at the first two stages of this cycle. Describe what that class of tool does. (Don't list joe, g++, but rather give the name of the class of tool each of these represent.)
    1. [1 point] What is a comment and why are comments used in computer programs?
    2. [2 points] Describe, give syntax for, and examples of the two types of comments available in C++.
  4. Identifiers
    1. [2 points] What is an identifier?
    2. [2 points] What is a standard identifier? Give an example of a standard identifier.
    3. [6 points] State the three rules for declaring a valid identifier. For each rule, give an example of a word which violates the rule and explain how it violates the rule.
  5. Variables
    1. [2 points] What is a variable?
    2. [2 points] How are variables used in a program?
    3. [3 points] State three local conventions for declaring an identifier for a variable. Give an example of an identifier that employs all three of these conventions.
  6. Data Types
    1. [2 points] What is a data type?
    2. [4 points] Describe the string data type.
    3. [3 points] Describe syntax and operation of the getline function.
    4. [3 points] What problem can be encountered when using the getline function? Describe the causes of the problem and how to eliminate this problem.
  7. [10 points] Write a complete program which will ask the user for a first name, then ask for a last name, finally ask for a title (Mr, Ms, ...). Construct and store in a variable the user's full name (Title First Last). Print the value of this variable.
    Example Input/Output
    Please enter your first name => Dan
    Please enter your last name => Bennett 
    Please enter your title (Mr., Ms., ... ) => Dr.
    Hello Dr. Dan Bennett.