CS 2308 Exam I Review
Exam Format 130 Total Points 70 Points Writing Programs 35 Points Tracing Algorithms and determining results 25 Points Short Answer Similar to quizzes and programming assignments
Example Programming Problem Write a function that accepts two parameters: an array of integers and the number of integers in the array. Return an integer representing the number of odd integers in the array.
Example Tracing Problem What will the EXACT output of the following program be? int foo = 9; int *ptr = &foo; float foo2 = 5.7; *ptr = 2; foo2 = foo - foo2; if (foo > foo2) cout << "Hello!"; else if (foo < foo2) cout << foo2; else cout << foo; cout << endl; cout << "foo2 is: " << fixed << setprecision(1) << foo2 << endl;
Example Short Answer Of what order of magnitude is a Bubble Sort?
Arrays 60 points One and two-dimensional arrays Parallel arrays Declaration of various types traversing Difference between physical and logical size Parallel arrays The tsuPod program Passing arrays as parameters
Analysis of Algorithms 12 Points Be able to look at code or algorithm and make an educated guess at the order of magnitude Look to see if the statement that is executed the most is a function of the size of the data set Know which orders are faster and slower than the others Constant time algorithms are denoted as O(1) O(log2n), O(n), O(n2), O(2n) There are more
Searching and Sorting 16 Points May have to write sequential search, but not the others. Know the algorithms and the order of magnitude of each Sequential search Binary search Bubble sort Selection sort
C programming 15 Points Header files I/O libraries No const printf and scanf No const No string data type Know how to manipulate arrays of characters Know how C string functions work Only pass by reference No bool data type
Pointers 12 Points A pointer is a variable that holds the address of a memory location Declaration int *ptr; Assignment ptr = &foo; //& is the address function Dereferencing *ptr = 54; //same as foo=54; You can point to any kind of data type
Linux 6 Points Know the basic commands you needed to complete the last program Know how to compile and run a C program in Linux Know how to create and move around the Linux file system
Testing 6 Points Given a problem, be able to provide example inputs and outputs to test potential solutions Similar to tsuPod, but much smaller problem.
How to Study Rewrite all the programs. Redo labs. Learn by doing and recognizing patterns. Don’t stay up late!! Get some sleep and eat a good breakfast.
What to bring Pencils and erasers We will provide scratch paper No calculators
Questions