Final Info
Overview and Process
Time/Date: Tues, May 13th at 4:30 PM Pacific Pacific - 90 minutes (End at 6:00 p.m.).
- Location: (Based on Last Name)
- A-K: SAL 101
- L-W: SGM 124
- X-Z: SGM 601
- OSAS Accommodations: If you have USC approved accommodations, you will need to coordinate in advance with the OSAS office to schedule your exam at the testing center on that same day.
The exam will be paper/pen based. There will be some multiple choice, fill-in-the-blank and, likely, some small hand-written coding.
- Bring: A pencil or two and an eraser. No laptop needed!.
- Format: Paper and PENCIL (not pen) exam with fill-in-the-blank answer style for all questions: conceptual, tracing, and coding by choosing the code that should go in the blank.
- The exam is Closed book, Closed notes, Closed Internet (search/reference). No other devices are allowed out during the exam.
-
Questions: The test will mainly have questions that are closed-set choices and are written to state the necessary information required to solve the problem. We cannot offer hints or additional details/guidance beyond what is stated in the exam. So, our answer could likely be: “The question is well-formed (no typos) and all the information you need to answer is provided. Do the best you can.” But, with that said, if you have a question you may raise your hand and a staff person will try to come to you. Please sit on the aisle if you tend to ask questions more often than your peers.
- Policies:
- No calculators, phones, or textbooks are allowed.
- You must request to use the restroom or leave the classroom for any reason and only 1 person will be allowed to leave at a time.
- You may not have headphones or earbuds in.
- Do your best to cover your work with your scratch paper (as a cover sheet)
- With 10 minutes remaining, no one will be allowed to leave the classroom (no bathroom use or leaving if you are finished). If you finish, simply sit quietly. Do NOT work on anything else.
- When time is called, all pencils must go down and you should sit still. Anyone seen writing after the exam MAY BE ASSIGNED a 0!
Topics
The following is the list of topics that you should be familiar with. Use it as a guide to help your studying.
Unit 2a
- declaring pointer variables (
int *
) - referencing (
&
) and dereferencing (*
)
Unit 2b
const
arguments- pointer arithmetic
- Array names and pointer equivalency
- Array access and pointer arithmetic/dereference (e.g.
ptr[i] <=> *(ptr+i)
)
Unit 2c
- Concept of dynamic memory allocation and when to use it
- Syntax of using
new
anddelete
both with scalars (individual variables) and arrays
Unit 2d
NULL
andnullptr
- Handling of
char
vs.char*
types const char*
as the type of string literals
Unit 2e
- pointers to pointers
- arrays of pointers (like char* argv[])
- command line arguments (
argc
andargv[]
)
Unit 2f
- Shallow vs. deep copy
- 2D array allocation via many 1D allocations
Unit 3a
- Basic objects (structs)
- Assignment of objects
.
and->
operators- Using C++
string
class
Unit 3b
- Defining your own classes
- public vs. private
- Constructors and Destructors and when they execute
- Defining member functions
- Splitting your class into files
Unit 4a
- Linked Lists
- Implementing basic operations (push, pop to front, middle, or back)
- Efficiency of various operations given variations of their implementation (with or without tail pointer, etc)
- Pros and cons compared to arrays
Unit 4b
- Doubly Linked lists and operations
Unit 4c
vector<T>
basic operation- Efficiency of their operations
Unit 4d
- Deque implementations (which can work vs. cannot work)
- Efficiency of various operations given variations of their implementation (with or without tail pointer, etc)
deque<T>
class
Unit 4e
- Use of
getline()
- Checking an input stream for failure
- Checking for failure when opening a file
- Using C++
ifstream
andofstream
classes for File I/O
Unit 4f
- Maze Project (no BFS questions)
Unit 5a - Operator Overloading
- Understanding the two approaches (Global vs. Member functions) and when to use each
- The signature of various operator overloads (arithmetic, comparison, etc.)
friend
functionsoperator<<
function signature and implementation
Unit 5b - Copy Semantics
- Copy constructors
- Assignment operators
- When each is called
- “Gotchas” that the assignment operator should handle
- Rule of 3
Unit 5c - Class Details
- Default vs. Initializing constructors
- Constructor Initialization Lists
const
keyword
Unit 5d - Inheritance
- Base class constructor and destructor calls
protected
keywordpublic
vs.private
inheritance- Composition vs. Inheritance
- Calling base class overloaded functions
Unit 5e - Polymorphism
- Static vs. Dynamic binding (
virtual
vs. non-virtual
) - pure virtual functions and abstract classes
- need for
virtual
destructors
Unit 5f - Inheritance Details
protected
keyword- Public vs. private inheritance
Unit 5g - Parsing and Streams
operator>>
andgetline()
- When do input streams fail (
fail()
) - Correct approaches for how and when to check for failure
stringstream
s
Unit 5h - File I/O Details
get()
,ignore()
, andpeek()
seekg()
andtellg()
Unit 5i - Exceptions
throw
keywordtry/catch
block- ordering of
catch
blocks - stack unwinding (exceptions propagating to calling functions)
- exceptions and inheritance
Unit 6a - Recursion
- Tracing of recursive functions
Topics from MT1 and MT2 are potential supporting material (you need to still understand pointers, linked lists, etc.) but heavy focus will be on (be sure you are very comfortable with):
- Linked lists (single- and doubly-linked)
- Operator overloading (when to use global vs. class member functions, use of
friend
, etc.) - Deep copy semantics (copy constructor / assignment operator)
- Inheritance and Polymorphism
- Streams and parsing with
>>
andgetline()
, usingstringstream
s, and knowing when a stream will fail. - Tracing of recursive functions
You should also review:
- Pointers
- C-strings and pointers to C-strings. Arrays of
char*
s (likeargv[]
) vector<>
anddeque<>
- Syntax differences with pointers (
T*
) and C++ references (T&
).
Practice Final on Gradescope
- Will be done in our last lab meeting.
- Gradescope Solutions
- Coding problems are on Codoi and solutions are in that assignment.
Other Selected Practice Problems
Older Practice Problems
- Fall 2017 Final Exam
- No solutions / crowdsource your answer or come to office hours.
- Fall 2016 Final Exam
- No solutions / crowdsource your answer or come to office hours.
- Spring 2015 Final Exam
- Fall 2014 Final Exam
- Older Fall 2014 Practice Problems