CSE 20211 Final Exam Study Guide

The final exam will cover the entire course, with a greater emphasis on the final third of the course (Chapters 10, 12, 15, and 17.) While everything in the book is fair game, the following are the most important items to review:
  • Exam I Study Guide
  • Exam II Study Guide
  • User-Defined Types (Chapter 10)
  • A struct groups together multiple variables, so that they can be named together and easily passed to functions. Be able to define a simple structure (such as a mailing address), declare variables of that type, access their individual members, and pass them to functions.
  • An enum gives symbolic names to a set of discrete values. Internally, an enumeration is just an integer, but the type helps to ensure only proper values are used. Be able to define an enumeration (such as suits in a card deck) and be able to declare and use variables of that type.
  • A typedef gives a new, short name to an existing datatype. This is a convenience that allows for clearer code. Be able to write and use typedefs for structures, enumerations, and basic types.
  • Be able to convert between binary and decimal numbers. Know how to use the bitwise operators: & | ^ ~ << >>. Explain the difference between logical-AND (&&) and bitwise-AND (|)
  • Data Structures (Chapter 12)
  • Describe how a program's memory is divided into four segments: code, static data, heap, and stack. What is stored in each segment?
  • Be able to use malloc and free to allocate and free space for a single variable, for an array of variables, for a single structure, or for an array of structures.
  • Sketch and describe how arrays, linked-lists, and trees can be used to store collections of data. Explain what operations can be done efficiently on each type of data structure.
  • Define a singly-linked list using a C struct. Write functions that add/remove an item to/from the head/tail of the list. Write functions that count, search, and print the contents of the list. Be careful with null pointers!
  • C++ as a Bigger C (Chapter 15)
  • Review new include files and changed names.
  • Use cin, cout, <<, > >, endl for input and output.
  • Pass arguments by reference using the & reference operator.
  • Write more flexible functions by using default parameters, function overloading, and function templates.
  • Introduction to Classes and Objects (Chapter 16 and 17)
  • Understand and describe the purpose of object oriented programming.
  • Objects contain both the data and the methods necessary to manipulate the data. Why does an object keep some things private to itself?
  • Write a simple class definition in C++, including a proper name, private data members, and public member functions.
  • Complete the class by writing correct member functions that manipulate the private data members.
  • Use the class by declaring objects of that type in main and invoking their methods appropriately.
  • Declare constructors to properly initialize an object. (Chapters 16.6 and 17.6)
  • Declare destructors to clean up an object when done. (Chapter 17.7)
  • Understand when constructors and destructors are called for automatic, static, and global objects. (Chapter 17.8)
  • Kinds of problems you are likely to see on the test:
  • What is the value? Given an expression, determine what the type and value it will produce. We did many of these problems together in lecture.
  • What does this print? Given a short program or program fragment, determine what the program will display. Example problems: 10.19, 10.20, 12.5
  • Write some code. Write a function or a short program that computes a particular mathematical expression, or achieves a particular side effect, such as drawing a shape. Example problems: 10.12, 10.17, 12.4, 12.6-12.10, 12.20, 12.21, 12.25, 15.5, 15.6, 16.12-16.15, 17.5-17.8
  • Find all the bugs. Given a program fragment, find everything in the program that will result in an error at compile time or at run time. If possible, correct it. Example problems: 10.4, 15.10, 17.2
  • Design a program. Given an object# What does this print? Given a short program or program fragment, determine what the program will display. Example problems: 10.19, 10.20, 12.5 ive, design a simple program (but don't write it!) Instead, sketch out the classes that you would write, and write out the prototypes of their member functions. Example problems to sketch: 16.17, 17.15