--- tags: Documents-Summer21 --- # CS18 Midterm Prep Guide Here is some information on what to expect from the midterm. Generally speaking, the midterm focuses on core concepts from the course so far. It is NOT a programming exam. The questions will be conceptual, perhaps with an answer that can be provided with a single line of code. The questions are not designed to trick you, nor will they introduce new content. Sample questions and the midterms from Spring 2020 and Spring 2021, as well as relevant questions from the 2019 final are in the Midterm Prep folder in Canvas (under the Files section). Note that the Spring 2020 midterm was given paper-and-pencil on campus, whereas your exam questions will instead be tailored to an online format (as with Spring 2021). There are also some study questions in this [Recap on Lists](https://hackmd.io/@cs18-spring-2021/lists-unit-recap). The TAs will schedule some review/Q&A hours about midterm content. Watch Ed for details. ## Logistics **When and Where?:** The exam will be available on Gradescope from Tuesday June 22 through Friday June 25 (Anywhere on Earth time). You will have 90 minutes to work on it from the time you start. You may take the exam in any 90 minute period during the time when it is out. :::info If you have SAS/SEAS time-accommodations, make sure you have sent Kathi your letter so that we can configure Gradescope with your additional time. ::: **Overview:** The exam will focus on conceptual questions, design choices, analysis, and other questions that are better answered on paper rather than in code. While you might be asked to read some code or identify problematic parts of code that has been given to you, you will not be asked to write more than a line or two of code on the written exam. **Notes and references:** You may reference class notes (whether ones we have posted or ones that you have taken yourself). You may not look up or search for information beyond the course website or notes that you had a part in taking or creating. In particular, you should not be using any materials from another student that provides information about the actual exam content (say if a friend took the exam before you did). Your exam answers have to reflect your own understanding of the material. It's fine for a group to study together and write up a shared notes file (say in Google docs), but nobody should modify that document after starting the exam. At core, take the exam on your own without assistance from others. The exam will be self-contained, in that you could come with no notes and still answer all the questions if you knew the properties of the various data structures we covered, as well as the general mechanisms for structuring programs (interfaces, classes, etc). The exam will not expect you to recall details of specific lab or homework questions. **What if I need a clarification during the exam?** The exam will contain an area where you can describe any assumptions you made while answering the questions. **What if my computer dies or internet crashes during the exam?** If you are still able to see the questions (internet goes out), write your answers on paper and email them to the HTA list when your internet is back. If your computer restarts and Gradescope won't let you back in, email the HTA list (which also reaches Kathi) and we'll reopen the exam for you. Basically, alert us to the problem ASAP and we'll deal with it. ## What do you need to know? The exam will cover material up through the Wednesday, June 16th lecture on program organization. Exceptions will NOT be included. **Data Structures:** We expect that you know the data structures we have studied so far (Linked Lists, Arrays, Dynamic Arrays/ArrayLists, Doubly-Linked Lists, and Trees). You should be able to choose from or argue for or against these data structures for a given problem. You should be able to talk about the running times for operations that we have discussed on these data structures. For those data structures that you implemented on homework or projects, we expect you to be able to discuss roughly how those implementations work (but you won't be asked to reproduce or remember the corresponding code in detail). The exam will **not** include Hashmaps (which we will start later this week). **Object-Oriented Design and General Programming:** You should understand what classes and interfaces are and when they get used. You should understand programming concepts like public and private vars, what it means to extend a class, and how constructs like loops and assignment operations work. You should also understand how a good object-oriented program is organized into classes, as well as which class a specific method should be placed in (the "encapsulation" material from Mon 6/14 and Wed 6/16). **How Memory (Heap) and the Environment Work:** You should understand how different constructs impact each of the environment and the heap. You should be able to draw the heap contents that result after a sequence of expressions and talk about how objects in the heap are accessed through different names and expressions via the environment. You may be asked to upload a picture or PDF file of a memory diagram. **Programming with Mutable vs Immutable Lists:** You should understand the difference between using an immutable (functional/NodeList) list and a mutable (Java built-in lists) from a programmer's perspective. For example, you should be able to discuss the difference in how a piece of code would run depending on which kind of list was being used. **The key ideas from assignments and project 1:** We expect that you understand how your solutions to the hwks and project actually work. You won't be expected to reproduce code, but we could show you part of a homework/project solution and ask what that part does or why it was important to solving the problem. ## What do you NOT need to know? - Syntax details -- you won't be asked to write more than a line or two of code, and even then, missing bits of syntax won't matter - Specific examples or code from class, homeworks, or lab -- the exam will be self-contained, rather than say things like ``remember the Dillos? ...'' - The exact names of built-in methods on Java data structures -- as long as we understand what operation you are trying to do, you'd get credit for your answer. - How to build an iterator. Basically, this isn't a memorization exercise. ## What sort of questions might be asked? Here are examples of what you might be asked to do (this list is not exhaustive): 1. Given a problem scenario, describe the tradeoffs among various data structures (that we’ve covered) for use within the problem. For this, you would want to know the running time of standard operations of various data structures. 2. Given code that implements some (new) algorithm, explain the time-performance of the algorithm in terms of big-O analysis. You will not be asked to formally prove big-O, but you would be expected to justify your answer (with statements like “we loop over each element and perform operation X which has worst-case time O(log e), where e is the number of elements”) 3. Given a hierarchy of classes, traits, and/or interfaces, discuss whether the various methods and variables are in the right places, or whether they should be organized differently. 4. Given a partial map of the heap, show how it would change after running a given couple of lines of code. 5. Given a piece of code, answer questions about what it would do. As you can see from these examples, the focus here is on concepts -- do you understand the material we covered this semester in a way that lets you make good design decisions?