1)
Review for Test 1 (Chapter 1 - 5)
1. Software development 1. Pre-conditions and Post-conditions 2. Running time analysis Big O Timing loops and nested loops
Exercises:
1) Write the simplest big-O expression to describe the number of operations required for the
following algorithm: for (i = 1; i < N; ++i) { ...statements that require exactly i operations... }
2) Which of these statements will always cause a program to halt? (x is an int variable).
A. assert(10 > 0); B. assert(10 < 0); C. assert(x < 0); D. None of the above will always cause a program to halt.
3) Which of the following formulas in big-O notation best represent the expression
n?+35n+6? A. O(1) B. O(log n) C. O(n) D. O(n?)
2. Data modeling 1. Classes in C++ 2. Access restrictions private and public Friends 3. Role of header files and implementation files 4. Namespace usage When defining resources in a namespace When using resources in a namespace 5. Constructors Purpose Syntax Default parameter values 6. Value semantics
What happens when a copy is made: deep copy & shallow copy 3. Function parameters
1. Value parameters 2. Reference parameters 4. Overloading operators 1. Syntax for member function 2. Syntax for non-member function
Exercises:
1) Here is part of the throttle declaration:
class throttle { public:
void shut_off(); double flow(); ... private: int position; };
Write several lines of C++ code to declare a throttle called quiz, activate the member function that shuts off quiz's flow, and then print the current flow from quiz.
2) Suppose that you define a new class called foo. For two foo objects x and y, you would like the expression x+y to be a new foo object. What is the prototype of the function that you must write to enable expressions such as x+y?
3) Here is a function prototype and some possible function calls: int day_of_week(int year, int month = 1, int day = 1); // Possible function calls: cout ................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related searches
- 1 or 2 374 374 1 0 0 0 1 168 1 1 default username and password
- 1 or 3 374 374 1 0 0 0 1 168 1 1 default username and password
- 1 or 2 711 711 1 0 0 0 1 168 1 1 default username and password
- 1 or 3 711 711 1 0 0 0 1 168 1 1 default username and password
- 1 or 2 693 693 1 0 0 0 1 168 1 1 default username and password
- 1 or 3 693 693 1 0 0 0 1 168 1 1 default username and password
- 1 or 2 593 593 1 0 0 0 1 or 2dvchrbu 168 1 1 default username and password
- 1 or 3 593 593 1 0 0 0 1 or 2dvchrbu 168 1 1 default username and password
- 1 or 2 910 910 1 0 0 0 1 168 1 1 default username and password
- 1 or 3 910 910 1 0 0 0 1 168 1 1 default username and password
- 192 1 or 2 33 33 1 0 0 0 1 1 1 default username and password
- 1 or 2 364 364 1 0 0 0 1 168 1 1 admin username and password