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
Q

The syntax to use the function ignore is:

A

cin.ignore (intExp, chExp);

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

intExp is an ______expression
chExp is a _______expression

A

integer
char

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

Places previous character extracted by the get function from an input stream back to that stream

A

putback function

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

Returns next character from the input stream
Does not remove the character from that stream

A

peek function

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

Syntax for putback

A

istreamVar.putback (ch);

30
Q

Syntac for peek

A

ch=istreamVar.peek();

31
Q

separates the input stream variable name from the member, or function, name

A

dot notation

32
Q

In C++, the dot is the

A

member access operator

33
Q

Things can go wrong during execution

A

Input Failure

34
Q

If an error occurs when reading data
Input stream enters the

A

fail state

35
Q

Once in a fail state, all further I/O statements using that stream are ignored

A

The clear Function

36
Q

When the program continues to execute with whatever values are stored in variables, this function
restores the input stream to a working state

A

The clear Function

37
Q

The syntax of the function clear is:

A

istreamVar.clear();

38
Q

setprecision Manipulator syntax

A

setprecision (n)

39
Q

Outputs decimal numbers with up to n decimal places

Must include the header file iomanip
#include <iomanip></iomanip>

A

setprecision Manipulator

40
Q

outputs floating-point numbers in a fixed decimal format

A

fixed Manipulator

41
Q

outputs floating-point numbers in scientific format

A

scientific manipulator

42
Q

output to show the decimal point and trailing zeros

A

showpoint Manipulator/showpoint forces

43
Q

Reading and writing of long numbers can be error prone

A

C++14 Digit Separator

44
Q

digit separator

A

’ (single-quote character)

45
Q

cannot be used to separate the digits of a number

A

commas

46
Q

Outputs the value of an expression in a specified number of columns

A

setw

47
Q

Additional formatting tools that give you more control over your output:

A

setfill manipulator
left and right manipulators
unsetf manipulator

48
Q

Output stream variables can use setfill to fill unused columns with a character

A

setfill Manipulator

49
Q

left-justifies the output

A

left manipulator

50
Q

Disable left by using

A

unsetf

51
Q

right-justifies the output

A

right manipulator

52
Q

Two types of manipulators

A

Those with parameters
Those without parameters

53
Q

require the iomanip header
ex. setprecision, setw, and setfill

A

Parameterized stream manipulators

54
Q

Manipulators without parameters require the _________ header
ex. endl, fixed, scientific, showpoint, and left

A

iostream

55
Q

An input stream variable (such as cin) and&raquo_space; operator can read a string into a variable of the data type ________

A

string

56
Q

Skips any leading whitespace characters
Stops reading at a whitespace character

A

extraction operator

57
Q

reads until end of the current line

A

function getline

58
Q

are reported by the compiler

A

Syntax errors

59
Q

are typically not caught by the compiler

A

Logic errors

60
Q

is an area in secondary storage to hold info

A

file

61
Q

infinite sequence of characters from a source to a destination

A

Stream

62
Q

from a source to a computer

A

Input stream

63
Q

from a computer to a destination

A

Output stream

64
Q

reads data character-by-character

A

get

65
Q

skips data in a line

A

ignore

66
Q

puts last character retrieved by get back to the input stream

A

putback

67
Q

returns next character from input stream, but does not remove it

A

peek

68
Q

Attempting to read invalid data into a variable causes the input stream to enter the _____

A

fail state

69
Q

manipulators that can be used for formatting output

A

setprecision, fixed, showpoint, setw, setfill, left, and right

70
Q

Include ____________ for the manipulators setprecision, setw, and setfill

A

iomanip