CS-1511 Computer Science I Final Exam Study Guide Revised 12/6/17

Fundamental Skills Examination

Part I. Program Design

1. Given a problem statement, write an efficient and effective solution algorithm in pseudocode See. p 211-217, 276-281

2. Know how to trace an existing algorithm to verify its correctness

3. Know how to correctly specify pre and post conditions for functions of varying types. See p 275-276 and examples in program Displays in Chapters 5-10

4. Given a problem statement construct a UML class diagram for key objects required by the solution. See Chapter 10.2 notes and UML diagram. Typical problem: Given class code, construct a UML diagram/ or vice versa

Part II. Types and Control Structures

5. Know how typedef works See. p 520-522

7. Know when typecasting is needed, how conventional C typecasting is done as well as C++ typecasting. See. p 190-192

Part III. Functions and Parameter Passing

8. Know the difference between a function declaration (prototype) and function definition See. p 193-203

9. Know how call by-value and by-reference work See. p 197-198, 259-272

10. Know what the concept “procedural abstraction” means See. p 204-207

Part IV. Arrays, Searching and Sorting

Terminology: Define, know how to identify and/or implement each of the following key concepts • element • subscript • index • partially filled array • parallel array • static array

11. Declare 1 dimensional arrays of primitive types and initialize them. See. Section 7.1

12. Know how to pass arrays into functions See: Section 7.2

13. Know how to use partially filled arrays. See Section 7.3

1

14. Know how to perform the following tasks with arrays (See Chapter 7 notes) Summation Sequential search for a target value (See. p 416-418) Find the first occurrence, last occurrence, count the occurrences Find the largest, smallest

15. Know how the selection sort works. See pp. 419-422

Part V. Pointers

Terminology: Define, know how to identify and/or implement each of the following key concepts • pointer • address • pointer variable • dereference • automatic variable • dynamic allocation • indirection • double indirection

16. Declare pointer variables (and pointers to pointer variables) Typical question: Write the code to declare a pointer to a double pp 510-517 and Chapter 9 notes

17. Capture the address of a variable See pp 510-511 and Chapter 9 notes 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.

18. Assign a NULL pointer (0) to a pointer variable See Chapter 9 notes Write the code to assign a NULL value to a pointer variable.

19. Dereference pointer variables (using single and double indirection) Typical questions: See pp 510-517 and Chapter 9 notes Write the code to dereference a pointer to an int. Write the code to dereference a pointer to a pointer to an int

20. Dynamically allocate an array Typical questions: See section 9.2 Write the code to dynamically declare an array of 10 elements.

21. Deleting memory assigned to pointer variables and dynamically allocated arrays Typical questions: See p 518-519, 524-529 Write the code to delete memory assigned to a pointer variable Write the code required to delete a dynamic array What is the problem of the “dangling pointer” or “stranded memory”

22. Create functions with pointer return types Typical questions: See Chapter 9 notes This function returns a pointer, how would it be called? Write the code for a function that returns a pointer

2 23. Pass pointers into a function Typical questions: See Chapter 9 notes Write the code to pass these pointer variables into a function that will… Write the code for the formal parameters of a function that is passed two pointers.

24. Use pointer arithmetic. Typical questions: See pp. 530-532 and Chapter 9 notes 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.

Part VI. OOP, Constructors, Data Hiding, Accessors, Mutators

Terminology: Define, know how to identify and/or implement each of the following key concepts: • abstraction • accessor • class • constructor • data (information) hiding • destructor • encapsulation • instance • instance method • instance variable • instantiation • mutator • object • private • prototype • public

25. Explain what a struct is and how it differs from a class. See. Section 10.1 and pp 577

26. Write a utility methods to read in or display the values stored in class data members pp 558-560

27. Explain the advantages and disadvantages of using private for data members. pp. 561-569 and notes for 10.2

28. Write code for a mutator method. See:pp 561-570

29. Write code for an accessor method. See:pp 561-570

30. Distinguish between class instance variables and static variables. See Chapter 10 notes

31. Write code for a method declaration outside of the class definition to which it belongs. See pp 561-570

32. Write client code to instantiate objects from a class and use them. pp 563-564

33. Write the code for a default constructor and an initializing constructor (pp. 578-588)

3 Part VII. Advanced Topics (no coding)

34. What is an ADT? What is abstraction? What is an ADT interface? See Section 10.3

35. Describe the linked list data structure. See Chapter 10 notes Typical question: Describe, or diagram and label, the linked list data structure.

36. Explain the advantages linked lists over static arrays. See Chapter 10 notes Typical questions: 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?

37. What is inheritance? See Section 10.4 Typical question: Given the code below, what is the base class, upper class, parent class? Given the code below, what is the derived class, child class? Given an object whose class definition was inherited, which of the following operations are possible?

38. List three major types of ADTs, other that the LIST ADT.

39. Analysis – what is the Big-O of the search and sort functions we have discussed? See lecture notes.

4