PIC10B/1 Winter 2014 Exam I Study Guide

Similar documents
PIC10B/1 Winter 2014 Final Exam Study Guide

PHY4321 Summary Notes

PIC 10B Lecture 1 Winter 2014 Homework Assignment #3

CS250 Final Review Questions

Chapter 18 - C++ Operator Overloading

Operator Overloading in C++ Systems Programming

Introduction to C++ Introduction to C++ 1

Chapter 15 - C++ As A "Better C"

I BSc(IT) [ Batch] Semester II Core: Object Oriented Programming With C plus plus - 212A Multiple Choice Questions.

CHAPTER 1 Introduction to Computers and Programming CHAPTER 2 Introduction to C++ ( Hexadecimal 0xF4 and Octal literals 031) cout Object

Piyush Kumar. input data. both cout and cin are data objects and are defined as classes ( type istream ) class

Fundamentals of Programming Session 25

Abstract Data Types (ADTs) 1. Legal Values. Client Code for Rational ADT. ADT Design. CS 247: Software Engineering Principles

CS 247: Software Engineering Principles. ADT Design

Operator Overloading

Fundamentals of Programming Session 27

Documentation. Programming / Documentation Slide 42

Absolute C++ Walter Savitch

OBJECT ORIENTED PROGRAMMING USING C++ CSCI Object Oriented Analysis and Design By Manali Torpe

4 Strings and Streams. Testing.

Lecture 10. To use try, throw, and catch Constructors and destructors Standard exception hierarchy new failures

Introduction to C++ Systems Programming

C++ Quick Guide. Advertisements

c++ keywords: ( all lowercase ) Note: cin and cout are NOT keywords.

Lecture 14. No in-class files today. Homework 7 (due on Wednesday) and Project 3 (due in 10 days) posted. Questions?

G52CPP C++ Programming Lecture 14. Dr Jason Atkin

CSC 330 Object Oriented Programming. Operator Overloading Friend Functions & Forms

Introduction. W8.2 Operator Overloading

Fundamentals of Programming Session 28

CS250 Final Review Questions

W8.2 Operator Overloading

Lecture 5 Files and Streams

CSI33 Data Structures

CSC 307 DATA STRUCTURES AND ALGORITHM ANALYSIS IN C++ SPRING 2011

Lecture 9. Introduction

Introduction to C++ Professor Hugh C. Lauer CS-2303, System Programming Concepts

Introduction to Computers and C++ Programming p. 1 Computer Systems p. 2 Hardware p. 2 Software p. 7 High-Level Languages p. 8 Compilers p.

Vectors of Pointers to Objects. Vectors of Objects. Vectors of unique ptrs C++11. Arrays of Objects

Short Notes of CS201

Inheritance and Polymorphism

CS201 - Introduction to Programming Glossary By

More Advanced Class Concepts

Problem Solving with C++

Object-Oriented Design (OOD) and C++

std::string Quick Reference Card Last Revised: August 18, 2013 Copyright 2013 by Peter Chapin

Chapter 3 - Functions

G52CPP C++ Programming Lecture 17

2 ADT Programming User-defined abstract data types

KOM3191 Object Oriented Programming Dr Muharrem Mercimek OPERATOR OVERLOADING. KOM3191 Object-Oriented Programming

Input/output. Remember std::ostream? std::istream std::ostream. std::ostream cin std::istream. namespace std { class ostream { /*...

Chapter 12 - C++ Stream Input/Output

Introduction. Lecture 5 Files and Streams FILE * FILE *

Functions and Recursion

CSE 333. Lecture 9 - intro to C++ Hal Perkins Department of Computer Science & Engineering University of Washington

Interview Questions of C++

SRM ARTS AND SCIENCE COLLEGE SRM NAGAR, KATTANKULATHUR

CS250 Final Review Questions

Introduction to Programming Using Java (98-388)

Chapter 8 File Processing

Overview of Lecture. 1 Overloading I/O Operators. 2 Overloading << and >> for Fractions. 3 Formatted vs Unformatted Input

Operator Overloading

Object-Oriented Programming

Object Oriented Programming

Fundamental Data Types. CSE 130: Introduction to Programming in C Stony Brook University

Fall 2017 CISC/CMPE320 9/27/2017

Preface to the Second Edition Preface to the First Edition Brief Contents Introduction to C++ p. 1 A Review of Structures p.

for (int i = 1; i <= 3; i++) { do { cout << "Enter a positive integer: "; cin >> n;

Quiz Start Time: 09:34 PM Time Left 82 sec(s)

CS201 Solved MCQs.

Object Oriented Programming: In this course we began an introduction to programming from an object-oriented approach.

CSE 333 Lecture 9 - intro to C++

CS201 Latest Solved MCQs

Pointers and Strings Prentice Hall, Inc. All rights reserved.

Borland 105, 278, 361, 1135 Bounded array Branch instruction 7 break statement 170 BTree 873 Building a project 117 Built in data types 126

Welcome Back. CSCI 262 Data Structures. Hello, Let s Review. Hello, Let s Review. How to Review 8/19/ Review. Here s a simple C++ program:

Classes in C++98 and C++11

UNIT- 3 Introduction to C++

Welcome to Teach Yourself Acknowledgments Fundamental C++ Programming p. 2 An Introduction to C++ p. 4 A Brief History of C++ p.

Software Engineering Concepts: Invariants Silently Written & Called Functions Simple Class Example

COMP6771 Advanced C++ Programming

Jan 27, C++ STL Streams. Daniel Maleike

COP Programming Assignment #7

Strings and Streams. Professor Hugh C. Lauer CS-2303, System Programming Concepts

CISC 2200 Data Structure Fall, C++ Review:3/3. 1 From last lecture:

CSE 303: Concepts and Tools for Software Development

3.1. Chapter 3: Displaying a Prompt. Expressions and Interactivity

Cpt S 122 Data Structures. Course Review Midterm Exam # 2

Final exam. Final exam will be 12 problems, drop any 2. Cumulative up to and including week 14 (emphasis on weeks 9-14: classes & pointers)

Come and join us at WebLyceum

Computer Science II CSci 1200 Lecture 24 C++ Inheritance and Polymorphism

Assignment operator string class c++ Assignment operator string class c++.zip

CS201 Some Important Definitions

엄현상 (Eom, Hyeonsang) School of Computer Science and Engineering Seoul National University COPYRIGHTS 2017 EOM, HYEONSANG ALL RIGHTS RESERVED

DHANALAKSHMI COLLEGE OF ENGINEERING, CHENNAI DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING CS6456 OBJECT ORIENTED PROGRAMMING

Weiss Chapter 1 terminology (parenthesized numbers are page numbers)

Introduction to C++ (Extensions to C)

Assignment 5: MyString COP3330 Fall 2017

cs3157: c++ lecture #2 (mon-11-apr-2005) chronology of some programming languages... C++ vs Java identifiers.

Ch. 12: Operator Overloading

CS304 Object Oriented Programming Final Term

Transcription:

PIC10B/1 Winter 2014 Exam I Study Guide Suggested Study Order: 1. Lecture Notes (Lectures 1-8 inclusive) 2. Examples/Homework 3. Textbook The midterm will test 1. Your ability to read a program and understand what it does 2. Your ability to debug a program 3. Your ability to write C++ code snippets to accomplish small tasks 4. Your ability to write an entire C++ program from scratch 5. Your understanding of the lecture notes, homework, examples, and homework readings Terms to know: inheritance derived class (subclass) base class (superclass) is a relationship has a relationship base class component of an object constructor intializer list hidden members public members protected members private members accessor (get) methods mutator (set) methods public inheritance protected inheritance 1

private inheritance polymorphism virtual function polymorphic collection of objects dynamic method binding Overriding an inherited member function data slicing dynamically created variables on the heap statically bound function (at compile time) dynamically bound function (at run time) extensible abstract class concrete class pure virtual member function interface modular friend of a class stream byte bit istream (input stream) object ostream (output stream) object fstream (file stream) object sstream (string stream) object istringstream (input string stream) object ostringstream (string stream) object operator operands operation operator overloading prefix operator postfix operator clone of a variable default constructor, conversion constructor, copy constructor code memory 2

static data memory stack memory heap memory function pointers pointer pointee static variable global variable wild (dangling) pointer NULL pointer allocate a variable deallocate a variable pass/return by reference pass/return by value delete a pointer memory leak dereferencing a pointer memberwise copying shallow copy deep copy assignment operator= calling object (*this) this pointer to calling object destructor managing heap memory the Big 3 : copy constructor, assignment operator, destructor 3

C++ libraries and identifiers in those libraries we have used so far: iostream std::cin std::cout std::endl std::istream fail() clear() get() unget() peek() ignore() eof() std::ostream put() fstream std::ifstream std::ofstream sstream std::istringstream std::ostringstream str() iomanip std::left std::right std::defaultfloat std::fixed std::scientific std::showpoint 4

std::setprecision std::setw string std::string assert.h assert vector std::vector cstdlib NULL rand() srand(int seed) cmath sqrt pow fabs ceil floor exp log log10 sin cos tan Things to know: How to define a function. Know the difference between arguments passed by value and arguments that must be passed by reference. How to define a class and implement member functions, constructors and destructor. 5

How to define a derived class that inherits publicly from its base class. How to define a derived class constructor and use an initializer list to construct the base class component using an appropriate constructor of the base class. How to use an initializer list to initialize object members. How to declare an object and access its members. Know the difference between a public, a protected, and a private member function or variable. Know what happens when assigning a base class object a derived class object (data slicing). Know what happens when assigning a base class pointer a derived class pointee. How the access level of inherited members changes in the derived class for public inheritance, protected inheritance, and private inheritance. How to achieve polymorphism and recognize/enable dynamic method binding in C++. How to override inherited methods and access the inherited version using the base class name and ::. How to obtain a polymorphic collection of objects. How to define a virtual function and understand that all subsequent overridden versions in derived classes are automatically virtual. 6

Know the difference between calling a virtual overridden method and a non-virtual overridden method using a base class pointer. How to define/recognize a pure virtual function. How to define/recognize an abstract class. How to derive concrete classes from an abstract class. Remember how to use an abstract class (declaring pointers okay. Cannot construct object of that type directly (only base class components of concrete subclass objects in constructor initializer lists). How to declare and define friend functions and friend classes of a class and understand what it means to be a friend of a class. How to overload operators as member functions, friends, and nonmember nonfriend functions. Know when one way is allowed and when it is not. Eg. ones involving assignment such as =, +=, -=, ++, -- must be member functions. Input >> and output << operators must be nonmembers or friends. Other ones such as +, -, *, == can be defined either way. Know how to define them either way (and know their signatures (how many parameters? Should parameters be passed by value or reference or const reference? What should be the operator s return type? )). Know how the expressions involving operators translate to function calls. Eg a += b; means a.operator+=(b); 7

Know the different signatures for prefix and postfix ++ and and how to define them. Understand C++ will never try to implitly convert the left operand into an object of the appropriate type (using a conversion constructor) if the operator is overloaded as a member function, but it will convert the right operand into an object of the appropriate type (provided there is an appropriate conversion constructor) in either case. How to declare a pointer and assign it a pointee. How to declare a function pointer variable or array of function pointers. How to dereference/use function pointers. How to recognize accessing a wild pointer. How to recognize/prevent a memory leak. How to pass pointers into functions as arguments and return pointers. How to use an array name as a pointer to the element at index 0. How to declare and initialize arrays and 2D arrays and access their elements. How to create and use vectors to store, organize, shuffle, and manipulate collections of objects, pointers, or values of the same type. How to create and deallocate dynamically allocated arrays. 8

How to declare variables on the heap and deallocate those variables using pointers. How to use the this pointer to access the calling object inside its member function, constructor, or destructor definition. How to use/recognize a static or global variable. Understand that you must initialize all variables before they are used. Know when a destructor is automatically called or when C++ tries to call one. How to define a copy constructor, destructor and assignment operator when an object needs to manage dynamic memory. How to read a text file using an ifstream. How to write or append to a text file using an ofstream. How to read various types of data into memory from a string source using an istringstream. How to write various types of data to a string value target using an ostringstream. How to compare char or string values using operators. C++ fundamental types short int long 9

unsigned short unsigned int unsigned long float double bool char C++ classes string concatenation operator + string and char orderings comparing string values using <, >, <=, >=, ==,!= member functions length substr insert erase replace find c_str() cin >>, cout <<, getline(cin, ) vector element access bracket operator[] member functions size capacity resize empty clear front back push_back pop_back 10

operators parenthesis () arithmetic +, -, *, /, % relational <, <=, >, >= comparison ==,!= logical &&,,! increment (prefix and postfix) ++ decrement (prefix and postfix) -- assignment =, +=, -=, *=, /=, %= input >> output << ternary (? : ) sizeof address of & dereferencing * arrow -> aka (* ). new delete delete [] casting static_cast<int>('a') escape sequences (char values) \n newline \t tab \r carriage return \\ backslash \" quotation mark \a ring system bell \0 null character control structures 11

selection if if/else if/else/else switch repetition while do-while for Horstmann s graphics lecture will NOT be covered. 12