Shared Flashcard Set

Details

Fundamentals of Computing Final
These are the kinds of questions you are likely to find on the final.
91
Computer Science
Undergraduate 1
05/10/2015

Additional Computer Science Flashcards

 


 

Cards

Term
When both a base class and a derived class have constructors, the base class’s constructor is called __________ (first/last).
Definition
first
Term
An overridden base class function may be called by a function in a derived class by using the __________ operator.
Definition
scope resolution
or
scope resolution operator
Term
A(n) __________ member function in a base class expects to be overridden in a derived class.
Definition
virtual
Term
__________ binding is when a function call is bound at runtime.
Definition
dynamic
Term
When a pointer to a base class is made to point to a derived class, the pointer ignores and __________ the derived class functions, unless the function is __________.
Definition
overrides
virtual
Term
A(n) __________ function has no body, or definition, in the class in which it is declared.
Definition
pure virtual
Term
__________ is where a derived class has two or more base classes.
Definition
multiple inheritance
Term
(T/F) The base class’s access specification affects the way base class member functions may access base class member variables.
Definition
False
Term
(T/F) Private members of a private base class become inaccessible to the derived class.
Definition
True
Term
(T/F) Protected members of a private base class become public members of the derived class.
Definition
False
Term
(T/F) Private members of a protected base class become inaccessible to the derived class.
Definition
True
Term
(T/F) The base class constructor is called after the derived class constructor.
Definition
False
Term
(T/F) It isn't possible for a base class to have more than one constructor.
Definition
False
Term
(T/F) A member function of a derived class may not have the same name as a member function of the base class.
Definition
False
Term
(T/F) A base class may not be derived from another class.
Definition
False
Term
If a member variable is declared __________, all objects of that class have access to the same variable.
Definition
Static
Term
A(n) __________ member function cannot access any nonstatic member variables in its own class.
Definition
static
Term
A(n) __________ function is not a member of a class, but has access to the private members of the class.
Definition
friend
Term
__________ is the default behavior when an object is assigned the value of another object of the same class.
Definition
memberwise assignment
Term
__________ is a special built-in pointer that is automatically passed as a hidden argument to all nonstatic member functions.
Definition
this pointer
or
this
Term
When overloading the __________ operator, its function must have a dummy parameter.
Definition
Any of the following answers are acceptable:
postfix --
postfix increment/decrement
postfix decrement
postfix ++
postfix ++/--
postfix increment
Term
Object aggregation is useful for creating a(n) __________ relationship between two classes.
Definition
Any of the following answers are acceptable:
whole-part
is-a
has-a
is a
has a
whole part
Term
(T/F) Static member variables cannot be accessed by nonstatic member functions.
Definition
False
Term
(T/F) A static member function may refer to nonstatic member variables of the same class, but only after an instance of the class has been defined.
Definition
True
Term
(T/F) A friend function has access to the private members of the class declaring it a friend.
Definition
True
Term
(T/F) In order for a function or class to become a friend of another class, it must be declared as such by the class granting it access.
Definition
True
Term
(T/F) You cannot use the = operator to assign one object’s values to another object, unless you overload the operator.
Definition
False
Term
(T/F) If a class has a copy constructor, and an object of that class is passed by value into a function, the function’s parameter will not call its copy constructor.
Definition
False
Term
(T/F) All functions that overload unary operators must have a dummy parameter.
Definition
False
Term
(T/F) It is possible to have an instance of one class as a member of another class.
Definition
True
Term
_________ programming is centered around functions or procedures.
Definition
Procedural
Term
_________ is an object’s ability to contain and manipulate its own data.
Definition
Encapsulation
Term
A class is very similar to a(n) _________.
Definition
structure
or
struct
Term
The default access specification of class members is _________.
Definition
private
Term
Defining a class object is often called the _________ of a class.
Definition
instance
or
instantiation
Term
If you were writing the declaration of a class named Canine, what would you name the file it was stored in? _________
Definition
canine.h
Term
When a member function’s body is written inside a class declaration, the function is _________.
Definition
inline
Term
A(n) _________ is a member function with the same name as the class.
Definition
constructor
Term
Constructors cannot have a(n) _________ type.
Definition
return
Term
A(n) _________ is a member function that is automatically called when an object is destroyed.
Definition
destructor
Term
Like constructors, destructors cannot have a(n) _________ type.
Definition
return
Term
A class may have more than one constructor, as long as each has a different _________.
Definition
Any of the following answers are acceptable:
signature
parameter
parameter list
Term
A(n) _________ may be used to pass arguments to the constructors of elements in an object array.
Definition
initialization list
Term
(T/F) Class members are private by default.
Definition
True
Term
(T/F) Classes and structures in C++ are very similar.
Definition
True
Term
(T/F) All public members of a class must be declared together.
Definition
False
Term
(T/F) You can use the new operator to dynamically allocate an instance of a class.
Definition
True
Term
Constructors do not have to have the same name as the class.
Definition
False
Term
(T/F) Constructors cannot take arguments.
Definition
False
Term
Destructors may return a value.
Definition
False
Term
Member functions may be overloaded.
Definition
True
Term
A class may not have a constructor with no parameter list, and a constructor whose arguments all have default values.
Definition
True
Term
A class’s responsibilities are the things the class is responsible for knowing, and actions the class must perform.
Definition
True
Term
When an array of objects is defined, the constructor is only called for the first element.
Definition
False
Term
The __________ file stream data type is for output files, input files, or files that perform both input and output.
Definition
fstream
Term
The same formatting techniques used with __________ may also be used when writing data to a file.
Definition
cout
Term
The __________ member function reads a single character from a file.
Definition
get
Term
__________ files contain data that is unformatted and not necessarily stored as ASCII text.
Definition
Binary
Term
The __________ member function writes “raw” binary data to a file.
Definition
write
Term
In __________ file access, the contents of a file may be read in any order.
Definition
random
Term
The __________ member function moves a file’s write position to a specified byte in the file.
Definition
seekp
Term
The __________ member function returns a file’s current write position.
Definition
tellp
Term
The __________ mode flag causes an offset to be calculated from the end of a file.
Definition
ios::end
Term
(T/F) fstream objects are only capable of performing file output operations.
Definition
False
Term
(T/F) ifstream objects, by default, create a file if it doesn’t exist when opened.
Definition
Flase
Term
(T/F) A file may be opened in the definition of the file stream object.
Definition
True
Term
(T/F) A file stream object’s fail member function may be used to determine if the file was successfully opened.
Definition
True
Term
(T/F) The >> operator expects data to be delimited by whitespace characters.
Definition
True
Term
(T/F) It is not possible to have more than one file open at once in a program.
Definition
False
Term
(T/F) Binary is the default mode in which files are opened.
Definition
False
Term
(T/F) It is possible to open a file for both input and output.
Definition
True
Term
What data type is used to create a file and then write info to that file, but not to read info from the file?
Definition
ofstream
Term
Given a file called info.txt and an a stream object dataFile, what is the statement that will open the file for both input and output?
Definition
dataFile.open("info.txt", ios::in | ios::out);
Term
To access files from a C++ program, you must include what directive?
Definition
#include <fstream>
Term
All stream objects have these and they indicate the condition of the stream.
Definition
error bits
Term
What is the term that means non-sequentially accessing information in a file?
Definition
random-access
Term
Of all the data types/structures that we have learned, a class is similar to which one?
Definition
struct
Term
Name the three class access specifiers.
Definition
public, private, and protected
Term
What do you call a constructor that accepts no arguments.
Definition
default constructor
Term
What do you use to access members of a class object (name, not symbol)?
Definition
dot operator
Term
When a member function is defined outside of the class declaration, the function must be qualified with what?
Definition
class name and scope resolution operator
Term
Each object of a class gets its own copy of what?
Definition
member variables
Term
What type of data member may be accessed before any objects of the class have been created?
Definition
static
Term
What do you have to use to dereference an object pointer?
Definition
->
Term
What does C++ require a copy constructor's parameter to be?
Definition
reference object
Term
Given two classes (bClass and dClass), if dClass is to inherit bClass, what is the class header to achieve this?
Definition
class dClass: public bClass
Term
What type of function is not a member of the class, but has access to the private members of the class?
Definition
friend
Term
What concept allows us to create a new class based on an existing class?
Definition
inheritance
Term
What type of members of a base class are never accessible to a derived class?
Definition
private
Term
When working with base and derived classes: the ______ constructor is called before the _____ constructor.
Definition
base, derived
Term
What is the special built in pointer that is available to a class's member functions?
Definition
this
Supporting users have an ad free experience!