1/88
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
What’s the difference between a pointer and pointer variable?
A pointer is a variable that stores the memory address of another variable, whereas the pointer variable is a variable that holds the address.
What operator allows you to access the item that the pointer points to?
Indirection ( * )
The _____ key word was introduced to represent the address 0.
nullptr
True or False: Pointers can mix data types.
False
What is Dynamic Memory Allocation
A process that can allocate storage for a variable while a program is running.
The ____ operator is used to allocate memory.
new
What key is used to free dynamic memory.
delete
Structure
A C++ construct that allows multiple variables to be grouped together
The ____ operator refers to members of struct variables
dot (.)
What operator assigns the address
&
Enumerated Data Type
A programmer defined data type that consists of values as enumerators, which represent integer constants.
Class
Similar to a struct, but variables and functions in the class can have different properties
What is an object?
An instance of a class, in the same way that a variable can be an instance of a struct
Explain the relationship between classes and objects
A class is like a blueprint and objects are like houses built from the blueprint
Attributes
Members of a class
Methods or behaviors
Member functions of a class
What is const?
const appears after the parentheses in a member function declaration specifies that the function will not change any data in the calling object.
Public members
can be accessed by functions outside of the class
Private members
can only be called or accessed by functions that are members of the class
Difference between Mutators and Accessors
Mutators stores the value in a private member variable. Also known as a setter. Accessors retrieves a value from a private member variable. Also known as the getter.
A constructor is a function that is automatically called when an object is
created
A destructor is a member function that is automatically called when an object is
destroyed
True or false: Overloading Constructors can have more than one constructor
True
When a constructor is calls another constructor in the same class is called
constructor delegation
Default constructor
a constructor that takes no arguments.
A ____ member function can only be called by another member function
private
UML stands for
Unified Modeling Language
A member variable in a class where each object has its own copy is called
instance variable
When one variable is shared among all objects of a class is called
static variable
A ____ is a function or class that is not a member of a class, but has access to private members of the class
Friend
A _______ is a special constructor used when a newly created object is initialized to the data of another object of the same class
Copy Constructors
The ____ pointer is predefined pointer available to a class’s member functions
this
Explain aggregation and its role
A class that is a member of a class that supports the modeling of ‘has a’ between classes - enclosing class ‘has a’ enclosed class
Name two implements that any class that contains a pointer or reference to an outside piece of data.
Copy constructor and copy assignment operator
The _____ keyword declares which default operations that you want the compiler to automatically provide
default
The ___ keyword declares which default operations you do not want the compiler to automatically provide.
delete
_____ provides a way to create a new class from an existing class
Inheritance
The base class is also known as
Parent class
The derived class is also known
child class
Which is the base class? class UnderGrad : public student
student
Which is the derived class? class box : public rectangle
box
like private, but accessible by objects of derived class
protected
Determines how private, protected, and public members of base class are inherited by the derived class
class access specification
Object of the derived class that can be treated as object of the base class
public
protected
Restrictive than public, but allows derived classes to know details of parents
private
prevents objects of the derived class from being treated as objects of the base class
Name the constructors that cannot be inherited
Default, Copy, and Move Constructor
Virtual member function
Is a function in a base class that expects to be redefined in the derived class
A base class can be derived from another base class
Class Hierarchies
Dynamic binding
functions bound at run time to function that they call
Static Binding
A function bound at compile time
The ____ key word tells the compiler that the function is supposed to override a function in the base class
override
The ____ key word cannot be overridden in a derived class
final
A class that can have no objects
Abstract base class
A derived class that can have have more than one base class
Multiple Inheritance
Exception
An object or value that signals an error
Explain the catch and throw exceptions
Throw sends a signal that an error has occurred and catch process the exception; interpret the signal
When is the bad_alloc exception thrown?
When the new operator fails to allocate memory.
A pattern for a function that can work with many data types
Function template
What does STL stand for?
Standard Template Library
Give a short answer for the container, iterator and algorithms templates
Containers class templates for objects that store and organize data. Iterators behave like pointers, and used to access individual data elements in a container. Algorithms perform various operations on elements of containers.
A set of data structures (nodes) that contain references to other data structures
Linked list
Node contains
data and a pointer
Last node points to
null (address 0)
An empty list
is a list that contains 0 nodes
A LIFO (last in, first out) data structure
Stack
True or False: A stack can hold char values
True
A FIFO (first in, first out) data structure.
Queue
Where are elements are added in Queue locations?
rear
Where are elements removed?
Front
Explain the difference between enqueue and dequeue.
Enqueue adds an element to the rear of the queue and dequeue removes an element from the front of a queue
Dynamic Queues
Similar to stack, a queue can be implemented using a linked list
A function contains a call to itself
recursive
What happens when a recursive function is called?
A new copy runs with new instances of parameters and local variables created
True or false: Recursive members cannot be members of a linked list class
False