COSC 1436 Mid-Term Exam Review
The exam will be given on March 26 for Section 3 and March 28 for Section 2
during regular class hours. You will have 1 hour and 15 minutes to complete
the exam. The exam will cover Unix concepts, C++ concepts from COSC 1435, Gaddis
chapters 6, 7, 8, 9, 10, and 11, and Big-O Concepts. I will provide the inside
front and back covers from Gaddis as a language reference sheet on C++ and a
brief reference on string functions and the string class.
Most of the exam will be problems, of four basic types:
- Coding. You will be given a simple problem, typically a function, and be
asked to code the function. These problems will be small and directly reflect
what we have discussed in class and programs written for labs.
- You will be given a code segment or a complete program and asked to look
at the code and determine what will be the result of running this code.
- You will be given a problem/situation on a UNIX/LINUX system. Determine
what command(s) are needed?
There will be some short answer questions, but no true/fale or multiple choice.
UNIX. You need to know and be able to use the following commands, including
switches and meta characters:
- ls, du, mkdir, chmod, cd
- cal, whoami, id, users, who, finger, w, pwd, man
- more, less, rmdir, rm, set
- redirection operators '>', '<', '>>'
C++ Basic Concepts. Know the following C++ concepts:
- Variables and variable declarations
- Decision making (if and switch statements)
- All forms of looping
Strings and String Class.
- Know and be able to use the character functions in Table 10-1.
- Know how a C-string is stored in memory and be able to manipulate C-strings
without using library functions.
- Know and be able to use the C-string library function in Table 10-1, 10-2,
10-3 & 10-4.
- Know and be able to use the string class library functions in Table 10-5,
10-6, & 10-7.
- Know how arrays are stored in memory and how much space an array takes up.
- Be able to look at C++ code and determine whether an array access goes beyond
- Know how to initialize and access array contents, including arrays with
- Know how to use an arrays of C-strings and string class members
- Be able to pass an array to a function and return an array from a function
- Understand how each of the pointer operators ('&', '.', '*') are used
- Be able to give examples of when pointers can assist the programmer in accomplishing
- Be able to convert code using normal variables to code using pointers
- Understand the relationship between arrays and pointers and be able to convert
code between both notations, with no change in functionality
- Understand pointer arithmetic and be able to code a function using pointer
- Be able to program variables, arrays, and abstract data types using dynamic
memory allocation, including returning dynamically allocated memory to the
- Know and be able to use the the struct abstract data type, including declaring,
creating an instance, initializing, and assessing.
- Be able to declare and use an array of structures and nested structures
- Be able to pass a structure array to a function and return a structure from
a function, including when they should be passed by reference or by value.
- Be able to design an abstract data type for a reasonably complex requirement
- Understand and be able to use enumerated data types.
- Be able to pass pointers at objects to a function and return pointers from
- Be able to describe why Big-O is important and how it is used.
- Describe how Big-O is calculated.
- Be able to place Big-O values in order. For example is O(n * log2n) larger
- Be able to look at a section of code, a function, and/or a full program
and determine the Big-O value
- What does a Big-O value represent? How can we use it to describe whether
a problem is hard or easy for a computer to solve it?
- What is a linear search and be able to write a function that implements
a linear search
- Know the difference between a binary search and a linear search.
- Be able to diagram (not code) how a binary search works.
- Be able to assess the efficiency of different types of searches.
- Given an existing search function, be able to modify the search function
to fit new conditions.
- Be able to diagram (not code) how the bubble, selection, and insertion sort
- Be able to assess the efficiency of different types of sorts
- Given an existing sort function, be able to modify the sort function to
fit new conditions or to use a modification of the original algorithm
- Why is it important for a sort to maintain natural order?