CS 121

Outline of Material for Final Exam


The following is a brief outline of the material which will be covered on the final exam. All of this information can be found in the lecture notes and/or on this web page.
  1. Textbook Reviews and Study Questions
    There are some very good review questions at the end of each chapter. You should review all of these as practice for the test.
    1. Quick Check - This section has some short answer and simple programming questions along with the answers. Questions of this type could be on the test.
    2. Exam Preparation Exercises - This section has a number of multiple-choice, true-false, short answer, and fill-in-the-blank questions. Questions of this type will be on the test.
    3. Programming Warm-Up Exercises - This section has a number of questions in which you are asked to write small portions of C++ code based on the material covered in the chapter. Questions of this type could be on the test.
  2. Chapter 1 - Overview of Programming and Problelm Solving
    1. Be able to define the following terms: computer science, programming, programming language, algorithm, machine language, assembly language, assembler, compiler, source file, object file, central processing unit (CPU), hardware, and software.
    2. What are the three phases of problem solving and the steps under each phase?
    3. What is the primary purpose of Computer Science?
    4. What are the six basic components of a computer?
    5. What is a peripheral device? Give three examples.
    6. What is an auxillary storage device? Give three examples.
    7. What is the operating system?
    8. What is software piracy and why is it an important concern for professional software engineers?
    9. Briefly describe what the computer's memory is and how it is organized? Include comments on RAM, ROM, bits and bytes.
    10. What is the ASCII code?
    11. Show how you would count to 15 in binary numbers.
    12. Show how you would count to 15 in hexadecimal numbers.
    13. List seven problem solving techniques used in computer program design.
  3. Chapter 2 - C++ Syntax and Semantics and Program Development
    1. What is a function in a C++ program?
    2. List and briefly define the three elements of the C++ language.
    3. What is the difference between Syntax and Semantics?
    4. What is an identifier in a C++ program and what are the rules for naming identifiers?
    5. What is a variable? Show how to create variables for each of the C++ data types and set values in those variables.
    6. What are the 5 integer data types in C++?
    7. What are the 3 real data types in C++?
    8. What are all of the values a bool data type can hold?
    9. Is the string a C++ data type? Why or why not?
    10. Show how to create a string variable and store a string value in it.
    11. Show how to concatenate strings with the + operator.
    12. What is a constant in a C++ program. Show how to create a constant called PI and set its' value to 3.141592.
    13. What is a literal value in a C++ program.
    14. What function is used to print to the screen. Demonstrate its use.
    15. What operators are used to enclose a block of code in a C++ program?
    16. What does the #include preprocessor directive do?
    17. What header file do you have to #include in a program to use the cout command?
    18. What is the insertion operator and what is it used for?
    19. What is an escape code? What do the following escape codes do in a string: \n, \t, \\, \", \x064
  4. Chapter 3 - Numeric Data Types, Expressions and Output
    1. Be able to define the following terms related to numeric expressions and math operations: Unary operator, binary operator, and mixed type expression..
    2. What is the difference between a signed and an unsigned integer type variable?
    3. What are the 5 basic math operators (symbols) used in C++ for addition, subtraction, multiplication, division, and modulus division?
    4. Given a mathematical formula/expression show that you can translate it into a correct C++ math statement that will perform all calculations in the correct order.
    5. Given two integer variables (int x=33 and int y=2), what is the answer to the following two formulas: z = x / y;     z = z % y;
    6. What does precedence mean in C++ math formulas? What is the order of precedence of the basic math operators?
    7. What is the difference between the decrement and increment operators as used in the following: X--, --X, Y++, ++Y.
    8. If a numeric value is printed and it has an E or e imbedded in the string of numbers, what does this mean?
    9. What is meant by type coercion and type casting?
    10. Show how you would count to 15 in binary numbers.
    11. Show how you would count to 15 in hexadecimal numbers.
    12. What do each of the following format specifiers do when used in a cout statement to print numeric data: setw, fixed, scientific, showpoint, and setprecision.
  5. Chapter 4 - Program Input and the Software Design Process
    1. Be able to define the following terms: standard input device, extraction operator, I/O Redirection.
    2. Be able to write simple code demonstrating the use of cin to input integer or floating point number values.
    3. Be able to write simple code demonstrating the use of cin to input character values using both the extraction operator and the cin.get() function.
    4. Be able to write simple code demonstrating the use of cin to input string values.
    5. Be able to write simple code demonstrating the use of cin to input string values using the getline() function.
    6. What does cin.ignore() do. Be able to demonstrate its use.
    7. What header file must you #include if you are going to use file input or output in your program?
    8. What is the data type for an input file stream object? What is the data type for an output file stream object?
    9. Be able to demonstrate the use of the open function in a file object.
    10. Be able to write simple code demonstrating inputing string values from a file using the getline() function.
    11. If an input stream enters the FAILED state what happens to subsequent input?
    12. Be able to define the following terms: functional decomposition, object oriented design, procedural programming, top-down design, bottom-up design, stepwise refinement.
    13. In functional decomposition what is the difference between a Concrete Step and an Abstract Step?
    14. What is pseudocode?
    15. In object oriented design what is an Object?
  6. Chapter 5 - Conditionals, Logical Expressions and Selection Control Structures
    1. What do each of the following operators mean? ==, !=, <, >, <=, >=. Demonstrate how to use each in a condition statement.
    2. Be able to write simple code demonstrating the use of the if statement to test the condition of some integer variable.
    3. Be able to write simple code demonstrating the use of the if..else statements to test the condition of some integer variable.
    4. What is wrong with the following if statement:
      if(n = 3)
           cout << "n equals 3" << endl;
    5. Be able to write simple code demonstrating the use of nested if statements, i.e. if...else if ... else.
    6. What is meant by the "dangling else" error and how do you ensure it does not occur.
    7. What do each of the following operators mean? &&, ||, !. Demonstrate how to use each in a compound condition statement.
    8. What is meant by "short-circuit" evaluations of compound conditional statements.
    9. What is a "conditional expression"? Given a simple if...else expression such as the following, show how you would convert this to a conditional expression.
      	if(a > b)
      		max = a;
      	else
      		max = b;
      
  7. Chapter 6 Loops
    1. Be able to define the following terms: Loop entry, Iteration, Loop test, Loop exit, Termination condition
    2. Be able to write simple code demonstrating the use of a while loop in a count-controlled loop.
    3. Be able to write simple code demonstrating the use of a while loop in a sentinal-controlled loop.
    4. Be able to write simple code demonstrating the use of a while loop in an end-of-file-controlled loop.
    5. Be able to write simple code demonstrating the use of a while loop in an flag-controlled loop.
  8. Chapter 7.1 through 7.5 - Additional Loops and Control Structures
    1. Be able to write simple code demonstrating the use of the switch statement using either an integer or a character variable as the expression to be "switched" on.
    2. What is the purpose of the default statement in a switch statement? Where does it have to go?
    3. Be able to write simple code demonstrating the use of a do...while loop.
    4. Be able to write simple code demonstrating the use of a for loop.
    5. What is the difference between a while and a do...while loop?
    6. Explain what effect the use of the break and continue statements have on the execution of a loop.
  9. Chapter 7.6 - Additional Operators
    1. Know the meaning of and be able to use each of the following math and/or bit-wise operator: +=, -=, *=, /=, %=, ++, --, <<, >>, &, |, ^, ~, <<=, >>=, &=, |=, ^=
    2. Be able to write the decimal numbers 1 through 15 in binary and hexadecimal.
    3. Given two numbers in binary format be able to show the result of performing a bit-wise AND, bit-wise OR, and bit-wise XOR (exclusive OR) on the two numbers.
    4. Given a number in binary format be able to show the result of performing a bit-wise NOT (inversion) of the number.
    5. Given a number in decimal format show how you would create a bit flag of that number using the #define preprocessor directive with the decimal number defined in hexadecimal.
    6. What is meant by type coercion (automatic and explicit) and type casting. Be able to demonstrate how to do type-casting.
  10. Chapters 8 & 9 - Functions
    1. Explain the difference between a function declaration/prototype and a function definition.
    2. Why must function prototypes be placed before the start of main()?
    3. Be able to define the following terms related to functions: function interface, function parameters, reference parameter, value parameter, function arguments, function call, function declaration, function definition, function prototype, call-by-value, call-by-reference, global variable, local variable, static variable, scope of a variable, scope rules, and non-local identifier
    4. List three types of function parameters and be able to demonstrate each by writing a function prototype where each is used.
    5. Explain the difference between a void function and a value-returning function.
    6. Given the code for a simple function be able to explain what its' return type is and whether each of its' parameters is a value or a reference parameter.
    7. List and briefly explain the meaning of the five scope rules discussed in class.
    8. What is meant by variable lifetime and what is the difference between an automatic and a static variable.
    9. What is meant by data encapsulation or data hiding and why is it so important in program construction.
    10. What is meant by side effects of a function. Given the code for a simple function, be able to analyze the code and determine what side effect, if any, the function could produce.
  11. Chapters 10.1, 10.2 and 11 - Enumerated Data Types and Arrays
    1. What is the typedef operator and how is it used.
    2. What is an enumerated data type? Give some reasons for using them.
    3. Be able to demonstrate how to create an enumerated data type, how to set desired values in the elements, how to create a variable of the defined type, and set values in the variable.
    4. Given one or more enumerated data types defined in a program be able to identify which have valid and which have invalid identifiers.
    5. Explain why a variable of an enumerated data type, which is basically an integer cannot have an integer value assigned directly to it, cannot be incremented or decremented, have an integer value directly added to it, or subtracted from it.
    6. Be able to show how to create a one-dimensional array of any of the basic data types in C++, store and retrieve values in the different elements by index.
    7. What could happen if you try to access elements of an array with an index that is out of bounds?
    8. Demonstrate how to create an array and initialize it to a set of given values at the same time.
    9. Explain why you cannot perform aggregate operations on arrays such as setting one array equal to another, compare one array to another, print an array as a block, or combine two arrays.
    10. Explain how to pass arrays as arguments into functions. Are arrays passed by value or reference?
    11. What is the base address of an array?
    12. Be able to show how to create a two-dimensional array of any of the basic data types in C++, store and retrieve values in the different elements by row/column indices.
    13. Be able to show how to create a multi-dimensional array of any of the basic data types in C++, store and retrieve values in the different elements by the dimensional indices.
  12. Supplemental Material - Pointers, Classes, Object Oriented Programming
    1. Given variable name of a datatype (int, double, structure, class, etc.) show how you would create a pointer to that datatype and set the pointer pointing to that variable.
    2. Given a pointer show how you would write a value to and read a value from the variable the pointer is pointing to.
    3. Given a list of variables and their datatypes, e.g. double d, int val, etc. show how you would define a structure containg those fields.
    4. Given a structure show how you would write values to and read values from the fields in the structure, e.g. dot notation.
    5. Given a pointer to a structure show how you would write values to and read values from the fields in the structure the pointer points to, e.g. pointer notation.
    6. Given a list of variables and their datatypes, e.g. double d, int val, etc. and a list of functions, show how you would define a class (that is write the header file) containing those fields and functions.
    7. Given a class show how you would call functions in the class, e.g. dot notation.
    8. Given a pointer to a class show how you would call functions in the class the pointer points to, e.g. pointer notation.
    9. Be able to define the following terms: Encapsulation, Data Hiding, Data Abstraction.