112 1st Midterm Review topics


Topic areas:

Assignments

Labs

Lecture (Chapters 1, 3, 4, appendix A)



Exam topics:


Assignments

  1. chart (too simple to ask much)

  2. calendar (questions about classes, member functions, function calls)

  3. telephone bill (there will be questions about linked lists)


Labs

  1. intro to unix, not room for questions

  2. intro to g++, not much room

  3. introduction to make, some room

  4. preventing multiple includes, incremental programming, bash

  5. practicing pointers (lots of room for questions)

Important C++ topics

short circuit evaluation of expressions
pass by reference
type conversions

explicit int i; double x; i = (int) x;
implicit int i; double x; x = i;

Asserts

what is an assert
why use them
how do they work


C++ classes

private & public components
constructors
destructors

Object-oriented programming

hide information details
encapsulation
class vs object

Memory

pointer: a variable that holds an address in memory, has a type associated with it
new/delete: allocate and free memory
reference variables as parameters: pass by reference vs. pass by value
* operator: declare a pointer, dereference a pointer variable
& operator: declare a reference variable, get the address of a variable


Linked Lists (lots of points on the exam are for linked lists)

Basic idea

use dynamic memory (new/delete) to create memory
link pieces of the data together

Must be able to write code that manipulates a linked list

insert at the beginning
insert at the end
insert so list is sorted
delete (beginning, specified element, end)

be careful of special cases:

empty list
element at the beginning
element at the end
failure (e.g. can't find the element to remove)

head pointer

head AND tail pointers

Must be able to write code that you have not see in class


number of elements in the list
sum of all the number in the list
print all the elements in the list
is an element in the list
how many times does a number appear in the list
...


Resources

Midterms from previous semesters

Sample code from lecture posted on class website