CMSC 104, Sections 3, 4, & 5, Fall 2012
Exam 3 Topic List
- Basic review of topics from first two parts of course
- The 'switch' statement
- The purpose of the 'switch' statement
- The basic syntax of the 'switch' statement
- Restrictions on the type of the 'switch' expression
- Restriction on what is allowed as a 'case' (integer constant)
- Use of 'break' in a switch statement
- The 'default' case
- What happens when no case matches
- Using #define constants for cases
- Functions:
- What functions are for
- Key motivations for writing code as functions
- Functions and top-down design
- How main() is a special function
- The three parts of using functions:
- The function prototype
- The function call
- The function definition
- Function prototypes
- Syntax for function prototype specifications
- What the function prototype does (i.e., why it is needed)
- Where it needs to be placed in your source code
- Function calls
- How to call a function
- Actual vs. formal parameters
- How parameters are passed to functions
- How parameters are passed to functions
- Function definitions
- What a function definition does
- The syntax for a function definition
- Function parameters
- Syntax for defining parameter name and type
- Parameters act like local variables
- Defining a function's return type
- Using the keyword 'void' for the parameter list or return type
- The 'return' statement
- Describing a function in the header comment
- Header files, and their use for holding function prototypes
- Arrays
- What a data structure is: data structures vs. simple data types
- What an array is
- Allowed data types for array elements
- How array elements are stored in memory
- Array declaration
- Array initialization (the "{...}" syntax)
- Strings as arrays of chars
- Accessing array elements using subscripts ("[...]")
- Initializing and filling arrays with loops
- Out-of-range errors (esegmentation faults")
- How indexing works (what is needed to compute the address)
- Passing arrays to functions
- Call-by-value vs. call-by-reference
- Searching and Sorting
- Why searching and sorting are important
- What a searching algorithm is
- What a sorting algorithm is
- How the two are related
- Trace-offs in selecting searching/sorting algorithms: speed vs. complexity
- Search:
- Sequential search:
- on unordered files
- on ordered files
- Best-case/worst-case search times
- Binary search
- Execution time
- "Log n" efficiency
- Best-case/worst-case search times
- Sorting:
- Some soring algorithm examples you should know
- Bubble sort
- Insertion sort
- Merge sort
- Quicksort (just a general description)
- Global and Static variables
- What a global variable is
- What needs global variables fill
- Downsides to using global variables
- Pointers
- What a pointer is
- How you declare a variable to be a pointer to a type (e.g.: int)
- How you get the address of a variable using '&', and assign it to a pointer variable.
- How you use a pointer variable to get the value at the contained address, using '*'