CS 162 Study Guide - Spring 2018, Comprehensive Midterm Notes - Vocab Song, Virtual Method Table, Virtual Function
CS 162
MIDTERM EXAM
STUDY GUIDE
Fall 2018
Lecture 1: Syllabus
Basics
● Instructor: Shannon Ernst
○ “Ms. Ernst” or “Shannon”
● Email
● Office Hours: WF 11-12, KEC 2087
Attendance
● Lab: Required
● Recitation: Required
● Lecture: Strongly Encouraged
● Missing recitations and labs result in a zero
○ A recitation or lab may be excused within 24 hours prior of a planned
missed absence
○ Unplanned absence must be petitioned by end of day of the absence with
valid excuse
Assignments
● All written work submitted as PDFs
● 3 late days
● NO LATE DAYS for assignment 5
Final
● Take home final due thursday, June 14 at 2pm on TEACH
TAs
● TAs are in DEAR 119
● When: Varies - check the website
Help Hierarchy
● Reread assignment, labs, slides, syllabus
● Google
● Ask friend
● Ask TA
● Ask Shannon
● All Emails Should Include:
○ What your problem is
find more resources at oneclass.com
find more resources at oneclass.com
○ What you have tried
○ What would help you most
○ Section number (if relating to a grade issue)
Email Etiquette
● Check Email Etiquette on slides
Lecture 2: Pointer, Array, and Struct Review
Pointers
● Pointers == memory addresses
● Variable declaration: int a = 5;
○ Creates a variable on the stack of size int with the value 5.
● Pointer declaration: int* b = &a;
○ Creates a pointer variable on the stack which can hold an address of an
int and sets the value of the pointer (the address the pointer points to) to
the address of a
● Dereferencing Pointer: cout << *b << endl;
○ WIll print the value stored at the address which b points to (5)
Pointers and Functions
● Void func(int a, int b);
○ Prototype indicating that void func is expecting two parameters of type int
to be passed by value
○ Recall pass by value copies the value being passed into the formal
parameters which are scoped to this function, any changes made to the
values in the function will not reflect outside this scope
● Void func(int* a, int b)
○ Pass by pointer (check slides)
Arrays
● An array is of one data type and its memory is stored contiguously
● Static Arrays: created on the stack and are of a fixed size
● Dynamic Arrays: created on the heap and their size may change during runtime
● Arrays may be of one or more dimensions
Structs
● User defined objects
● Container which holds many variables of different types
struct my_ob {
find more resources at oneclass.com
find more resources at oneclass.com
Document Summary
Missing recitations and labs result in a zero. A recitation or lab may be excused within 24 hours prior of a planned missed absence. Unplanned absence must be petitioned by end of day of the absence with valid excuse. Take home final due thursday, june 14 at 2pm on teach. Section number (if relating to a grade issue) Creates a variable on the stack of size int with the value 5. Creates a pointer variable on the stack which can hold an address of an int and sets the value of the pointer (the address the pointer points to) to the address of a. Dereferencing pointer: cout << *b << endl; Will print the value stored at the address which b points to (5) Prototype indicating that void func is expecting two parameters of type int to be passed by value.