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.
-
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.
-
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.
-
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.
-
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.
-
Chapter 1 - Overview of Programming and Problelm Solving
-
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.
-
What are the three phases of problem solving and the steps under each phase?
-
What is the primary purpose of Computer Science?
-
What are the six basic components of a computer?
-
What is a peripheral device? Give three examples.
-
What is an auxillary storage device? Give three examples.
-
What is the operating system?
-
What is software piracy and why is it an important concern for professional software engineers?
-
Briefly describe what the computer's memory is and how it is organized? Include comments on
RAM, ROM, bits and bytes.
-
What is the ASCII code?
-
Show how you would count to 15 in binary numbers.
-
Show how you would count to 15 in hexadecimal numbers.
-
List seven problem solving techniques used in computer program design.
-
Chapter 2 - C++ Syntax and Semantics and Program Development
-
What is a function in a C++ program?
-
List and briefly define the three elements of the C++ language.
-
What is the difference between Syntax and Semantics?
-
What is an identifier in a C++ program and what are the rules for naming identifiers?
-
What is a variable? Show how to create variables for each of the C++ data types and
set values in those variables.
-
What are the 5 integer data types in C++?
-
What are the 3 real data types in C++?
-
What are all of the values a bool data type can hold?
-
Is the string a C++ data type? Why or why not?
-
Show how to create a string variable and store a string value in it.
-
Show how to concatenate strings with the + operator.
-
What is a constant in a C++ program. Show how to create a constant
called PI and set its' value to 3.141592.
-
What is a literal value in a C++ program.
-
What function is used to print to the screen. Demonstrate its use.
-
What operators are used to enclose a block of code in a C++ program?
-
What does the #include preprocessor directive do?
-
What header file do you have to #include in a program to use the cout command?
-
What is the insertion operator and what is it used for?
-
What is an escape code? What do the following escape codes do in a string:
\n, \t, \\, \", \x064
-
Chapter 3 - Numeric Data Types, Expressions and Output
-
Be able to define the following terms related to numeric expressions and math operations:
Unary operator, binary operator, and
mixed type expression..
-
What is the difference between a signed and an unsigned integer type variable?
-
What are the 5 basic math operators (symbols) used in C++ for addition, subtraction, multiplication, division,
and modulus division?
-
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.
-
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;
-
What does precedence mean in C++ math formulas? What is the order of precedence
of the basic math operators?
-
What is the difference between the decrement and increment operators as used in the following:
X--, --X, Y++, ++Y.
-
If a numeric value is printed and it has an E or e imbedded in the string of
numbers, what does this mean?
-
What is meant by type coercion and type casting?
-
Show how you would count to 15 in binary numbers.
-
Show how you would count to 15 in hexadecimal numbers.
-
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.
-
Chapter 4 - Program Input and the Software Design Process
-
Be able to define the following terms: standard input device,
extraction operator, I/O Redirection.
-
Be able to write simple code demonstrating the use of cin to input
integer or floating point number values.
-
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.
-
Be able to write simple code demonstrating the use of cin to input
string values.
-
Be able to write simple code demonstrating the use of cin to input
string values using the getline() function.
-
What does cin.ignore() do. Be able to demonstrate its use.
-
What header file must you #include if you are going to use file input
or output in your program?
-
What is the data type for an input file stream object? What is the data type
for an output file stream object?
-
Be able to demonstrate the use of the open function in a file object.
-
Be able to write simple code demonstrating inputing
string values from a file using the getline() function.
-
If an input stream enters the FAILED state what happens to
subsequent input?
-
Be able to define the following terms: functional decomposition,
object oriented design, procedural programming, top-down design,
bottom-up design, stepwise refinement.
-
In functional decomposition what is the difference between a Concrete
Step and an Abstract Step?
-
What is pseudocode?
-
In object oriented design what is an Object?
-
Chapter 5 - Conditionals, Logical Expressions and Selection Control Structures
-
What do each of the following operators mean? ==, !=, <, >,
<=, >=. Demonstrate how to use each in a condition statement.
-
Be able to write simple code demonstrating the use of the if
statement to test the condition of some integer variable.
-
Be able to write simple code demonstrating the use of the if..else
statements to test the condition of some integer variable.
-
What is wrong with the following if statement:
if(n = 3)
cout << "n equals 3" << endl;
-
Be able to write simple code demonstrating the use of nested if
statements, i.e. if...else if ... else.
-
What is meant by the "dangling else" error and how do you ensure it
does not occur.
-
What do each of the following operators mean? &&, ||, !.
Demonstrate how to use each in a compound condition statement.
-
What is meant by "short-circuit" evaluations of compound conditional
statements.
-
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;
-
Chapter 6 Loops
-
Be able to define the following terms: Loop entry, Iteration, Loop test, Loop exit,
Termination condition
-
Be able to write simple code demonstrating the use of a while loop in a
count-controlled loop.
-
Be able to write simple code demonstrating the use of a while loop in a
sentinal-controlled loop.
-
Be able to write simple code demonstrating the use of a while loop in an
end-of-file-controlled loop.
-
Be able to write simple code demonstrating the use of a while loop in an
flag-controlled loop.
-
Chapter 7.1 through 7.5 - Additional Loops and Control Structures
-
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.
-
What is the purpose of the default statement in a switch
statement? Where does it have to go?
-
Be able to write simple code demonstrating the use of a do...while loop.
-
Be able to write simple code demonstrating the use of a for loop.
-
What is the difference between a while and a do...while loop?
-
Explain what effect the use of the break and continue statements
have on the execution of a loop.
-
Chapter 7.6 - Additional Operators
-
Know the meaning of and be able to use each of the following math and/or
bit-wise operator:
+=, -=, *=, /=, %=, ++, --, <<, >>, &, |, ^, ~, <<=, >>=,
&=, |=, ^=
-
Be able to write the decimal numbers 1 through 15 in binary and hexadecimal.
-
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.
-
Given a number in binary format be able to show the result of performing a
bit-wise NOT (inversion) of the number.
-
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.
-
What is meant by type coercion (automatic and explicit) and
type casting. Be able to demonstrate how to do type-casting.
-
Chapters 8 & 9 - Functions
-
Explain the difference between a function declaration/prototype
and a function definition.
-
Why must function prototypes be placed before the start of main()?
-
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
-
List three types of function parameters and be able to demonstrate each
by writing a function prototype where each is used.
-
Explain the difference between a void function and a value-returning function.
-
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.
-
List and briefly explain the meaning of the five scope rules discussed
in class.
-
What is meant by variable lifetime and what is the difference between
an automatic and a static variable.
-
What is meant by data encapsulation or data hiding and
why is it so important in program construction.
-
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.
-
Chapters 10.1, 10.2 and 11 - Enumerated Data Types and Arrays
-
What is the typedef operator and how is it used.
-
What is an enumerated data type? Give some reasons for using them.
-
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.
-
Given one or more enumerated data types defined in a program be able to
identify which have valid and which have invalid identifiers.
-
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.
-
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.
-
What could happen if you try to access elements of an array with an
index that is out of bounds?
-
Demonstrate how to create an array and initialize it to a set of
given values at the same time.
-
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.
-
Explain how to pass arrays as arguments into functions. Are arrays
passed by value or reference?
-
What is the base address of an array?
-
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.
-
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.
-
Supplemental Material - Pointers, Classes, Object Oriented Programming
-
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.
-
Given a pointer show how you would write a value to and read a value from the
variable the pointer is pointing to.
-
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.
-
Given a structure show how you would write values to and read values from the
fields in the structure, e.g. dot notation.
-
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.
-
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.
-
Given a class show how you would call functions in the class, e.g. dot notation.
-
Given a pointer to a class show how you would call functions in the class
the pointer points to, e.g. pointer notation.
-
Be able to define the following terms: Encapsulation, Data Hiding, Data Abstraction.
|