Deck 9: Completing the Basics
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/50
Play
Full screen (f)
Deck 9: Completing the Basics
1
Unlike the built-in data types, a class does not define a valid set of data values.
False
2
In exception handling, a(n) ____ is the section of code that processes the error.
A) exception handler
B) exception
C) catch clause
D) thrown exception
A) exception handler
B) exception
C) catch clause
D) thrown exception
C
3
In exception handling, an exception is thrown from within the function after its execution.
False
4
Inside the parentheses of a catch block are the ____ of the exception that s thrown and a parameter name used to receive the exception.
A) return value
B) try type
C) data type
D) catch type
A) return value
B) try type
C) data type
D) catch type
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
5
User-input validation is an essential part of any commercially viable program.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
6
Whenever a string literal is thrown, it s a(n) ____, not a string class object, that is thrown.
A) C-string
B) array of integers
C) numeric value
D) character
A) C-string
B) array of integers
C) numeric value
D) character
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
7
When a string literal is thrown, the catch statement must declare the received argument as a ____.
A) C-string
B) Z-string
C) C-variable
D) string variable
A) C-string
B) Z-string
C) C-variable
D) string variable
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
8
At a fundamental level, all input (as well as output) is done on a character-by-character basis.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
9
In general, ____ fundamental types of errors can cause C++ exceptions.
A) two
B) three
C) four
D) five
A) two
B) three
C) four
D) five
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
10
One of the major uses of strings in programs is for user-input validation.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
11
The string class function int length() returns the length of the string.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
12
Returning an error condition from a function means that the condition must be the same data type as a valid returned value.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
13
The process of generating and passing an exception is referred to as ____.
A) throwing an exception
B) throwing an error
C) returning an error
D) returning an exception
A) throwing an exception
B) throwing an error
C) returning an error
D) returning an exception
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
14
Strings cannot be input from the keyboard and displayed on the screen.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
15
Storage areas declared for a class are referred to as ____.
A) object types
B) constants
C) objects
D) variables
A) object types
B) constants
C) objects
D) variables
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
16
____ blocks serve as exception handlers for any exceptions thrown by the statements in the try block.
A) Throw
B) Catch
C) If
D) Error
A) Throw
B) Catch
C) If
D) Error
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
17
The expression getline(cin, message) accepts and stores characters typed at the terminal continuously until the Enter key is pressed.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
18
In exception handling, when an error occurs while a function is executing, a(n) ____ is created.
A) error
B) bifurcation
C) handler
D) exception
A) error
B) bifurcation
C) handler
D) exception
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
19
C++ compilers have added a technique designed for error detection and handling referred to as ____.
A) error handling
B) exception handling
C) function handling
D) error code handling
A) error handling
B) exception handling
C) function handling
D) error code handling
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
20
An advantage of object-oriented program design is that you can use thoroughly tested classes without knowing how the class is constructed.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
21
In C++, a character is stored as a(n) ____ value.
A) integer
B) char
C) boolean
D) floating point
A) integer
B) char
C) boolean
D) floating point
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
22
Storage areas declared for a class are referred to as ___________________.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
23
In the earlier versions of C++, the process of creating a new object is referred to as ____ an object.
A) defining
B) declaring
C) instantiating
D) allocating
A) defining
B) declaring
C) instantiating
D) allocating
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
24
The values the string class permits are referred to as ____.
A) string objects
B) string literals
C) C-strings
D) istream strings
A) string objects
B) string literals
C) C-strings
D) istream strings
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
25
Strings can be manipulated by using string class functions or the ____ functions.
A) character-at-a-time
B) C-string
C) c_str
D) cin
A) character-at-a-time
B) C-string
C) c_str
D) cin
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
26
The lowercase string character is converted to its uppercase equivalent by using the ____ function.
A) upper()
B) isupper()
C) changeupper()
D) toupper()
A) upper()
B) isupper()
C) changeupper()
D) toupper()
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
27
The ____ function reads the next character in the input stream and assigns it to the function s character variable.
A) getline()
B) get()
C) nextChar()
D) getChar()
A) getline()
B) get()
C) nextChar()
D) getChar()
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
28
Each character in a string is stored in binary using the ASCII or ____ code.
A) EBCDIC
B) Unicode
C) Char-set
D) C-char
A) EBCDIC
B) Unicode
C) Char-set
D) C-char
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
29
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.
A) #include
B) using
C) #namespace
D) get()
A) #include
B) using
C) #namespace
D) get()
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
30
The ____ function enables you to retrieve separate characters in a string.
A) at()
B) char_at()
C) indexof()
D) value_of()
A) at()
B) char_at()
C) indexof()
D) value_of()
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
31
The ____ function returns the next character on the stream but doesn t remove it from the stream s buffer.
A) put()
B) check()
C) peek()
D) get()
A) put()
B) check()
C) peek()
D) get()
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
32
The ____ header file in C++ provides good date and time functions.
A) ctime
B) cmath
C) cdate
D) cmisc
A) ctime
B) cmath
C) cdate
D) cmisc
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
33
The traditional C++ approach to error handling uses a(n) ____________________ to return a specific value to indicate specific operations.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
34
The ____________________ keyword identifies the start of an exception handling block of code.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
35
The expression getline(cin, message) will continuously accept and store characters typed at the terminal until the ____ key is pressed.
A) Shift
B) Enter
C) ESC
D) Ctrl
A) Shift
B) Enter
C) ESC
D) Ctrl
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
36
The function declaration (prototype) for each character class function is contained in the header file string or ____.
A) ctype
B) c_type
C) cctype
D) C-type
A) ctype
B) c_type
C) cctype
D) C-type
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
37
The ____ method returns the number of characters in the string.
A) str_size()
B) str_length()
C) size()
D) length()
A) str_size()
B) str_length()
C) size()
D) length()
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
38
Multiple catch blocks can be used as long as each block catches a(n) ____________________ data type.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
39
The parameter name in the catch block conventionally uses the letter ___________________ for exception.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
40
The ____ object reads a set of characters up to a blank space or a newline character.
A) cout
B) getline
C) cin
D) readline
A) cout
B) getline
C) cin
D) readline
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
41
In class terminology, functions are formally referred to as ____________________.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
42
The character output function corresponding to get() is ____________________() .
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
43
By convention, the first character in a string is always designated as position __________________.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
44
A common error associated with defining and processing strings is forgetting to include the ____________________ header file when using string class objects.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
45
The cout.put(charExp) method places the value of charExp on the ____________________ stream.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
46
Two string expressions can be compared for equality by using the standard ____________________ operators.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
47
Every key has a(n) ____________________ code, including Enter, the spacebar, Esc, and Ctrl.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
48
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.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
49
The length of a string is always one more than the ____________________ number of the last character s position in the string.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
50
The int isupper(charExp) function returns a true (non-zero integer) if charExp evaluates to a(n) ____________________ letter.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck