244 test 2
Test information may change! Come to class to stay on top of details. READ the NOTES that are online and READ the assigned readings!
Test may NOT be "made up" without prior arrangements or VERIFIED EMERGENCY!

Make a CAP!
This guide is not a "promise" of what will be on the test, but is simply an outline of topics that MAY be on the test that I provide to be helpful to you. Other topics not listed may also sneak onto a test from time to time.

Understand that a test is a SAMPLING and can not possibly cover all information from class. The idea, however, is that you must study all the information since you don't know for certain what questions will show up. This is for your benefit as it motivates you to learn more!


.Net 'managed' code language independent all languages generate IL and are compatible at that level '.net framework' huge class library - language independent CTS (common type system) - all .net types are compatible - a big deal! IL (msil, cil) CLR - 'the runtime' the CLR 'JITS' the IL into a native executable at execution-time C# Solutions may contain many Projects console, windows forms, library, wpf may share code isolate out or parametrize i/o or other dependencies C# Language: variables & types casting & conversion & implicit conversion arithmetic operators conditions, relational & logical operators loops branching Methods parameters: ref, value, out return value static Arrays indexing using filling, finding homogeneous creating, using, passing as parameters 2-d arrays creating, using nested loops needed passing as parameters nested loops loop within loop: row/column break goto counters, bools libraries creating, referencing, using, making usable by console & windows dll dynamic structs syntax heterogeneous value stack classes reference , dynamic heap, static refactor restructure for understandability / readability / maintainability not changing functionality - rename (knows scope) - extract method Delegates (understand) reference to a method Console input output cursor manipulation Algorithms primes, palindromes, random 2d arrays, latin squares, sudokus, GOL, simple search, simple sort, recursion (floodfill)
visual c++ native binary - 'unmanaged' code compile link embedded assembler cin >> cout << #include <iostream> int main() simple array syntax difference int x[] NOT int[] x functions prototypes pointers (a little) meaning int *p; // a pointer to an int int x=99; // an int p = &x; // p points to x cout << x << *p; // same output c language printf fprintf - output scanf - input pointers as above no reference
unix os & C++ simple interaction ls, cat, g++, mkdir, cd, cp, mv ./ current dir ../ up one level ../../ up 2 levels compiling g++ a.out by default -c creates.o object files -o filename linking g++ creates executable puts together all objects binaries make makefile automates the compile/link process processes programs being executed os allocates resources program execution disk to ram cpu executes ip registers
under the covers simple binary hex zoom out SDLC

Consider the following: int[,] alpha = new int[5,3]; int j,k; Which of the following statements correctly initializes all elements of alpha to 99? (i) for(j = 0; j< 5; j++) for(k = 0; k< 3; k++) alpha[j,k] = 99; (ii) for(k = 0; k< 3; k++) for(j = 0; j< 5; j++) alpha[j,k] = 99; (iii) for(j = 4; j>= 0; j--) for(k = 0; k< 3; k++) alpha[j,k] = 99; a. Only (i) b. Only (ii) c. Both(i) and (ii) d. All of these e. None Explain the difference in the above code. Different process? Order of processing?[0,0] then? Different outcome?
Suppose you have the following C++ declaration: int list[100]; Which of the following ranges is valid for the index of the array nameList? (i) 1 through 100 (ii) 0 through 100 a. Only (i) b. Only (ii) c. Both (i) and (ii) d. None of these Does C# change anything? yes: int[] list = new int[100];
Create a bool function, Found, that searches an unsorted int list and returns whether an item is in the list. 3 params: list, size, item IN C# AND C++ bool Found ( int[] array, int size, int item ) // don't need size in c# { for( int i=0; i<size; i++ ) if ( array[i] == item) return true; return false; } // bool Found ( int array[], int size, int item ) { for( int i=0; i<size; i++ ) if ( array[i] == item) return true; return false; }
Create a void function, Init, that will initialize a square 2-d array so that each element has a value equal to the sum of its indexes. The function has 2 parameters: the array and the size. In C# AND C++ void Init ( int[,] list, int size ) // don't need size in c# { for( int i=0; i<size; i++ ) for( int j=0; j<size; j++ ) list[i, j] = i+j; return; } // NO void Init ( int list[][9], int size ) { for( int i=0; i<size; i++ ) for( int j=0; j<size; j++ ) list[i][j] = i+j; return; }