OOP Final

Ace your homework & exams now with Quizwiz!

If iter is an iterator to a container, what is the expression that will have the value of the object pointed to by iter, and will then cause iter to point to the next element.

*iter++

The following are some general problems with procedural programming which object-oriented programming was designed to solve:

-Data does not have an owner -Insuffcient support for abstraction -Low Security -Difficult to maintain data integrity -Difficult to maintain

The main markers of Object-Oriented Programming which we discussed in class are:

-Data integrity -Abstraction -Encapsulation

The following are access specifiers:

-Friend -Public -Protected

The following are types of inheritance:

-Private -Protected -Public

The main markers of Procedural Programming which we discussed in class are:

-Top-down programming -Global Functions

The naming convention of templatized parameters is usually which three (3) of the following:

-t -u -v

STL sequence containers include

-vector -deque -list -forward list -array

If you define a vector v with the default constructor, and define another vector w with a one-argument constructor to a size of 11, and insert 3 elements into each of these vectors with push_back(), then the size() member function will return ______ for v and ______ for w.

3,11

When we want to hide the implementation of creating an arbitrary object, what design pattern should we use?

Factory

A class is defined as: a set of objects that share a common purpose.

False

A destructor could take arguments, but has no return value.

False

A statement that throws an exception does not need to be located in a try block.

False

An iterator can always move forward and backwards through a container.

False

Generic Programming sacrifices speed for reusability

False

In STL, if I write a new algorithm, then I must write a new iterator for every container.

False

Member variables and functions that are protected are kept safe from derived classes.

False

Polymorphism is when a derived class uses base class functionality.

False

Private inheritance means that all derived classes will have access to the private member data and functions of the base class.

False

STL is hard to use because it is not guaranteed to be on every system.

False

STL is highly accurate but comes at the cost of lower performance.

False

STL keeps programmers from having to reinvent the wheel, but comes at the cost of increased code length, making it less readable.

False

Statements that might cause an exception must be part of a catch block.

False

Suppose that class B inherits publicly from class A. Class A is changed by this relationship.

False

The "friend" access specifier breaks encapsulation.

False

The back() member function removes the element at the back of the container and returns the value just removed.

False

The member functions of class A have access to the private data of an object of class B.

False

The most important problem with the procedural paradigm which OOP attempts to fix is: ____________________________.

It does a poor job of modeling things in the real world

When Prather gives us the online store question, will we put Chain of Responsibility? No! We're going to put ________________________.

None of the above

When Prather throws us a weird design pattern that we've never seen before, what answer will we put?

None of the above

When we only want one of an object to exist at a time (probably using the "static" keyword), what design pattern are we implementing?

Singleton

For "has a" relationships, what design pattern are we implementing?

Strategy

"This" is a pointer to the object on which the current function was called

True

A function is const when it does not change member data.

True

A program can continue to operate after an exception has occurred.

True

Class A declares that the "foo()" function in Class B is a friend. Code inside of "foo()" may now modify private member data in A.

True

Constructors can be overloaded.

True

Encapsulation hides the details of the implementation of an object.

True

Everything is private in a class by default.

True

Functions inside of a class that are available to outsiders are known as the public interface of a class.

True

Generic Programming is fully supported by C++.

True

In the computer's memory, there is a separate copy of the data members for each object that is created from a class, but there is only one copy of a class's member functions.

True

Inheritance is when a derived class uses base class functionality.

True

An exception is typically caused by __________________.

a runtime error

In C++, inheritance is often described in terms of: ______________________ and ______________________.

base classes and derived classes

A class can be considered a __________________, because it doesn't produce any objects on its own.

blueprint

Anything listed under the "protected" access specifier in a class ________________________________________.

can be used by derived classes, but not outside classes

In OOP we say that objects are members of _______________.

classes

Generic programming is a style of programming that maximizes reusability by specifying types at ___________________.

compile time

Static type binding is when the type is determined at ________________.

compile time

A ______________ is a member function of a class with the exact same name as the class.

constructor

In STL, containers contain ________

data

When a class gains some of its characteristics from another class, it is called a ___________________.

derived class

The unique() algorithm removes all ____________ element values from a container.

duplicate

When using inheritance, we say that if class B inherits from class A, class B has a "___________________" relationship with class A.

is a

If iter is a reverse iterator, what is the expression that should be done on the iter to move it to the next object?

iter++

A range is often supplied to an algorithm by two _____________________ values.

iterator

In order to avoid operating directly upon the containers, STL has solved this problem by providing _______________.

iterators

When using a reverse iterator, which function should you use to start from the end?

rbegin()

Often a programmer will take an existing class A and create another class B which inherits from A. This concept of inheritance provides an important extension to the idea of _________________.

reusability

Templates are an example of ____________ type binding.

static

The STL find() algorithm...

takes iterators as its first two arguments

C++ primarily implements generic programming through _______________. (think carefully about the most correct answer)

templates

Suppose that in class A there is one constructor defined that takes 1 argument. Suppose that class B inherits publicly from class A. Without modifying class A, when writing the constructor(s) for class B, you will need __________________________.

to call A's defined one-arg constructor in the initialization list

Generic programming allows the writer to create functionality in its most abstract sense, and then reuse the code for multiple types. This is generally called _____________ polymorphism.

type

A C++ type that is an example of a templatized class is the following:

vector

Dynamic type binding is when the type is determined at run time, such as through the use of ___________________________.

virtual functions


Related study sets

The General Agreement on Tariffs and Trade

View Set

Client rights, advocacy, informed consent, advance directives, confidentiality and information security, information technology, legal practice, disruptive behavior

View Set

Consumer Economics Chapter 11 Test Review

View Set

Combo with apush chapter 23-26 practice questions set #1 and 1 other

View Set

Understanding Agency Law - Chapter 9

View Set

Ch. 18 Obstructive Lung Disorders

View Set

Mental Health Psychopharmacology

View Set

Spanish Civil War Political Parties/Groups

View Set