Chapter 9 Questions (Comp Sci)
Unlike the built-in data types, a class does not define a valid set of data values.
false
The ____ function reads the next character in the input stream and assigns it to the function's character variable.
get()
Storage areas declared for a class are referred to as ____.
objects
Storage areas declared for a class are referred to as ___________________.
objects
A common error associated with defining and processing strings is forgetting to include the ____________________ header file when using string class objects.
string
The values the string class permits are referred to as ____.
string literals
The lowercase string character is converted to its uppercase equivalent by using the ____ function.
toupper()
An advantage of object-oriented program design is that you can use thoroughly tested classes without knowing how the class is constructed.
true
At a fundamental level, all input (as well as output) is done on a character-by-character basis.
true
One of the major uses of strings in programs is for user-input validation.
true
Returning an error condition from a function means that the condition must be the same data type as a valid returned value.
true
The expression getline(cin, message) accepts and stores characters typed at the terminal continuously until the Enter key is pressed.
true
The string class function int length() returns the length of the string.
true
User-input validation is an essential part of any commercially viable program.
true
Each character in a string is stored in binary using the ASCII or ____ code.
unicode
Designating a namespace in the ____ statement tells the compiler to include only the code in the specified namespace rather than all code in the file.
using
Strings cannot be input from the keyboard and displayed on the screen.
false
The ____ function enables you to retrieve separate characters in a string.
at()
Every key has a(n) ____________________ code, including Enter, the spacebar, Esc, and Ctrl.
binary
The int isupper(charExp) function returns a true (non-zero integer) if charExp evaluates to a(n) ____________________ letter.
capital
The function declaration (prototype) for each character class function is contained in the header file string or ____.
cctype
Strings can be manipulated by using string class functions or the ____ functions.
character-at-a-time
The ____ object reads a set of characters up to a blank space or a newline character.
cin
The ____ header file in C++ provides good date and time functions.
ctime
The expression getline(cin, message) will continuously accept and store characters typed at the terminal until the ____ key is pressed.
enter
The length of a string is always one more than the ____________________ number of the last character's position in the string.
index
In the earlier versions of C++, the process of creating a new object is referred to as ____ an object.
instantiating
In C++, a character is stored as a(n) ____ value.
integer
The ____ method returns the number of characters in the string.
length()
In class terminology, functions are formally referred to as ____________________.
methods
The first step in creating a library is to encapsulate all of the specialized functions and classes into one or more ____________________ and then store the complete code into one or more files.
namespaces
The cout.put(charExp) method places the value of charExp on the ____________________ stream.
output
The ____ function returns the next character on the stream but doesn't remove it from the stream's buffer.
peek()
The character output function corresponding to get() is ____________________().
put
Two string expressions can be compared for equality by using the standard ____________________ operators.
relational
By convention, the first character in a string is always designated as position __________________.
zero