Chapter 6 Functions 6.1 6.2 6.5 6.6 6.7 6.8 6.9 6.10 6.11 6.18 6.21 (several sections on call by reference) 6.22 6.23 6.24 6.25 6.26 6.27 summary on 250 Chapter 7 Arrays 7.1 7.2 7.3 7.4 7.5 7.6 7.7 7.8 7.9 7.10 Arrays in Functions 7.11 7.12 7.13 7.14 Chapter 11 Dynamic/Pointers Dynamic Arrays: 11.1 11.22 11.23 Chapter 17 Recursion 17.1 17.2 17.3 17.4 17.5 17.6 17.7 17.8 17.9 17.14 17.15 The Liang website is invaluable and includes results to the above. Some example questions. Remember that during the test you will need to use good programming practices throughout. There may be question 'types' that are not listed below, but this is a good sample. Again, you should also go over the review problems in the book for the chapters we have covered - as well as read any portions of the chapters you may have missed. Some problems will likely come directly from those as well. Some sample questions: ------------------------------------ Dynamic Arrays ------------------------------------ What is a dynamic array? What is the difference between dynamic and static arrays? Demonstrate how to declare a dynamic array? How can one tell that code uses dynamic data? Every new should have a delete for good programming practice. What is the difference between static and dynamic memory? - static memory goes on the stack and is bound at compile time - dynamic memory goes on the heap, is allocated with new, released with delete and is bound at run time ------------------------------------ Arrays ------------------------------------ Demonstrate how to declare an array. What is an array? Demonstrate how to initialize an array. Demonstrate how to set every element of an array to a specific value. Demonstrate how to pass an array to a function. Arrays "act like call by reference". Explain how or why. Demonstrate how to access a specific element of an array. What is the smallest index of an array? What is the largest index of an array? What happens when you "blow array bounds" or access an invalid index of an array? Demonstrate code to solve the following problem with an array . . . Examples: Multiply every element by twenty Output every element with some format Add twelve to every element Assign every element to be the next element (except the last?) Swap two entries (use a temp variable) ------------------------------------ In General: ------------------------------------ What is the output of the following program . . . Find all errors (run-time and compiler) in the following code. (code would follow) Given the following snippet of code, what is the output? (code would follow) Give C++ code for the following pseudocode. (pseudocode would follow) Give C++ code for the following problem statement. (a problem statement would follow) Give pseudocode for the following problem statement. (a problem statement would follow) What does the following code do? What are the values of all variables at the end of its execution? (code would follow) ------------------------------------ Functions: Recursion ------------------------------------ What is a recursive function? What are the base cases of a recursive function? What is the 'winding up' and 'winding down' of a recursive function? How is the stack used in recursive functions? Is recursion faster than iteration? Explain. What is the difference between recursion and iteration. Write code for this recursive function . . . What is the output of the following code . . . What is the error in the following code . . . What is stack overflow in recursive functions? Can all recursive functions be rewritten iteratively? Why not or how? What is necessary to re-write all recursive functions iteratively? What is a stack trace? Demonstrate a stack trace on . . . ------------------------------------ Functions: ------------------------------------ Give a function definition for . . . Give a function prototype for . . . What is pass-by-value? What is pass-by-reference? When is pass-by-value used? When is pass-by-reference used? Compare and contrast pass-by-value and pass-by-reference? What is the scope (where can it be used) of this variable?