MT2 Info
Overview and Process
Time/Date: Thurs, Apr. 3rd at 7 PM Pacific Pacific - 90 minutes (End at 8:30 p.m.).
- Location: (Based on Last Name)
- A-C: THH 102
- D-M: THH 101
- N-Z: THH 201
- 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.
- Bring: A laptop or tablet with a minimum of 90 minutes battery run-time. Don’t count on outlet access.
- Format: The exam will consist of 2 coding problems to be completed in Codio (link on Brightspace) and then code uploaded/pasted into Gradescope (for grading and a timestamp of completion). The prompts/questions for the two problems will be handed out on a paper version that you can use for scratch work (or if your laptop dies, you can code on paper and submit it to us). But you will write your code in Codio (link on Brightspace) and then copy/paste your answers to Gradescope. Before the test begins, login into our Brightspace section, choose Content..Exams and then WAIT. You will find an MT2 Codio link as well as an MT2 Gradescope link.
- You MUST write your code in Codio. You MAY NOT use your own editor. Failure to follow this will result in a 0 on the exam and a letter grade deduction. You can then compile and run it if you like, but we are not expecting you to do that and we will visually grade your code to assign points. Don’t waste time trying to compile/debug your code until you have finished the other problems.
- Questions: Any questions about the content of the exam (clarification, etc.) should be asked on EdStem (and not by raising your hand) to avoid disrupting your neighbors.
- Policies:
- The exam is Closed book, Closed notes, Closed Internet (search/reference). You may only access the following websites: Brightspace.usc.edu (to access the Gradescope or Codio links), Gradescope.com (to enter your non-coding answers), Codio.com (to perform the coding problems), and EdStem.com for asking questions. Other than that your mind and scratch paper are the only resources allowed. We will provide some reference to useful or common functions on the exam itself (i.e.
vector
functions, etc.) - 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.
- Take care not to open the exam in 2 tabs / browsers or submit early. We can ONLY delete a submission if you click submit early and so you will need to start over again but will not be given additional time.
- If your laptop crashes, you will need to code on the paper exam (but will not have the advantage of typing/editing code.)
- 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 close your laptop and sit quietly. Do NOT work on anything else.
- All answers and code must be submitted on Gradescope by 8:30 p.m. and anything after that will be consider a violation and may result in penalties!
- The exam is Closed book, Closed notes, Closed Internet (search/reference). You may only access the following websites: Brightspace.usc.edu (to access the Gradescope or Codio links), Gradescope.com (to enter your non-coding answers), Codio.com (to perform the coding problems), and EdStem.com for asking questions. Other than that your mind and scratch paper are the only resources allowed. We will provide some reference to useful or common functions on the exam itself (i.e.
- Grading:
- To receive credit you must pass the automated tests we provide. However, even if you pass all the tests, it does not guarantee full credit. If you violate any requirements or guidelines or miss an edge case that our tests did not exercise, we may still deduct points. But passing the automated tests is a good indicator you are correct or close to correct.
- If your code does not compile or does not pass the tests, we will try to grade the code visually after the exam and assign some partial credit.
Disallowed seating
- So that we can proctor you appropriately, we need to easily see your laptop screens. Thus, follow these seating guidelines
- Leave a blank seat between you and any neighbor
- Do not sit in the middle rows of THH 101, 102 or 201
- Do not sit in the very back row if there is NOT standing room behind you for a proctor (i.e. middle section of THH 101 and 201).
- Do not sit in the seat directly next to a wall (i.e. side sections of THH 101 and 201).
- Do not angle your laptop screen toward the wall or use privacy screens. We must be able to see your screen reasonably well from behind.
- To summarize, avoid sitting in the red rows and columns based on the room you are in.
THH 101 | THH 201 | THH 102 |
---|---|---|
![]() |
![]() |
![]() |
Topics
The following is the list of topics that you should be familiar with. Use it as a guide to help your studying.
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)
Summary of Important Topics: All the topics from MT1 and prior assignments are also still requisite knowledge but the majority of the focus will be on the topics listed above. Be sure you are very comfortable with:
- Writing code to perform operations on singly- or doubly-linked lists. We guarantee 1 of the problems in the exam will be to write linked-list code.
- Using structs and classes
vector<>
- File stream objects and reading in data using the
>>
; operator
Other topics that you should be familiar with:
- Using C++
string
s - Pointers (pass-by-reference, pointer arithmetic, pointers to pointers, etc.)
- C-strings and pointers to C-strings. Arrays of
char*
s (likeargv[]
) - Dynamic memory allocation (when it should be used and how to use it) and specifically how to allocate 1 and 2D arrays.
Practice Problems
Simple Tasks You Should Be Able To Do
File I/O and Arrays: Assume an input file with data values (strings or ints) separated by whitespace. Assume the first item in the list IS an integer of how many more items will appear. Read in all of the data items (after the first integer) and print them out in reverse order. Check to ensure each item was read successfully and quit if any item fails to be read correctly (e.g. if a string appears in the file of ints).
Sample Linked List Coding
On Brightspace..Content..MT2 Practice And Exam Prep, you will find links to TWO linked-list coding problems representative of what we would expect on the exam. The problem descriptions are given below (not in Codio). On the exam, the problem descriptions will likely be given on a paper exam. Start by writing your program in Codio and using the provided main()
with some basic tests you can edit and modify, as well as some automated tests. Please note: that on the exam passing any automated tests is a good sign your code works but NOT a guarnatee. There may be edge cases our tests do not exercise and that you need to account for. Or you may have not followed the restrictions or guidelines we gave, which would then lead to partial or no credit, even though you passed the tests.
Reorder Halves:
Given a linked list with n
nodes, update the appropriate links such that the linked list will be modified so that nodes at logical index n/2
to n-1
are moved to the front of the list and nodex at logical index 0
to n/2-1
are moved to the end (thus, reordering the halves).
- Ex1: Given a list with:
5 8 7
, the new list should contain8 7 5
. - Ex2: Given a list with:
5 8 7 4 6 2
the new list should contain4 6 2 5 8 7
. - Ex3: Given a list with:
5
, the new list should still be5
.
Find And Move:
Given the value, x
, find the first occurrence of x
in the list and move it to the back of the list (by reordering links…you cannot just change values) then return true. If x does NOT occur in the list, return false.
- Ex1: Given a list with:
5 8 7
, and x =8
, update the list to5 7 8
and return true. - Ex2: Given a list with:
5 8
, and x =5
, update the list to8 5
and return true. - Ex3: Given a list with:
5 8
, and x =7
, return false.
STRONG RECOMMENDATION: Do NOT look at these solutions until you have fully solved the problem on your own. If you struggle and cannot get the code to work, go get help from course staff or another student. Don’t ask chatGPT, don’t look at the solutions. Only by struggling until you get it working, will you likely learn what you need to do these on your own.
Sample MT2 (Gradescope and Codio)
-
On Brightspace..Content..MT2 Practice And Exam Prep, you will find MT2 related practice with links to a Gradescope MT2 exam with conceptual/tracing questions and a Codio link to some sample coding problems. Solutions are also linked below. Note: Spring 2025 will be coding only. No multiple choice/general knowledge questions.
Spring 2023 MT2 (Codio)
-
On Brightspace..Content..MT2 Practice And Exam Prep, you will find the coding portion of the Spring 2023 MT2. Solutions are also linked below.
- Exam PDF
- Solutions PDF
Review Linked-List and Vector Lab
Many of the coding problems in that lab are (will be) useful to prepare for the MT2.