CIS 3142
Programming Paradigms in C++
Exam #1 Topic List
The Structure of the Exam
- Questions will consist of reading and writing code, as well as possibly some multiple-choice / short answer questions.
- While the book is a good supplement, you are only responsible for topics and material in the lecture notes and
the labs. These are a great way for you to prepare yourself for the exam.
The exam covers:
- Lectures 00-02 and portions of Chapters 1
- Supplementary topics listed on the Class Calendar and referenced in the lectures
- Parameter Transmission
- Pointers Array and References
- Class Definitions
- Separate Compilation
- Labs 1-3,
Introduction and Sample Programs
- C++ program structure
#include
- function headers
using namespace
- You should be able to write code using all the language features presented in the Sample C++ Programs
- In particular:
- basic console (
cout/cin) I/O
- file I/O
- checking for successful file open and read
- fixed sized arrays
- In addition, you should be able to code using any other language features the two languages have in common
Preliminaries
- C++ Software Development
- source, object executable files
- compilation, linking, execution
- vs. Java development
- Scope
- class scope, local scope, global scope
- Lifetime
- fundamental, compound, and user-defined types
- lvalue / rvalue
- call-by-value / call-by-reference
- Value vs Reference Semantics
- copies vs aliases
- copy constructor and copy method
- Generics
- Java: using, type erasure
- C++ : templates, instantiation, code bloat
- Polymorphism
- Mutable vs Immutable
- Leveraging functionality to reduce redundancy and maintain semantic consistency
- Variable initialization: local, instance, class; in the presence of inheritance and composition
Parameter and Return-Value Transmission
- parameter and return value transmission: by-value, -reference, -const-reference
- why and when to use which method
Separate Compilation
- header/interface and source/implementation file
- include guards
- inline functions
- scope resolution
- what goes where
- what changes cause what sort of recompilation / linking
Pointers, Array, References
- pointers: declaring, using, dereferencing, passing to functions, address-of operator,
->, "call-by-pointer"
- arrays: fixed size, declaring, using, passing to functions
- references: declaring, passing to functions (call-by-reference)
- dynamic memory,
new/delete
- garbage, dangling reference (pointers)
- array 'resizing'
The Labs
- As mentioned above, you should be able to code using any of the concepts covered in the lab programs. This includes:
- All C++ language features covered in Lab 1 (Sample Programs) and 3 (simple classes and templates)
- The Java material covered in the Preliminaries and Lab 1 (The Java Rational class)
- be prepared to code some of the methods of that class, in particular using the leveraging technique (i.e.,
writing
add assuming addInPlace was available
- be able to write a copy constructor and/or copy method in Java (not necessarily for the
Rational class)
- Parameter Transmission
- Class Definitions
- Pointers Arrays, and References
- Separate Compilation
- Sample Programs
- Preliminaries
- Java and C++ Rational classes