Fall 2005, Section 010-012, Exam 01 Study Guide
What is covered
- Lecture Notes, 8/.31 through 10/5
- Labs 0-3
- Savitch, Chapters 1-3 and Sections 13.1, 13.2
- Andersen, Chapters 6, 7, 8
- Reading Notes for Sections 13.1, 13.2 (available from link on Calendar page)
Partial List of C++ Topics from Savitch Reading (not necessarily complete)
Chapter 1
- Declaring variables of types int, float, double, char, bool
- What a keyword or reserved word is
- What "case sensitive" means
- Assignment statements
- What happens with unitialized variables
- Escape sequences in character strings, particularly
\" \\ and \n
- Declaring constants with
const
- Integer vs. floating point division, and the mod operator (%)
- Using
static_cast<type>(expression)to convert types
- The increment and decrement operators (difference between pre and post increment)
- Using
cout, cerr, cin
- Using
#include <iostream>
- Using
using namespace std; or using std::cin; etc.
Chapter 2
- Boolean expressions (using
&&, || to mean "and" and "or")
- Avoiding things like
if (x < z < y) (should be: if ( (x < z) && ( z < y) ) )
- Comparison operators (
==, !=, <, <=, >=,. >)
- Keeping assignment (
=) and test for equality (==) straight
- The
bool type and the values true and false
- Using integers as true/false (false is zero, anything non-zero is true)
- Operator precedence
if...else if...else remember to always put condition in ()
- when do you need { } and when not
- the
switch statement ( and the case, break, default keywords; case labels must be integer type, char, enum type or bool
- enumeration types (
enum keyword)
- conditional operator, aka ternary operator (e.g.
int absValue(int x) { return (x<0)? -x : x; })
while, and do...while loops
- comma operator
for loops
break and continue in loops
Chapter 3
- using predefined functions, e.g.
sqrt() from #include <cmath>
- the
exit() function (from #include <cstdlib>)
- random number generation with
srand(), and rand(), and scaling of random integers
(not covered in lecture or labs, but in the reading! so study it!)
- defining functions that return a value
- formal parameters vs. arguments (aka actual parameters) (see p. 111 especially, and lecture notes).
- function call vs. function definition vs. function prototype
- return statements in void functions
- the fact that main() is a function
- the idea of "scope", and that variables are local to a function or block
- the scope of variables declared in a
for loop
Sections 13.1, 13.2
- defining recursive functions, both void functions and functions that return values
- stack overflow and infinite recursion
- activation frames and "the stack"
- what makes a correctly written recursive function (both from text and from reading notes)
(i.e. base case, and recursive call leading towards base case)
- why recursion is important (from lecture and from reading notes)
Partial List of Unix Topics (Not Necessarily Complete)
- Unix Commands: cp, rm, mkdir, pwd, cd, mv, ls, ls -l, chmod, cat, more, make
- Compiling: CC, g++, use of the -o and -c switches
- What the public_html directory is used for and how it corresponds to addresses (URLs) of web pages
Review lab00, lab01, lab02 and lab03 too!