SLIDE 3 I/O Flashcards

1
Q

sequence of bytes (stream of bytes) from source to destination

A

Input/Output

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

sequence of characters from the source to the destination

A

Stream

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

sequence of characters from an input device to the computer

A

Input stream

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

sequence of characters from the computer to an output device

A

Output stream

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Use ________ header file to receive data from keyboard and send output to the screen

A

iostream

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

iostream contains definitions of two data types:

A

istream: input stream
ostream: output stream

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

iostream has two variables:

A

cin: stands for common input
cout: stands for common output

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Variable declaration of istream and ostream is similar to:

A

istream cin;
ostream cout;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

To use cin and cout, the preprocessor directive _________ must be used

A

include <iostream></iostream>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Input stream variables: type _____

A

istream

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Output stream variables: type _______

A

ostream

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

The syntax of an input statement using cin and the extraction operator&raquo_space; is

A

cin&raquo_space; variable&raquo_space; variable…;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

The extraction operator&raquo_space; is _____

A

binary

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Left-side operand is an _________
Example: cin
Right-side operand is a __________

A

input stream variable

variable

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Entering a char value into an int or double variable causes serious errors, called

A

input failure

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

skips leading whitespace, finds and stores only the next character

A

char variable

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

skips leading whitespace, reads + or - sign (if any), reads the digits (including decimal for floating-point variables)

A

int or double variable

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

executes when a program is run

A

main

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

(subprogram) is a set of instructions

A

function

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

Predefined functions are organized as a collection of libraries called

A

header file

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

Inputs next character (including whitespace)
Stores in memory location indicated by its argument

A

get function

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

The syntax of cin and the get function

A

cin.get (varChar);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

is a char variable
It is the argument (or parameter) of the function

A

varChar

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

ignore function

A

Discards a portion of the input

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
The syntax to use the function ignore is:
cin.ignore (intExp, chExp);
26
intExp is an ______expression chExp is a _______expression
integer char
27
Places previous character extracted by the get function from an input stream back to that stream
putback function
28
Returns next character from the input stream Does not remove the character from that stream
peek function
29
Syntax for putback
istreamVar.putback (ch);
30
Syntac for peek
ch=istreamVar.peek();
31
separates the input stream variable name from the member, or function, name
dot notation
32
In C++, the dot is the
member access operator
33
Things can go wrong during execution
Input Failure
34
If an error occurs when reading data Input stream enters the
fail state
35
Once in a fail state, all further I/O statements using that stream are ignored
The clear Function
36
When the program continues to execute with whatever values are stored in variables, this function restores the input stream to a working state
The clear Function
37
The syntax of the function clear is:
istreamVar.clear();
38
setprecision Manipulator syntax
setprecision (n)
39
Outputs decimal numbers with up to n decimal places Must include the header file iomanip #include
setprecision Manipulator
40
outputs floating-point numbers in a fixed decimal format
fixed Manipulator
41
outputs floating-point numbers in scientific format
scientific manipulator
42
output to show the decimal point and trailing zeros
showpoint Manipulator/showpoint forces
43
Reading and writing of long numbers can be error prone
C++14 Digit Separator
44
digit separator
' (single-quote character)
45
cannot be used to separate the digits of a number
commas
46
Outputs the value of an expression in a specified number of columns
setw
47
Additional formatting tools that give you more control over your output:
setfill manipulator left and right manipulators unsetf manipulator
48
Output stream variables can use setfill to fill unused columns with a character
setfill Manipulator
49
left-justifies the output
left manipulator
50
Disable left by using
unsetf
51
right-justifies the output
right manipulator
52
Two types of manipulators
Those with parameters Those without parameters
53
require the iomanip header ex. setprecision, setw, and setfill
Parameterized stream manipulators
54
Manipulators without parameters require the _________ header ex. endl, fixed, scientific, showpoint, and left
iostream
55
An input stream variable (such as cin) and >> operator can read a string into a variable of the data type ________
string
56
Skips any leading whitespace characters Stops reading at a whitespace character
extraction operator
57
reads until end of the current line
function getline
58
are reported by the compiler
Syntax errors
59
are typically not caught by the compiler
Logic errors
60
is an area in secondary storage to hold info
file
61
infinite sequence of characters from a source to a destination
Stream
62
from a source to a computer
Input stream
63
from a computer to a destination
Output stream
64
reads data character-by-character
get
65
skips data in a line
ignore
66
puts last character retrieved by get back to the input stream
putback
67
returns next character from input stream, but does not remove it
peek
68
Attempting to read invalid data into a variable causes the input stream to enter the _____
fail state
69
manipulators that can be used for formatting output
setprecision, fixed, showpoint, setw, setfill, left, and right
70
Include ____________ for the manipulators setprecision, setw, and setfill
iomanip