CS1430 Final Test Review

1. Final Test is on Monday, Dec 17, 7:00 pm – 8:52 pm at Velzy Commons.

2. Bring pencils, No laptops, No tablets, No calculators, No smart phones and No MP3 players.

3. Submit all missing programs before the final exam time. Otherwise, you will not pass the course!

4. Simple Data types

· int, float, char ‘1’

· legal identifiers

· difference between char and integer ( ‘1’ != 1 ) (“1” != 1 )

5. Operators

· + - / * %, ++, --, +=, -=, *=, /=, %=

· logical and relational &&, ||, !, ==, != , >, <, >=, <=

· order of precedence

· truth tables ( and DeMorgan’s Law )

o ! ( X || Y ) == !X && !Y

o ! ( X && Y ) == !X || !Y

o Conditionals

· If statements

· If -- else

· If -- else if – else if – else

· The dangling else problem

· Use of { } and single statement bodies

· Switch statements

6. Error types

· Compiler / syntax errors

· Runtime errors – terminates with an error while running

· Logic errors – runs and might not produce an error while running, but produces wrong answer

· Fails to terminate – endless looping

7. Loops

· Count v. event controlled (eof( ), Flag , Sentinel) – prime reads

· Event controlled always have prime read

· For loops (parts: init, test, update)

· While loops (parts: test)

· Use of { } and single statement bodies

· Track computation inside of loops

8. Parameters and functions

· Formal(in the function heading)

· Actual (in the call) Argument

· // Parameter ( IN, INOUT, OUT )

· call by value: simple data type and structures

· call by reference – an array (even array of structures)

· const array to protect it (IN)

· reference structure or intrinsic parameter to make it writable

· const struct reference to make structure pass more efficient but read only

· what can be passed as a reference (no expressions “x+1”, etc.)

· Scope of variables: local, global, pass by val, pass by ref; see bill question on test 2

· Activation records

9. Arrays:

· declaration, 1 and 2 -D

· assignment, 1 and 2 -D

· passing 1 and 2 -D – in the call, in a prototype, in a function definition

· storage – mapping function for 1-D : draw a picture of 1 and 2 -D array

· accessing particular elements 1 and 2 -D

· loops for average, sum, input, output, etc.

· linear search

· selection sort (mechanics)

· insert element in order

10. Character Arrays and strings

· cin and cout

· assignment (strcpy), compare (strcmp), length (strlen)

· linear search

· null termination

· passes like an array

· difference between cstrings and strings

11. Guard conditions for divide by 0

12. Structures (not required)

· struct declaration

· struct access (dots)

· Arrays of struct and structs with arrays -- access and declaration

· Creating an instance of a structure (single and array of instances)

· Passing structs by reference and const-ing to protect from change in function calls and prototypes and function heading

13. Classes

· class definition

· data fields and methods (member functions)

· Access private members of a class

· Access public members of a class: object DOT method

· Constructor: default constructor, copy constructor, parameterized constructor

· Creating an object using constructor (single and array of instances)

· Arrays of objects and classes with arrays -- access and declaration

· Array based list: Find, Add, Delete, SelectionSort, IndexOfMin, Swap, Insert

· Passing objects by reference and const-ing to protect from change in function calls and prototypes and function heading

· Compare two objects: cannot compare directly; use member function

· Print objects: cannot cout directly; use member function to cout data fields

14. Enums

· Declaration of enums (remember cannot have same enumerator in multiple enums)

· Enum is simple data type: the value of ONE of all listed possible values (enumerators)

· Cannot cout or cin values

· Use of enums in switches

15. I / O

· cin / cout

· endl, setw()

· cin.ignore, cin.get, getline

· FileIO

· fstream, ifstream, ofstream

· MyIn.open( “c:\\myfile.dat”);

· MyIn >> x >> y >> z;

· MyOut << x << y << z << endl;

· MyIn.close( );

· Handling error and eof (priming reads)

· Output of floats, ints, arrays, chars, strings, structs, (enums cannot be output)

16. If your taking CS/SE 2430 next

· Download a copy of HiC from http://www.uwplatt.edu/csse/tools/hic/ and review your programs from this semester and try to design and implement something fun, e.g., a Tic-Tac-Toe game.

· 2430 uses NetBeans as the Java programming environment. This can be downloaded for free from http://www.netbeans.org/. This site also has lots of documentation. Do a 1430 program.

Have a safe and fun winter break.

adopted from Dr. Mike Rowe’s Summary