COM1204, Summer 1998, Prof. Futrelle

Review topics list for Quiz #1 (Wed. 8 July), C++ Basics

The following is list of brief descriptions of the material that you should know for the first quiz. The Readings involved are those from LL (Lippman & Lajoie) as listed in the Syllabus, basically, the Overview in chapters 1 and 2, as well as basic material in chapter 3 and a few other specific sections mentioned below.

In the quiz, you will be asked to write out certain statements in C++ when given their English description, as well as to correct or complete code snippets. You also need to know certain overall organizational constraints of C++, primarily the ordering of includes, declarations, and definitions, as discussed in class.

The items:

The form of main() and its return statement

The form of an include statement for a system-supplied header file, e.g., #include <iostream> or <fstream>
and a user file, #include "myheader.h" [no semicolons]

The form of single-line and comment pairs (no nesting of pairs)

Definitions of variables and their initial values, e.g., int age = 10, weight = 150;

Form of the if-else, while, and for statements (can declare loop var inside or outside for)

Output statements using cout and << and endl as well as cin and >>

Simplest uses of the built-in array type (sec. 2.1)

Creation and deletion of an array, e.g., pg. 39

Pointers, especially the use of new to return a pointer to a class instance, and the type of variable
that is assigned to the instance, e.g., puppy* fido = new puppy;

Proper form for the definition of a simple class and public: and private: components
(we will almost exclusively use public:) Slot definitions such as int a, b; are legal, contrary to
what I said in class on Monday, 7/6.

Importance of declarations of classes before definitions (sec. 13.1.5)

Definition of a constructor and form of the member initialization list (sec. 14.5)
as well as operations in the constructor code body

Form of the definition of a member function (method) outside the body of a class definition

The string class, including how to create a string, concatenate, test for string equality (sec. 3.4.2)

The vector class using the standard formulation of sec. 2.8 and 3.10.
Code Warrior has slight differences, e.g., vector<phone*, <allocator phone*> > phones;
Note that one or more spaces must occur between the last > and >

In Chap. 3, learn the basics of variables, allowed form of names for variables, initialization, difference between an lvalue an rvalue, bool, arrays, multidimensional arrays, more on vectors, dot and arrow access notation for class members.


Topics NOT covered in the quiz include:

Templates in general (but templated vectors are on the quiz), catch and throw, namespaces, const, assert, allocation (new) of other than simple arrays and classes, iterators, reference types, enumeration types, ....

Created 7/5/98