Midterm Exam #2 Review CS 2308 :: Spring 2016 Molly O'Neil
Midterm Exam #2 Wednesday, April 13 In class, pencil & paper exam Closed book, closed notes, no cell phones or calculators, clean desk 20% of your final grade 80 minutes to complete the exam Please bring a pencil and eraser! All writing will be done on exam paper that I'll hand out 2
Exam Format 100 points total ~17 problems, ~8 pages Types of questions: ~50% of total points Multiple choice Fill-in-the-blank (concepts & code) True/false Short answer ~50% of total points Writing functions/code (similar to coding assignments) Fill-in-the-blank coding 3
Lecture Content Slides from lecture: Program Design & Testing ADTs Intro to OOP C++ Multi-File Development More About Classes Linked Lists (Anything from CS 1428 is still fair game, of course!) All lecture slides available on the Schedule page of the course website Animated versions are on TRACS under Resources 4
Assignment Content Homeworks Homework #3 Homework #4 Programming Assignments Project 3 - Pointer Practice Dynamic allocation problems only (no pointer tricks, e.g. "don't use square brackets") Project 4 - Password Manager Including the test plan! Project 5 - MP3Player v. 2.0 Use the driver on TRACS to test your submission Quizzes Quizzes 3, 4, and 5 5
In-Class Code Content Knowledge of the in-class code will never be assumed on the exam; however, they cover several class concepts and are worth reviewing Car class Struct/procedural version and what was wrong with it Class version and why it was better Rectangle class We did this one together on the whiteboard I guarantee there will be something like this on the exam! BetterIntArray class Copy constructor Operator overloading Makefiles 6
Textbook Content Use the textbook to help you understand the slides There will be no questions over material or code that is in the book but NOT in the slides! Covered sections: Chapter 11.1-11.10 (ADTs/Structs) Chapter 13 (Intro to Classes) Chapter 14 (More About Classes) Chapter 17 (Linked Lists) Stuff that is ONLY in lecture slides (not in textbook): Program Design & Testing, C++ Multi-File Development 7
Dynamic Memory / Program Testing Pointers & Dynamic Memory How to dynamically resize an array Program Design & Testing What is software testing? (And what is it not?) Test plan design Write test case to isolate boundary condition 8
ADTs Abstract data types What are they? Compare to a data structure Structs Arrays of structs Pointers to structs Structure pointer operator (->) Equivalent to (*ptr).field (caution: parentheses required!!) Dynamic allocation of structs 9
Intro to OOP/Classes Procedural programming What is it, what's the main problem with it Object-oriented programming What is it, how it addresses issues with procedural prog. Encapsulation, data hiding, and public interfaces Attributes & Actions Class vs. object/instance Declaring a class (e.g., the Rectangle class from HW/class) Members (variables and functions) Private vs. public, access rules Syntax for class declaration Getters and setters, const functions How to define instances/objects of a class How to access class members (dot operator) 10
Intro to Classes (cont.) Inline member function definitions Constructors How to name, return type When are they called? What do they do? Default constructor Constructors with arguments Destructors What are they, how to name them, when are they called? Arrays of objects Declare, initialize, and access Know how to write functions to process arrays of objects 11
C++ Multi-File Development Separating specifications from implementation What goes in which file What needs to include what, and how How to compile Compiling multiple object files + linking executable Makefiles Dependencies Compiling to intermediate object files Be able to write a Makefile rule 12
More About Classes Instance vs. static variables Dynamic allocation of objects Pointers to objects (and -> operator to access members) The "this" pointer And how to use it to resolve name overlap of local vs. member vars Default assignment operator behavior for objects Copy constructors Default shallow copy behavior When shallow copy is a problem How to define your own (i.e., deep copy constructor) When is the copy constructor called Operator overloading Syntax of function definition for ==, <, and > Syntax of use 13
Linked Lists What is a list ADT, what is a linked list Benefits of linked lists over arrays (and vice-versa) Organization Nodes (not in consecutive memory locations!, order defined only by traversal) Head pointer What does an empty list look like? Declaring a linked list class (node structure, head pointer) Creating an empty list (constructor) append() function (find last node, add new node) Traversing a linked list (e.g., display()) Deleting a linked list (deconstructor) 14
Linked Lists (cont.) remove() and insert(): expected to know basic algorithm, but I won't ask you to code these (b/c Project 6 not due yet) Other functions that are fair game (last slide of LL lecture): count(), findmax/min(), prepend(), popfront() [The others (findnumatindex, reverse, remove, insert, insertat, popback, removedups, merge) will be fair game for the final exam, but will not appear on this midterm] 15
How to Prepare Review the slides Understand all the concepts Quiz yourself Review the coding assignments Fix your code if you never got it working! Re-do the written homework problems (without consulting your notes!); check your work against solutions on TRACS Review the quizzes (come to office hours if you want a quiz back) [Quizzes 3, 4, 5] Read the textbook only to increase understanding of slides Textbook has exercises/problems to solve as well Sleep! Eat breakfast! 16