Deck 13: Advanced Input and Output

Full screen (f)
exit full mode
Question
The ofile() function opens a data file.
Use Space or
up arrow
down arrow
to flip the card.
Question
The ____ function controls the number of significant digits you see in the output.

A) setw()
B) setprecision()
C) precision()
D) width()
Question
The ____ function defines the size of the output field in which the next output will be displayed.

A) setw()
B) setprecision()
C) precision()
D) width()
Question
The ____ manipulator specifies the number of significant digits to display.

A) setw()
B) setprecision()
C) precision()
D) width()
Question
Temporary data storage exists in computer memory; it is lost when power is lost.
Question
The cin.get() statement can retrieve any character, including letters, numbers, punctuation, and white space such as the character generated by pressing the Enter key.
Question
The ____ function reads a line of text at the address represented by the first argument to the function until it reaches either the length used as the second argument or the character used as the third argument.

A) open()
B) ignore()
C) get()
D) getline()
Question
____ I/O is unformatted; that is, bytes are transferred into and out from memory without regard to the type of data they represent.

A) Low-level
B) High-Level
C) Primitive
D) Advanced
Question
____ I/O is formatted; that is, bytes are grouped into meaningful units such as integers, doubles, and class object types.

A) Low-level
B) High-Level
C) Primitive
D) Advanced
Question
The ____ function takes arguments that set the bits of cout ; that is, the arguments turn the bits in the format flag on.

A) setw()
B) setprecision()
C) setf()
D) unsetf()
Question
The ____ function takes a character argument and returns a reference to the object that invoked the function.

A) open()
B) ignore()
C) get()
D) getline()
Question
The ____ manipulator turns on bit codes for the attributes named as arguments.

A) setw()
B) setprecision()
C) setiosflags()
D) resetiosflags()
Question
No matter how many decimal positions a number contains, C++ will display five positions if you do not explicitly set a precision for output.
Question
The ____ function skips any additional characters left in the input stream after data is accepted.

A) open()
B) ignore()
C) unsetf()
D) getline()
Question
A ____ is a way to create a shorter, easier-to-remember nickname for an unwieldy identifier.

A) fixed
B) showbase
C) setf()
D) typedef
Question
The && and || operators are used for shifting bits in some contexts.
Question
Format flags are also known as state flags.
Question
The ____ manipulator allows you to set the width of a field for output.

A) setw()
B) setprecision()
C) setf()
D) width()
Question
The ____ function can be used to deselect a bit in the format flag.

A) setw()
B) setprecision()
C) setf()
D) unsetf()
Question
All format flags begin with iosf:: .
Question
____________________ flags are the arguments that determine the state of the cout object.
Question
A(n) ____________________ manipulator is a manipulator that takes an argument.
Question
The ____________________ manipulator displays numbers in hexadecimal form.
Question
C++ provides a(n) ____________________ manipulator to flush the stream without sending a newline character.
Question
The ____ manipulator turns off bit codes for the attributes named as arguments.

A) setw()
B) setprecision()
C) setiosflags()
D) resetiosflags()
Question
A(n) ____ mode indicates how a file is opened-for example, for input or output.

A) I/O
B) precision
C) stream
D) file
Question
A ____ consists of a number of data fields that are logically connected because they pertain to the same entity.

A) data field
B) data hierarchy
C) data record
D) data file
Question
The ____ manipulator displays octal numbers with a leading 0 and hexadecimal numbers with a leading 0x so you do not mistake them for base 10 (decimal) numbers.

A) showbase
B) oct
C) hex
D) fixed
Question
In addition to endl , C++ provides a(n) ____________________ manipulator to send a null (or space) character rather than a newline.
Question
Write a program in which a 10-character limit is applied to the entry of a user's name. The program should use the get() function and display the message "Hello," followed by the user's name.
Question
Mention one advantage and one disadvantage of using the get() function instead of the extraction operator (>>) with cin for keyboard data entry.
Question
A ____ represents the relationships between the sizes of data units that business professionals most often use.

A) database
B) data hierarchy
C) data record
D) data file
Question
A(n) ____________________ character separates data fields.
Question
A ____ represents one piece of data, such as a first or last name, phone or Social Security number, or salary.

A) data field
B) data hierarchy
C) data record
D) data file
Question
A group of related files is often stored in a ____.

A) database
B) data hierarchy
C) data record
D) data field
Question
The ____ is a key combination that indicates completion of data entry.

A) delimiting character
B) end-of-file indicator
C) data record
D) setiosflags
Question
The ____ key combination can be used to indicate an end-of-file.

A) Ctrl-c
B) Ctrl-f
C) Ctrl-z
D) Ctrl-e
Question
Why was Unicode developed?
Question
The ____________________ manipulator displays values in octal form.
Question
What is the syntax of the get() function?
Question
What happens when you use a delimiter other than '\n' with getline() ?
Question
Match between columns
contains records that are logically related
delimiter character
contains records that are logically related
manipulator
contains records that are logically related
data hierarchy
contains records that are logically related
stream
contains records that are logically related
fixed manipulator
contains records that are logically related
typedef
contains records that are logically related
Unicode
contains records that are logically related
permanent storage device
contains records that are logically related
data file
Question
What is a bit?
Question
Match between columns
represents the relationships between the sizes of data units that business professionals most often use
delimiter character
represents the relationships between the sizes of data units that business professionals most often use
manipulator
represents the relationships between the sizes of data units that business professionals most often use
data hierarchy
represents the relationships between the sizes of data units that business professionals most often use
stream
represents the relationships between the sizes of data units that business professionals most often use
fixed manipulator
represents the relationships between the sizes of data units that business professionals most often use
typedef
represents the relationships between the sizes of data units that business professionals most often use
Unicode
represents the relationships between the sizes of data units that business professionals most often use
permanent storage device
represents the relationships between the sizes of data units that business professionals most often use
data file
Question
Match between columns
used to describe disks and similar devices
delimiter character
used to describe disks and similar devices
manipulator
used to describe disks and similar devices
data hierarchy
used to describe disks and similar devices
stream
used to describe disks and similar devices
fixed manipulator
used to describe disks and similar devices
typedef
used to describe disks and similar devices
Unicode
used to describe disks and similar devices
permanent storage device
used to describe disks and similar devices
data file
Question
What are some commonly used format flags?
Question
Match between columns
allows you to output a specified number of decimal places
delimiter character
allows you to output a specified number of decimal places
manipulator
allows you to output a specified number of decimal places
data hierarchy
allows you to output a specified number of decimal places
stream
allows you to output a specified number of decimal places
fixed manipulator
allows you to output a specified number of decimal places
typedef
allows you to output a specified number of decimal places
Unicode
allows you to output a specified number of decimal places
permanent storage device
allows you to output a specified number of decimal places
data file
Question
Match between columns
used to manipulate, or change, the state of the cout object
delimiter character
used to manipulate, or change, the state of the cout object
manipulator
used to manipulate, or change, the state of the cout object
data hierarchy
used to manipulate, or change, the state of the cout object
stream
used to manipulate, or change, the state of the cout object
fixed manipulator
used to manipulate, or change, the state of the cout object
typedef
used to manipulate, or change, the state of the cout object
Unicode
used to manipulate, or change, the state of the cout object
permanent storage device
used to manipulate, or change, the state of the cout object
data file
Question
Match between columns
character that terminates data entry
delimiter character
character that terminates data entry
manipulator
character that terminates data entry
data hierarchy
character that terminates data entry
stream
character that terminates data entry
fixed manipulator
character that terminates data entry
typedef
character that terminates data entry
Unicode
character that terminates data entry
permanent storage device
character that terminates data entry
data file
Question
Match between columns
provides a synonym for an identifier
delimiter character
provides a synonym for an identifier
manipulator
provides a synonym for an identifier
data hierarchy
provides a synonym for an identifier
stream
provides a synonym for an identifier
fixed manipulator
provides a synonym for an identifier
typedef
provides a synonym for an identifier
Unicode
provides a synonym for an identifier
permanent storage device
provides a synonym for an identifier
data file
Question
How is a file closed in C++?
Question
Match between columns
extended, international coding system
delimiter character
extended, international coding system
manipulator
extended, international coding system
data hierarchy
extended, international coding system
stream
extended, international coding system
fixed manipulator
extended, international coding system
typedef
extended, international coding system
Unicode
extended, international coding system
permanent storage device
extended, international coding system
data file
Question
What are the ostream objects that C++ instantiates?
Question
Match between columns
sequence of bytes used in an input or output operation
delimiter character
sequence of bytes used in an input or output operation
manipulator
sequence of bytes used in an input or output operation
data hierarchy
sequence of bytes used in an input or output operation
stream
sequence of bytes used in an input or output operation
fixed manipulator
sequence of bytes used in an input or output operation
typedef
sequence of bytes used in an input or output operation
Unicode
sequence of bytes used in an input or output operation
permanent storage device
sequence of bytes used in an input or output operation
data file
Question
Mention three file modes available in C++ for opening files.
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/55
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 13: Advanced Input and Output
1
The ofile() function opens a data file.
False
2
The ____ function controls the number of significant digits you see in the output.

A) setw()
B) setprecision()
C) precision()
D) width()
C
3
The ____ function defines the size of the output field in which the next output will be displayed.

A) setw()
B) setprecision()
C) precision()
D) width()
D
4
The ____ manipulator specifies the number of significant digits to display.

A) setw()
B) setprecision()
C) precision()
D) width()
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
5
Temporary data storage exists in computer memory; it is lost when power is lost.
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
6
The cin.get() statement can retrieve any character, including letters, numbers, punctuation, and white space such as the character generated by pressing the Enter key.
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
7
The ____ function reads a line of text at the address represented by the first argument to the function until it reaches either the length used as the second argument or the character used as the third argument.

A) open()
B) ignore()
C) get()
D) getline()
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
8
____ I/O is unformatted; that is, bytes are transferred into and out from memory without regard to the type of data they represent.

A) Low-level
B) High-Level
C) Primitive
D) Advanced
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
9
____ I/O is formatted; that is, bytes are grouped into meaningful units such as integers, doubles, and class object types.

A) Low-level
B) High-Level
C) Primitive
D) Advanced
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
10
The ____ function takes arguments that set the bits of cout ; that is, the arguments turn the bits in the format flag on.

A) setw()
B) setprecision()
C) setf()
D) unsetf()
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
11
The ____ function takes a character argument and returns a reference to the object that invoked the function.

A) open()
B) ignore()
C) get()
D) getline()
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
12
The ____ manipulator turns on bit codes for the attributes named as arguments.

A) setw()
B) setprecision()
C) setiosflags()
D) resetiosflags()
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
13
No matter how many decimal positions a number contains, C++ will display five positions if you do not explicitly set a precision for output.
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
14
The ____ function skips any additional characters left in the input stream after data is accepted.

A) open()
B) ignore()
C) unsetf()
D) getline()
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
15
A ____ is a way to create a shorter, easier-to-remember nickname for an unwieldy identifier.

A) fixed
B) showbase
C) setf()
D) typedef
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
16
The && and || operators are used for shifting bits in some contexts.
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
17
Format flags are also known as state flags.
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
18
The ____ manipulator allows you to set the width of a field for output.

A) setw()
B) setprecision()
C) setf()
D) width()
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
19
The ____ function can be used to deselect a bit in the format flag.

A) setw()
B) setprecision()
C) setf()
D) unsetf()
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
20
All format flags begin with iosf:: .
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
21
____________________ flags are the arguments that determine the state of the cout object.
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
22
A(n) ____________________ manipulator is a manipulator that takes an argument.
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
23
The ____________________ manipulator displays numbers in hexadecimal form.
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
24
C++ provides a(n) ____________________ manipulator to flush the stream without sending a newline character.
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
25
The ____ manipulator turns off bit codes for the attributes named as arguments.

A) setw()
B) setprecision()
C) setiosflags()
D) resetiosflags()
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
26
A(n) ____ mode indicates how a file is opened-for example, for input or output.

A) I/O
B) precision
C) stream
D) file
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
27
A ____ consists of a number of data fields that are logically connected because they pertain to the same entity.

A) data field
B) data hierarchy
C) data record
D) data file
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
28
The ____ manipulator displays octal numbers with a leading 0 and hexadecimal numbers with a leading 0x so you do not mistake them for base 10 (decimal) numbers.

A) showbase
B) oct
C) hex
D) fixed
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
29
In addition to endl , C++ provides a(n) ____________________ manipulator to send a null (or space) character rather than a newline.
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
30
Write a program in which a 10-character limit is applied to the entry of a user's name. The program should use the get() function and display the message "Hello," followed by the user's name.
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
31
Mention one advantage and one disadvantage of using the get() function instead of the extraction operator (>>) with cin for keyboard data entry.
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
32
A ____ represents the relationships between the sizes of data units that business professionals most often use.

A) database
B) data hierarchy
C) data record
D) data file
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
33
A(n) ____________________ character separates data fields.
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
34
A ____ represents one piece of data, such as a first or last name, phone or Social Security number, or salary.

A) data field
B) data hierarchy
C) data record
D) data file
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
35
A group of related files is often stored in a ____.

A) database
B) data hierarchy
C) data record
D) data field
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
36
The ____ is a key combination that indicates completion of data entry.

A) delimiting character
B) end-of-file indicator
C) data record
D) setiosflags
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
37
The ____ key combination can be used to indicate an end-of-file.

A) Ctrl-c
B) Ctrl-f
C) Ctrl-z
D) Ctrl-e
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
38
Why was Unicode developed?
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
39
The ____________________ manipulator displays values in octal form.
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
40
What is the syntax of the get() function?
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
41
What happens when you use a delimiter other than '\n' with getline() ?
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
42
Match between columns
contains records that are logically related
delimiter character
contains records that are logically related
manipulator
contains records that are logically related
data hierarchy
contains records that are logically related
stream
contains records that are logically related
fixed manipulator
contains records that are logically related
typedef
contains records that are logically related
Unicode
contains records that are logically related
permanent storage device
contains records that are logically related
data file
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
43
What is a bit?
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
44
Match between columns
represents the relationships between the sizes of data units that business professionals most often use
delimiter character
represents the relationships between the sizes of data units that business professionals most often use
manipulator
represents the relationships between the sizes of data units that business professionals most often use
data hierarchy
represents the relationships between the sizes of data units that business professionals most often use
stream
represents the relationships between the sizes of data units that business professionals most often use
fixed manipulator
represents the relationships between the sizes of data units that business professionals most often use
typedef
represents the relationships between the sizes of data units that business professionals most often use
Unicode
represents the relationships between the sizes of data units that business professionals most often use
permanent storage device
represents the relationships between the sizes of data units that business professionals most often use
data file
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
45
Match between columns
used to describe disks and similar devices
delimiter character
used to describe disks and similar devices
manipulator
used to describe disks and similar devices
data hierarchy
used to describe disks and similar devices
stream
used to describe disks and similar devices
fixed manipulator
used to describe disks and similar devices
typedef
used to describe disks and similar devices
Unicode
used to describe disks and similar devices
permanent storage device
used to describe disks and similar devices
data file
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
46
What are some commonly used format flags?
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
47
Match between columns
allows you to output a specified number of decimal places
delimiter character
allows you to output a specified number of decimal places
manipulator
allows you to output a specified number of decimal places
data hierarchy
allows you to output a specified number of decimal places
stream
allows you to output a specified number of decimal places
fixed manipulator
allows you to output a specified number of decimal places
typedef
allows you to output a specified number of decimal places
Unicode
allows you to output a specified number of decimal places
permanent storage device
allows you to output a specified number of decimal places
data file
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
48
Match between columns
used to manipulate, or change, the state of the cout object
delimiter character
used to manipulate, or change, the state of the cout object
manipulator
used to manipulate, or change, the state of the cout object
data hierarchy
used to manipulate, or change, the state of the cout object
stream
used to manipulate, or change, the state of the cout object
fixed manipulator
used to manipulate, or change, the state of the cout object
typedef
used to manipulate, or change, the state of the cout object
Unicode
used to manipulate, or change, the state of the cout object
permanent storage device
used to manipulate, or change, the state of the cout object
data file
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
49
Match between columns
character that terminates data entry
delimiter character
character that terminates data entry
manipulator
character that terminates data entry
data hierarchy
character that terminates data entry
stream
character that terminates data entry
fixed manipulator
character that terminates data entry
typedef
character that terminates data entry
Unicode
character that terminates data entry
permanent storage device
character that terminates data entry
data file
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
50
Match between columns
provides a synonym for an identifier
delimiter character
provides a synonym for an identifier
manipulator
provides a synonym for an identifier
data hierarchy
provides a synonym for an identifier
stream
provides a synonym for an identifier
fixed manipulator
provides a synonym for an identifier
typedef
provides a synonym for an identifier
Unicode
provides a synonym for an identifier
permanent storage device
provides a synonym for an identifier
data file
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
51
How is a file closed in C++?
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
52
Match between columns
extended, international coding system
delimiter character
extended, international coding system
manipulator
extended, international coding system
data hierarchy
extended, international coding system
stream
extended, international coding system
fixed manipulator
extended, international coding system
typedef
extended, international coding system
Unicode
extended, international coding system
permanent storage device
extended, international coding system
data file
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
53
What are the ostream objects that C++ instantiates?
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
54
Match between columns
sequence of bytes used in an input or output operation
delimiter character
sequence of bytes used in an input or output operation
manipulator
sequence of bytes used in an input or output operation
data hierarchy
sequence of bytes used in an input or output operation
stream
sequence of bytes used in an input or output operation
fixed manipulator
sequence of bytes used in an input or output operation
typedef
sequence of bytes used in an input or output operation
Unicode
sequence of bytes used in an input or output operation
permanent storage device
sequence of bytes used in an input or output operation
data file
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
55
Mention three file modes available in C++ for opening files.
Unlock Deck
Unlock for access to all 55 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 55 flashcards in this deck.