Save
Busy. Please wait.
Log in with Clever
or

show password
Forgot Password?

Don't have an account?  Sign up 
Sign up using Clever
or

Username is available taken
show password


Make sure to remember your password. If you forget it there is no way for StudyStack to send you a reset link. You would need to create a new account.
Your email address is only used to allow you to reset your password. See our Privacy Policy and Terms of Service.


Already a StudyStack user? Log In

Reset Password
Enter the associated with your account, and we'll email you a link to reset your password.
focusNode
Didn't know it?
click below
 
Knew it?
click below
Don't Know
Remaining cards (0)
Know
0:00
Embed Code - If you would like this activity on your web page, copy the script below and paste it into your web page.

  Normal Size     Small Size show me how

Stack #1264017

QuestionAnswer
Traditional C++ approach to error handling uses a function to return a specific value to indicate specific operations to return a specific value to indicate specific operations
Latest C++ compilers have added a technique designed for error detection and handling referred to as exception handling
When an error occurs while a function is executing, an exception is created
An exception is a value, a variable, or an object containing information about the error at the point the error occurs
Process of generating an exception Throwing an exception
In general two fundamental types of errors can cause C++ exceptions Those resulting from inability to obtain a required resource, over which the programmer has no control Errors than can be checked and handled, over which the programmer has control
Whats an exception A value, object or variable that ids specific error that has occurred while program is running
what is Throw an exception Send the exception to a section of code that processes the detected error
What is Catch or Handle an exception Receive a thrown exception and process it
What is Catch Clause The section of code that process the error
What is Exception Handler The code that throws and catches an exception
Syntax to throw and catch and exception try{} catch (){}
_____ ___& ____ with exception handling is used extensively in C++ programs that use one or more files Error checking and processing
A rigorous check is usually required when opening output file If it exists, file will be found If it does not exist, file will be created
In some cases, ___ __ _ ____ __ ___ and, if file is found, a further check can be made to ensure that user explicitly approves overwriting it file can be opened for input
To open two files at the same time, assume you want to read data from a character-based file ____ ___ ___ ___ __ and write this data to a file one character at a time
The string class permits string literal values
Any sequence of characters enclosed in quotation marks is a String literal
By convention, first character in string is always designated as position zero position zero
This position value is also referred to as both the character’s index value and its offset value
string class provides a number of functions for declaring, creating, and initializing a string
In earlier versions of C++, process of creating a new object is referred to as instantiating an object
The methods that perform the tasks of creating and initializing are called constructor methods, or constructors, for short
General puprose screen output object is called cout
General purpose keyboard input object that stops reading string input when space is encountered cin
General purpose keyboard input function that inputs all characters entered, stores them in the string strObj, and stops accepting character when it receives a newline character (/n) getline(cin, strObj)
Seemingly strange results can happen when cin input stream and getline() function are used together to accept data, or when cin is used by itself to accept characters Phantom newline character
Don’t mix cin with ____ ____ in same program (preferred solution) getline() inputs
Follow cin input with a call to cin.ignore()
Accept Enter key in a character variable and then ignore it
Strings can be manipulated using the string class functions or the character-at-a-time functions
Two string expressions can be compared for equality using the standard relational operators
Function declaration (prototype) for each function is contained in the ___ ___ ___ ___ ___, which must be included in any program using these functions header file string or cctype
What character I/O places some character value on the output stream cout.put('A');
What character I/O extracts the next character value from the the input stream and assigns it to a variable cin.get(A);
What character I/O assigns the next character value from the the input stream and assigns it to a variable without extracting the character from the stream cin.peek(nextKey);
What character I/O pushes a character value back into the input stream cin.putback(cKey);
What character I/O ignores a maximum of the next n input character, up to and including the detection of said type. If no argument ignores the next input stream cin.ignore(n,char);
A common method for validating numerical input data is accepting all numbers as strings
This string validating function converts stringExp to an integer. Conversion stops at the first non-integer character. int atoi(stringExp)
This string validating function converts stringExp to a double precision number. Conversion stops at the first character that can't be interpreted as a double. double atof(stringExp)
This string validating function converts stringExp to a character array. The space allocated for the returned character must be large enough for the converted value. char[] itoa(integerExp)
First step in creating a library is to encapsulate all __ __ & __ into one or more namespaces and then store the complete code (with or without using a namespace) specialized functions and classes
Forgetting to include __ __ ___ when using string class object is a common programing error string header file
Forgetting the newline character, '/n' is a valid character
Forgetting to convert string class object by using ____ function when converting string class objects to numerical data types is a common programing error c_str()
Referred to as a string value, a string constant, and, more conventionally, a string is a String Literal
String be constructed as an object of the string class
string class is commonly used for constructing strings for input and output purposes
Strings can be manipulated by using functions of the class they’re objects of or by using the ___ ___&___ ___ purpose string and character functions
cin object tends to be of limited usefulness for string input because it terminates input when a blank is encountered
For string class data input, use the ___function getline()
cout object can be used to display string class strings
The address operator, &, accesses a variable’s address in memory
The address operator placed in front of a variable’s name refers to the address of the variable
Example statements store addresses of the variable m, list, and ch in the variables d, tabPoint, and chrPoint d = &m; tabPoint = &list; chrPoint = &ch;
To use a stored address, C++ provides the indirection operator, *
The * symbol, when followed by a pointer, means “the variable whose address is stored in” *numAddr means the variable whose address is stored in numAddr
When using a pointer variable, the value that is finally obtained is always found by first going to the pointer for an address
The address contained in the pointer is then used to get the variable’s contents
Since this is an indirect way of getting to the final value, the term ____ ___ is used to describe it indirect addressing
Like all variables, pointers must be ___ before they can be used to store an address declared
You musr ______ a pointer variable, C++ requires specifying the type of the variable that is pointed to Example: int *numAddr; declare
A ____ is a named constant for an address The address named as a constant cannot be changed reference
A pointer variable’s value address can be changed
using references rather than ___ as arguments to functions is preferred pointers
using ____ rather than pointers as arguments to functions is preferred Simpler notation for locating a reference parameter Eliminates address (&) and indirection operator (*) required for pointers reference
References are automatically dereferenced, also called ____ ______ implicitly dereferenced
_____ are used almost exclusively as formal parameters and return types References
After a variable has been declared, it can be given additional names by using a ___ ___ reference variable
There is a ____&____ relationship between array names and pointers There is a direct and simple relationship between array names and pointers
Reference _____ are available in C++ variables
The form of a reference variable is: dataType& newName = existingName; double& sum = total;
The * symbol is called the _____ operator dereferencing
As each variable is defined in a program, sufficient storage for it is assigned from a pool of computer memory locations made available to the compiler Dynamic Array Allocation
After memory locations have been reserved for a variable, these locations are __ __ __ ____, whether or not they are used fixed for the life of that variable
An alternative to fixed or static allocation is ___ _____ of memory dynamic allocation
Using dynamic allocation, the amount of storage to be allocated is determined or adjusted at run time
new and delete operators provide the dynamic allocation mechanisms in C++ dynamic allocation
Reserves the number of bytes requested by the declaration. Returns the address of the first reserved location or NULL if not enough memory is available new operator
Releases a block of bytes reserved previously, The address of the first reserved location must be passed as an argument to the operator. delete operator
Dynamic storage requests for ____ _____ or arrays are made as part of a declaration or an assignment statement scalar variables
pick the scaler a or b int *num = new int; int *grades = new int[200]; b // scalar // array
Pointer variables, like all variables, contain values
The value stored in a pointer is a memory address
By adding or subtracting numbers to pointers you can obtain different addresses
Pointer values can be compared using relational operators (==, <, >, etc.)
Allows accessing each array element as the address is “marched along” from starting address to address of last array element *ptNum++ & most common
Pointers can be initialized when they are int *ptNum = &miles; declared
Pointers to ___ can also be initialized when they are declared double *zing = &volts[0]; arrays
Reference pointers can be used to pass addresses through reference parameters (Implied use of an address)
Pointers can be used explicitly to pass addresses with references
Explicitly passing references with the address operator is called pass by reference
Called function can reference, or access, variables in the calling function by using the passed addresses
When an array is passed to a function, its ____ is the only item actually passed address
You can access multidimensional arrays by using pointer notation
Notation becomes more cryptic as array dimensions increase
Forgetting to use bracket set, [], after delete operator is a common programming error
Attempting to store address in a variable not declared as pointer is a common programming error
Using pointer to access nonexistent array elements is a common programming error
Incorrectly applying address and indirection operators is a common programming error
Taking addresses of pointer constants is a common programming error
Taking addresses of a reference argument, reference variable, or register variable is a common programming error
Becoming confused about whether a variable contains an address or is an address is a common programming error
Initialized pointer variables incorrectly is a common programming error
Although a pointer constant is synonymous with an address, it’s useful to treat pointer constants as pointer variables with two restrictions: Address of a pointer constant can’t be taken Address “contained in” the pointer can’t be alteredExcept for these restrictions pointer constants and pointer variables can be used almost interchangeably
Except for these restrictions pointer constants and pointer variables can be used almost interchangeably
When an address is required, any of the following can be used: A pointer variable name A pointer argument name A pointer constant name A non-pointer variable name preceded by the address operator A non-pointer variable argument name preceded by the address operator
A pointer is a variable used to store the address of another variable Must be declared Use indirection operator, *, to declare the pointer variable and access the variable whose address is stored in pointer
Array name is a pointer constant
Arrays can be created ____ as program is executing dynamically
Arrays are passed to functions as addresses
When a one-dimensional array is passed to a function, the function’s parameter declaration can be an array declaration or a pointer declaration
Pointers can be incremented, decremented, ___,__ compared, and assigned
A _____ program consists of one or more algorithms that have been written in computer-readable language procedural
Input and display of program output take a back seat to _____ Clear emphasis on formulas and calculations processing
An ____ approach fits graphically windowed environments object-oriented
Central to creation of objects; a user defined rather than built-in data type Abstract data types
Combination of data and associated operations Data type
A data type defines both the types of data and the ____ ___ __ that can be performed on the data types of operations
Operations in C++ are an _____ part of each data type inherent
User defined type that specifies both a type of data and the operations that can be performed on it User defined types are required when you want to create objects that are more complex than simple integers and characters Abstract data type (ADT)
___ ___ ____ are required when you want to create objects that are more complex than simple integers and characters User defined types
How data is stored Data structure:
C++ name for an abstract data type Class
A class is usually constructed in two parts: Declaration section Implementation section
Declaration section Declares both the data types and functions for the class
Implementation section Defines the functions whose prototypes have been declared in the declaration section
Both the variables and the functions listed in the declaration section Class members
Variables listed in the declaration section Data members or instance variables
Functions listed in the declaration section Member functions
When a function is part of a class it is referred to as ___ ____ ______ ____ method to denote class membership
Restricting user from access to data storage implementation details is called data hiding
____ functions can be called from outside the class public
In general, all class functions should be ____ so that they provide capabilities to manipulate class variables from outside the class public
The function with same name as class is the class’s constructor function Used to initialize class data members with values
____ section: member functions declared in the declaration section are written Implementation
___ ___ for functions written in the implementation section is the same as all C++ functions with the addition of the class name and the scope resolution operator :: General form
Variables of a user-declared class must: Be defined before use in a program Are referred to as objects
An object name’s attribute is referenced with the ___ ____ objectName.attributeName objectName is the name of a specific object attributeName is the name of a data member defined for the object’s class dot operator
Programmer defined data type from which objects can be created Class
Created from classes are objects this are referred to as ____ of a class instances
A function used to initialize an object’s data members when the object is created Constructor
A function that reports information about an object’s state Accessor
A function that modifies the values stored in an object’s data members Mutator
A ____ is any function with the same name as its class constructor function
Multiple constructors can be defined for each class as long as they can be distinguished by ____ ___ ____ number and types of their parameters
A constructor’s intended purpose is to initialize a new object’s data members
If no constructor function is written, the compiler supplies a default constructor
In addition to ______, a constructor can perform other tasks when it is called initialization
General format of a constructor includes: The same name as the class to which it belongs No ______ return type (not even void)
Constructors are called when an object is created
An ___ should never be declared with empty parentheses object
Called automatically when an object goes out of existence Clean up any undesirable effects the object might leave, such as releasing memory stored in a pointer Destructor
An ___ provides a means for reporting on an object’s state accessor function
accessor function Conventionally called ___ functions get()
Each class should provide a complete set of accessor functions
A _____ ___ provides a means for changing an object’s data member mutator function
Conventionally called set() functions for mutator
Memory locations are allocated to an object only when the object is _____ declared
In contrast, only one copy of a member function is created, which comes into existence when the function is defined defined
Each member function actually receives an extra argument that’s the address of an object
True initialization has no reliance on ____ assignment
C++ makes initialization possible with ____ initialization list syntax base/member
Initialization list syntax is only available in _____ functions constructor
Most classes typically require additional functions
data types, such as +, −, ==, >=, and so on to construct class functions These are referred to as operator functions
New operator symbols cannot be created Neither the ____ ____ of the C++ operators can be modified precedence nor the associativity
The assignment operator, ___, is the one operator that works with all classes without requiring an operator function =
if a and b are objects constructed from the Complex class, the statement a = b; sets the values in a’s data members to their equivalent values in b’s data members This type of assignment is referred to as _____ _____ memberwise assignment
___ variables can be accessed and manipulated through a class’s member functions Private
The first step in constructing an object-based program is developing an ___ of the program object-based model
is a widely accepted technique for developing object oriented programs Unified Modeling Language (UML)
are used to describe classes and their relationships Class diagrams
are used to describe objects and their relationships Object diagrams
are represented with a diagram consisting of a box Both classes and objects
In___, the class name is in bold text and centered at the top of the box class diagrams
____ defines where an attribute can be seen Visibility
Can be used on in its defining class Cannot be accessed by other classes directly Indicated by a minus (-) sign in front of attribute name Private
Used in any other class Indicated by a plus (+) sign in front of attribute name Public
Available to derived classes Neither plus nor minus sign in front of attribute name Protected
____ are transformations that can be applied to attributes and are coded as C++ functions Operations
Operation names are listed below attributes and separated from them by a line
Failing to terminate class declaration section with a semicolon Common Programming Errors
Including the return type with the constructor’s prototype or failing to include the return type with other the functions’ prototypes Common Programming Errors
Using same name for a data member as for a member function Common Programming Errors
Defining more than one default constructor Common Programming Errors
Forgetting to include the class name and scope operator, ::, in the function header Common Programming Errors
Declaring an object with empty parentheses, as in Complex a(); The correct declaration is Complex a; Common Programming Errors
Not defining an operator function’s parameter as a reference to an object Common Programming Errors
Redefining an overloaded operator to perform a function not indicated by its conventional meaning Common Programming Errors
Is a programmer-defined data type Consists of a declaration and implementation section A class
___ can be written inline or included in the class implementation section Class functions
A ___ ___ is a special function that is called automatically each time an object is declared If no constructor is declared, the compiler supplies a default constructor function
Constructors can be overloaded true
A ___ is called each time an object goes out of scope destructor function
User-defined operators can be constructed for classes by using ____ operator functions
A ___ ____ can access a class’s private data members if it is granted friend status by the class nonmember function
User-defined casts for converting a built-in type to a class type are created by using constructor functions
A constructor whose first argument is not a member of its class and whose remaining arguments, if any, have default values Type conversion constructor
If the first argument is a built-in type, then constructor can be used to cast the built-in to the class type Type conversion constructor
Implicit conversion occurs in C++’s operations
Explicit conversion occurs when a cast is used
Converts from user-defined data type to built-in data type The conversion operator function
Is a member function having the same name as the built-in data type or class The conversion operator function
When name is the same as built-in type, used to convert from class to built-in data type Conversion operator for class to long conversion would be named operator long() The conversion operator function
Has no explicit argument or return type The conversion operator function
Providing Access to a class is achieved by declaring the overloaded function as a ____ friend
Requires _____ ____ of class when class not otherwise already known forward declaration
The scope of an identifier defines the portion of a program where the identifier is valid
There are two categories of scope: local and global
Each identifier also has a duration: the length of time storage locations are _____ for the variable or function that the identifier names reserved
Class data members are ___ to objects created from the class local
An object’s data member takes precedence over a ___ _____ of the same name global variable
Class member functions are ____ in the file where they’re defined but can be called only for objects created from the class global
As each ___ ___ is created, it gets its own block of memory for its data members class object
In some cases, it is convenient for every ______ to share the same memory location for a specific variable instantiation of a class
___ _____ ____ can access only static data members and other static member functions Static member functions
static member functions primary purpose is to perform any specialized initialization or operation procedures on ___ _____ ____ before any object creations static member variables
Ability to create new classes from existing ones is the underlying motivation and power behind class- and object-oriented programming techniques
Deriving one class from another class Inheritance
Redefining how member functions of related classes operate based on the class object being referenced Polymorphism
Initial class used as a basis for a derived class Also called parent or superclass Base class also called parent or superclass
New class incorporating all the data members and member functions of its base class is called ____ Also called child class or subclass Can, and usually does, add its own data members and member functions Can override any base class function Derived class
Derived type has only one base type Simple inheritance
Derived type has two or more base types Multiple inheritance
Illustrate the hierarchy or order in which one class is derived from another Class hierarchies
___ ___ has same form as any other class except: Includes access specifier and base class name Derived class
Class derivations are formally called class hierarchies
ensures that data members can only be accessed by class member functions or friends No access to nonclass functions except friends Private status
same as private status except derived classes can access the base class data member Protected status
___ permits using the same function name to invoke: One response in a base class’s objects Another response in a derived class’s objects Polymorphism
Two types of function binding Static binding: Determination of function to call is made at ___ ____ Dynamic binding: Determination of function to call is made at runtime based on object type making call Depends on virtual functions compile time
Compiler creates a pointer to a function; assigns value to pointer upon function call Virtual function
Using a const reference parameter in both the function prototype and header when overloading the extraction operator, >> Common Programming Errors
The static keyword should be used only when a data member is being declared in the class’s declaration section Common Programming Errors
Failing to instantiate static data members in a class’s implementation section Common Programming Errors
Attempting to make a conversion operator function a friend rather than a member function Common Programming Errors
Attempting to specify a return type for a conversion operator function Common Programming Errors
Attempting to override a virtual function without using the same type and number of arguments as the original function Common Programming Errors
Using the virtual keyword in the class’s implementation section Common Programming Errors
Functions are declared as virtual only in the class’s declaration section Common Programming Errors
The ___ class’s insertion operator, <<, can be overloaded to display objects. ostream
The ____ class’s extraction operator, >>, can be overloaded to input values in an object’s data members. istream
Four categories of data type conversions Built-in types to built-in types Class types to built-in types Built-in types to class types Class types to class types
Type conversion constructor: First argument is not a member of its class; any remaining arguments have ____ ___ default values
Member function having the name of a class No explicit arguments or return type Conversion operator function
______ are local to the objects in which they’re created Data members
If a global variable name is used in a class, the global variable is hidden by the object’s data member of the same name, if one exists In this case, the global variable can be accessed by using the scope resolution operator, ::
Override functions and virtual functions can be used to implement polymorphism
In static binding, the determination of which function is called is made at compile time; in dynamic binding, the determination is made at ___ runtime
After a function is declared virtual it r remains virtual for all derived classes
Base class functions can be _____ by derived class functions with same name overridden
Capability of having the same function name invoke different responses based on the object making the call Polymorphism
A(n) ____ is a word the language sets aside for a special purpose and can be used only in a specified manner. keyword
Data transmitted to a function at runtime is referred to as the ____ of the function. arguments
The ____ is an output object that sends data it receives to the standard display device cout
Preprocessor commands begin with a(n) ____ sign #
____ in C++ are any combination of letters, numbers, and special characters enclosed in quotation marks. Strings
The newline escape sequence is ____. \n
The three most important and common integer types used in most applications are int, char, and ____. bool
A(n) ____ number, more commonly known as a real number, can be the number zero or any positive or negative number that contains a decimal point. floating-point
A(n) ____ is an item used to manipulate how the output stream of characters is displayed. manipulator
When a declaration statement is used to store a value into a variable, the variable is said to be ____. initialized
To determine the address of a variable, we can use C++’s address operator, ____, which means “the address of. &
A(n) ____ statement is the most basic C++ statement for assigning values to variables and performing computations. assignment
A(n) ____ is any combination of constants, variables, and function calls that can be evaluated to yield a result. expression
Because of ____, the value assigned to the variable on the left side of the assignment operator is forced into the data type of the variable to which it’s assigned. coercion
A(n) ____ can have a value assigned to it. lvalue
In C++, the expression sum = sum + 10 can be written as ____. sum += 10
The stream manipulator ____ sets the floating-point precision to n places. setprecision(n)
The stream manipulator ____ displays Boolean values as true and false rather than 1 and 0. boolalpha
When a manipulator requiring an argument is used, the ____ header file must be included as part of the program. iomanip
The ostream class method precision(n) is equivalent to the stream manipulator ____. setprecision()
In C++, the mathematical function ____ calculates a number’s square root. sqrt()
The ____ statement is used to enter data in a program while it’s running. cin
Identifiers created with const are commonly referred to as symbolic constants or ____ constants. named
A(n) ____ expression consists of operators and constants only. constant
The most commonly used ____ are simple relational expressions. conditions
In a relational expression, the value of the expression can be only the integer value 1 or ____. 0
In C++, when comparing character data, the char values are coerced to ____ values automatically for the comparison. int
In C++, the logical ____ operator is used to change an expression to its opposite state. NOT
Using the abs() function requires including the ____ header file. cmath
A useful modification of the if-else statement involves omitting the ____ part of the statement. else
A(n) ____ is any combination of operands and operators that yields a result. expression
In C++, Boolean variables are declared with the ____keyword. bool
Including one or more if statements inside an existing if statement is called a ____ if statement. nested
A(n) ____ chain is used in programming applications where one set of instructions must be selected from many possible alternatives. if-else
The expression in the switch statement must evaluate to a(n) ____ result or a compilation error results. integer
The ____ statement identifies the end of a particular case and causes an immediate exit from the switch statement. break
When writing a switch statement, you can use multiple ____ values to refer to the same set of statements. case
Checking user input data for erroneous or unreasonable data is referred to as ____. input data validation
Three different forms of repetition statements are provided in C++: while, ____, and do while. for
____ loops always execute the loop statements at least once before the condition is tested. Posttest
In a ____ loop, the condition is used to keep track of how many repetitions have occurred. fixed-count
In C++, a ____ loop is constructed using a while statement. while
A(n) ____ loop is a loop that never ends. infinite
The line total = total + num is an example of a(n) ____ statement. accumulating
When ____ is encountered in a loop, the next iteration of the loop begins immediately. continue
In C++, a ____ loop is constructed using a for statement. for
Inside the parentheses of the for statement are three items, separated by ____. semicolons
A loop contained within another loop is called a ____ loop. nested
Posttest loops can be constructed in C++ using ____ loops. do while
The ____ error means the loop executes either one too many or one too few times than was intended. off by one
The declaration statement for a function is referred to as a function ____. prototype
The names in parentheses in the header are called the formal ____ of the function. parameters
C++ provides the capability of using the same function name for more than one function, referred to as function ____. overloading
A function returning a value must specify, in its ____, the data type of the value to be returned. header
Telling the C++ compiler that a function is ____ causes a copy of the function code to be placed in the program at the point the function is called. inline
The default method to pass arguments to C++ functions is by ____. value
Because the variables created in a function are conventionally available only to the function, they are said to be ____ variables. local
The symbol ____ represents the C++’s scope resolution operator. ::
A local variable that is declared as ____ causes the program to keep the variable and its latest value even when the function that declared it is through executing. static
A(n) ____ declaration statement simply informs the computer that a global variable already exists and can now be used. extern
A(n) ____ is a list of related values, all having the same data type, and stored with a single variable name. one-dimensional array
The element’s index or ____ value gives the element’s position in the array. subscript
A(n) ____ check on an array is a check of the value of the index being used. bounds??
A string is any sequence of characters enclosed in ____. double quotation marks
____ loops are especially useful when dealing with two-dimensional arrays because they allow the programmer to designate and cycle through each element easily. Nested
C++ compilers require a program file with the extension ____. .cpp
A file stream that sends or writes data to a file is an ____. output file stream
Input file stream objects are declared to be of type ____. ifstream
The ____ method breaks the connection between the file’s external name and the file stream object. close()
Output file streams can be formatted in the same manner as the ____ standard output stream. cout
The fstream class’s ____ function permits character-by-character output to a stream. put()
The fstream class’s ____ function is used for character-by-character input from an input stream. get()
The standard error stream is represented by ____ in C and C++. cerr
In ____, any character in the opened file can be read without having to sequentially read all characters stored ahead of it first. random access
The ____ method establishes a connection between a file stream and an external file. open()
The expression getline(cin, message) will continuously accept and store characters typed at the terminal until the ____ key is pressed. Enter
The ____ object reads a set of characters up to a blank space or a newline character. cin
Passing a 2 dimensional array to a function _____________. is legal if the array is passed by reference
A _____________ parameter receives a copy of its corresponding actual parameter integer
Which of the following is false? A. Because a struct has a finite number of components, relational operators are allowed on a struct. false
A function that calls another function and eventually results in the original function call is said to be ________ recursive. indirectly
_________ recursion is defined as occuring when the recursive call is at the end of the recursive instruction tail
Variables created inside a function are ____ variables local
A local variable that is declared as ____ causes the program to keep the variable and its latest value even when the function that declared it is through executing. static
A variable that keeps its value around leaving a function is called a(n) ____ variable. static
A(n) ____, is used to store and process a set of values, all of the same data type, that forms a logical group array
Each item in an array is called a(n) ____ of the array. element
When the scope resolution operator is used before a variable name, the compiler is instructed to use a(n) ____ variable. global
Smaller programs containing a few functions should ____ contain global variables. almost never
The time dimension of a variable’s scope is referred to as the variable’s ____. lifetime
A local variable that is declared as ____ causes the program to keep the variable and its latest value, even when the function that declared it is finished executing. static
Once a global variable is created, it exists until ____. control is returned to the called function
The misuse of globals does not apply to ____, which typically are global. arguments
If a(n) ____ technique is not used, rand() will always produce the same series of random numbers. seeding
The ____ class provides a set of methods that include easy insertion and removal of characters from a string. string
Pressing the Enter key at the terminal generates a newline character, ‘\n’, which is interpreted by getline() as ____. the end-of-line entry
If the optional third argument is omitted when getline() is called, the default terminating character is the newline (‘\n’) character
A variable with a ____ is simply one that has had storage locations set aside for it by a declaration statement made within a function body. local scope
The misuse of globals does not apply to ____, which typically are global. function prototypes
Any expression that evaluates to a(n) ____ may be used as a subscript. integer
When passing an array to a called function, the function receives ____ array. access to the actual
The initialization of a two-dimensional array is done in ____ order. row
A linear search is also known as a(n) ____ search. sequential
n a bubble sort, on each pass through the list, the largest element ____. sinks to the bottom of the list
Every variable has three major items associated with it: the value stored in the variable, the number of bytes reserved for the variable, and the bytes’ ____. address
The address of a variable is the memory location of the ____ byte reserved for the variable. first
C++ requires that when we declare a pointer variable, we also specify the ____ of the variable that is pointed to. data type
For dynamic allocation of memory to create new variables as a program is running, pointers are ____. required
The 1 in the expression *(gPtr + 1) is a(n) ____. offset
Adding 1 to a pointer causes the pointer to point to the ____. next element of the type pointed to
To store and retrieve data outside a C++ program, two things are needed: a file and a(n) ____. file stream object
The advantage of binary-based files is ____. compactness speed of access
A stream is a one-way transmission of ____ between a source and a destination. bytes
The classes ifstream and ofstream are made available to a program by inclusion of the ____ header file. fstream
The standard input file is usually a ____. keyboard
Once a namespace has been created and stored in a file, it can be included within another file by supplying a(n) ____ informing the compiler where the desired namespace preprocessor directive
he first step in creating a library is to encapsulate all of the desired functions and classes into one or more ____ and then store the complete code in one or more files. namespaces
The atoi() C-string conversion function converts ____. a string to an integer
The first step in the input data validation process for numerical data is to ensure that the data is ____. of the correct type
in exception handling, multiple catch blocks can be provided as long as each catch block catches a unique data type
a try block must be followed by one or more ____ blocks catch
of the statements within a try block should be capable of throwing an exception. At least one
The process of generating and passing an exception at the point the error was detected is referred to as ____. throwing an exception
All of C++’s higher-level I/O methods and streams are based on ____ methods. lower-level character
All input and output is done on a ____ basis. character-by-character
____ return a nonzero integer when the character meets the desired condition, and a zero when the condition is not met. istype() functions
The value returned by the method call “Hello World!”.length() is ____. 12
The most commonly used string class method is ____. length()
If the optional third argument is omitted when getline() is called, the default terminating character is the newline (‘\n’) character
Pressing the Enter key at the terminal generates a newline character, ‘\n’, which is interpreted by getline() as ____. the end-of-line entry
string objectName = value is an example of a(n) ____. constructor method
The ____ class provides a set of methods that include easy insertion and removal of characters from a string. string
____ diagrams are used to describe classes and their relationships. class
Formally, the process of designing an application is referred to as ____ modeling. program
A common programming error is attempting to use memberwise assignment between objects that contain ____. pointer members
A good way to avoid pointer related problems associated with class default assignment operators is to ____. explicitly write an assignment operator
Pointer related problems associated with a class default assignment operator also exist with the ____. default copy constructor
For object-oriented programs, ____ allocation allows creating and destroying new objects as required. dynamic
With ____ allocation, the amount of storage to be allocated is assigned, as requested, at runtime instead of being fixed at compile time. dynamic
Creating a virtual function is easy—simply place the keyword ____ before the function’s return type in the class declaration section. virtual
A virtual function specification tells the compiler to create a pointer to a function but not to fill in the value of the pointer until ____. the function is actually called
Dynamic binding is achieved in C++ with ____ functions. virtual
In static binding, the determination of which function is called is made ____ at compile time
Overriding a base member function by using an overloaded derived member function is an example of ____. polymorphism
If the base class has a public access and the derived class access specifier is public, the derived class member is public
If the base class member has a protected access and the derived class access specifier is public, the derived protected
The class-access specifier is listed ____ of its declaration section. after the colon at the start
multiple inheritance, a derived type has ____ or more base types. 2
derived class ____ add its own new data and function members to those of its parent class can and usually does
A derived class is a completely new class that incorporates ____ of the data and member functions of its base all
Constructing one class from another is accomplished by using a capability called ____. inheritance
An advantage of the ____ object approach is that it encourages extending existing code without needing to completely rewrite it. inside-outside
____ generally means separating the implementation details of the abstract attributes and behavior and hiding them from the object’s outside users Encapsulation
____ means concentrating on what an object is and does before making any decisions about how to implement the object. Abstraction
In programming terms, an object’s attributes are described by ____. data
Converting from a class data type to a class data type is done by using a(n) ____. conversion operator function
A(n) ____ constructor is any constructor whose first argument is not a member of its class and whose remaining arguments, if any, have default values. type conversion
conversion from a built-in data type to a class is made by using ____. constructor methods
built-in to built-in conversion is handled by C++’s implicit conversion rules or its explicit ____ operator. cast
Conversion from a user-defined data type to a built-in data type is accomplished using a(n) ____. conversion operator function
The general expression (*pointer).member can always be replaced with the notation ____. pointer->member
When a method is called, the calling object’s address is passed to it and stored in the method’s ____ pointer. this
Note that each set of data members has its own starting address in memory, which corresponds to the address of the object’s ____. first data member
a class member function unary operator is rewritten as a friend function it will have ____ argument(s). one explicit
true initialization has no reliance on assignment and is possible in C++ by using a(n) ____ initialization list. base/member
Copy constructors, like all operator functions, are declared in the class ____ section. declaration
he compiler’s default ____ constructor performs similarly to the default assignment operator by doing a memberwise assignment between objects. copy
An operator to be defined for class use must either be a member of a class or be defined to ____. take at least one class member as an operand
The ____ operator is the one operator that works with all classes without requiring an operator function. assignment
Operators ____ be redefined for C++’s built-in types. cannot
A suitable name for an operator function that adds two quantities would be ____. operator+
Assuming a and b are objects with an overloaded == operator, rather than using the expression a == b we could have used the call ____. a.operator == (b)
If a and b are objects of type Date, the expression if (a == b) ____. is valid
In defining a member function, passing a reference is preferable to passing an object, because it reduces the function call’s ____. overhead
Operations on class objects that use C++’s built-in operator symbols are referred to as ____ functions. operator
The ____ operator can be redefined for class use. +
A(n) ____ diagram identifies the required object and lists its relevant attributes and behaviors. object description
Regarding an object, ____ define the properties of interest. attributes
From a coding standpoint, the friends list is simply a series of method prototype declarations preceded with the keyword ____ and included in the class declaration section friend
The term information hiding refers to the ____ and hiding of all implementation details. encapsulation
Functions that change an object’s data values are commonly referred to as ____. mutator functions
A mutator method ____ an object’s data values. changes
C++ constructors may be ____. overloaded
Date c = Date(4,1,2009) is a valid ____ language declaration for an object of a class named Date. C
When a constructor function is used in a declaration, parentheses should ____ be included for a zero parameter constructor. never
class ____ consists of the operations permitted to be performed on an object’s data members. behavior
Objects have the same relationship to classes as ____ do to C++ built-in data types. variables
A(n) ____ consists of a class’s public member method declarations and any supporting comments. interface
If a class designates all of its data members as private and all of its member functions as public, we must rely on ____ to access data members. member functions
When a new object is defined, memory is allocated for the object, and its data members are initialized automatically by a call to the class ____ method. constructor
The ____ operator is used to show a function’s membership in a class. scope resolution
The class ____ section is where the member methods declared in the declaration section are written to permit the initialization, assignment, and display capabilities implied by their names. implementation
Data members of a class are also known as ____ instance variables
Languages that use classes but do not provide inheritance and polymorphic features are referred to as ____ languages. object-based
A pointer ____ included as a parameter in a function header. can be
When an array is passed to a function, its ____ is the only item actually passed. address
Explicitly passing addresses to a function using the address operator effectively is a(n) ____. pass by reference
Adding 1 to a pointer causes the pointer to point to the ____. next element of the type pointed to
The manipulation of addresses using pointers ____ knowledge of the actual addresses. generally does not require
The only address required by the delete operator is the ____ address of the block of storage that was dynamically allocated. starting
Dynamic storage requests for scalar variables or arrays are made ____. as part of a declaration or assignment statement
Under a dynamic allocation scheme, the amount of storage to be allocated is determined and adjusted ____. runtime
If grade is an array, trying to store its address using the expression &grade results in a ____. compiler error
The purpose of an array name is to ____ the beginning of the array correctly. locate
For each array created, the name of the array becomes the name of the pointer constant created by the compiler for the array, and the ____ of the first location reserved for the array is stored in this pointer. starting address
When an offset is added to a pointer, the address in the pointer is ____. not changed
A pointer constant is ____ a pointer variable created by a programmer very similar to
Any subscript used by a programmer is automatically converted to a(n) ____ by the compiler. equivalent pointer expression
If grade is a single-dimension array containing five integers, and there are four bytes per integer, &grade[3] is computed as ____. &grade[0] + (3 * 4)
Using a reference to access the value of a variable operator symbol(*) is referred to as a(n) ____ automatic dereference
A reference is a pointer with ____ capabilities. restricted
For dynamic allocation of memory to create new variables as a program is running, pointers are ____. required
C++ requires that when we declare a pointer variable, we also specify the ____ of the variable that is pointed data type
Using a pointer to find the value of a variable is called ____. indirect addressing
Pointers are simply ____ that are used to store the addresses of other variables variables
The number of bytes required for an integer pointer is ____. compiler-dependent
For ____ data, the selection sort generally performs as well as or better than the bubble sort. random
A linear search is also known as a(n) ____ search. sequential
When passing an array to a called function, the function receives ____ array. access to the actual
A C-string is terminated with __ the null character
Consider the declarations const int ARRAYSIZE = 7; and double length[ARRAYSIZE] = 11.2};. How many elements will be initialized to zero? three
One-dimensional arrays are examples of a(n) ____ type. structured
Using ____ helps to eliminate the problem of using out of bounds indices. symbolic constants
The statement cin >>grade[4]>>prices[6]; causes ___values to be read and stored. 2
Any expression that evaluates to a(n) ____ may be used as a subscript. integer
Referencing the first element of an array with an index of zero increases the ____ of the computer when it accesses array elements. speed
If an array is declared with the statements const int AA = 3;anddouble arrayA[AA];theindex of the last element in the array is ____. 2
The statements const int NUMELS = 4; and char code[NUMELS]; create an array with storage reserved for ____. four characters
A one-dimensional array is a list of related values with the same ____ that is stored using a single group name. data type
Created by: homeworkhelp2u
 

 



Voices

Use these flashcards to help memorize information. Look at the large card and try to recall what is on the other side. Then click the card to flip it. If you knew the answer, click the green Know box. Otherwise, click the red Don't know box.

When you've placed seven or more cards in the Don't know box, click "retry" to try those cards again.

If you've accidentally put the card in the wrong box, just click on the card to take it out of the box.

You can also use your keyboard to move the cards as follows:

If you are logged in to your account, this website will remember which cards you know and don't know so that they are in the same box the next time you log in.

When you need a break, try one of the other activities listed below the flashcards like Matching, Snowman, or Hungry Bug. Although it may feel like you're playing a game, your brain is still making more connections with the information to help you out.

To see how well you know the information, try the Quiz or Test activity.

Pass complete!
"Know" box contains:
Time elapsed:
Retries:
restart all cards