CS-1511 Computer Science I Final Exam Study Guide Fundamental Skills Test Part I. Arrays, Searching and Sorting Students should be able to… 1. Declare 1 dimensional and 2 dimensional arrays of primitive types Typical questions Write the code to declare a 1-d array of ______ with ten elements. pp 329-330 Write the code to declare a 2-d array of ______ with ___ rows and ___ columns. pp 345-348 2. Make array declarations using a value list See: p 330, 348 3. Demonstrate understanding of how to use the <array> class template. See The Array Class pp 387-390 4. Count items in an array (this is a variation on the sequential search pp 337-344 Typical questions Given an initialized array of ten integer values called num, write the code to count … the number of even or odd values the number of occurrences of a target value the number of values within a particular range 5. Explain how a binary search is conducted. No coding. Know the algorithm on p 372 6. Explain the differences between selection, bubble and insertion sorting techniques Summarized on pp 440-441 7. Explain the concept of Big-O as it applies to searching and sorting See pp 386-387 and 440-441 Part II. Pointers Students should be able to… 8. Declare pointer variables (and pointers to pointer variables) Typical question: Write the code to declare a pointer to a double pp 515-516 9. Capture the address of a variable See pp 516-519 Typical question: Write the code to assign an address to a pointer variable. Write the code to assign the contents of newly allocated memory to a pointer. Write the code to assign the contents of another pointer variable to a pointer. 10. Assign a null pointer to a pointer variable See pp 516-519 Write the code to assign a NULL value to a pointer variable. 11. Dynamically allocate an array Typical questions: See pp 525-526 Write the code to dynamically declare an array of 10 elements. 1 12. Declare an array of pointers Typical questions: See pp 532-534 Write the code to dynamically declare an array of 10 pointers to.... Write the code to create and assign pointers to the elements of an array of pointers 13. Create methods with pointer return types Typical questions: See pp 525-526 This method returns a pointer, how would it be called?. Write the code for a method that returns a pointer to… 14. Dereference pointer variables (using single and double indirection) Typical questions: See pp 519-522 Write the code to dereference a pointer to an int. Write the code to dereference a pointer to a pointer to an int 15. Pass pointers into a method Typical questions: See pp 522-524 Write the code to pass these pointer variables into a method that will… Write the code for the formal parameters of a method that is passed two pointers. 16. Use pointer arithmetic. Typical questions: See pp 528-530 Write a method that uses pointer arithmetic to sum up the values in an array. Write a method that uses pointer arithmetic to do a sequential search of an array. Write a method that uses pointer arithmetic to count particular values in an array. 17. Write a method that initializes (assigns pointers to) an indexed array. Typical questions: See pp 534-539 Write code that initializes a pointer array to the addresses of elements in another array. 18. Write code for a method that swaps pointers Typical questions: See pp 541-544 Write code that exchanges the contents of two pointer variables. Part III. Data Structures Students should be able to… 19. Describe the linked list data structure Typical question: pp 578-579 Describe, or diagram and label, the linked list data structure. 20. Explain the advantages linked lists over static arrays Typical question: See pp 575-578 What is the advantage of linked lists over fixed-size arrays for new element insertion? What is the advantage of linked lists over fixed-size arrays for element deletion? 21. Write and explain the Node class definition. Typical question: See p 585 What are the Node class definitions two public data members? Describe the purpose of each data member of the Node class. 22. Describe how to insert a new node in a linked list Typical question: pp 580-581 Diagram and label the process used to insert a new node in a linked list. 2 23. Describe how to delete a node from a linked list Typical question: pp 582-583 Diagram and label the process used to insert a new node in a linked list. Part IV. OOP, Constructors, Data Hiding, Accessors, Mutators Students should be able to… 24. Define, know how to identify and/or know how to implement each of the following key concepts: abstraction accessor class constructor data hiding destructor encapsulation header file include file implementation file instance instance method instance variable instantiation mutator object preprocessor directive private prototype public static variable 25. Given class code, construct a UML diagram/ or vice versa See pp 589-591, 646 653, 656 26. Write the code for a constructor See pp 587-588 27. Write a utility method to verify input before assigning a value pp 645-646 28. Write code for a mutator method. See:pp 642-644 29. Write code for an accessor method. See:pp 642-644 30. Distinguish between class instance variables and static variables. pp 585-586, 598 31. Write code for a method in an implementation file. See pp 591-595 32. Write client code to instantiate objects from a class and use them. pp 648-650 3