Stream Input/Output Flashcards

1
Q

Where does I/O occur?

A

In streams

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

What is a stream?

A

A sequence of bytes

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

Low level I/O

A

Device to memory

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

High level I/O

A

Bytes grouped into units (ex: integers, strings)

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

Unformatted vs formatted I/O

A

Unformatted is faster but difficult to use
Formatted requires extra processing time but is readable

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

How to declare all stream I/O operations?

A

<iostream>
</iostream>

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

How to declare parameterized stream manipulators?

A

<iomanip>
</iomanip>

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

basic_istream and basic_ostream

A

Templates for input and output respectively

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

Template that supports both input and output?

A

basic_iostream

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

istream object cin tied to….

A

standard input device (keyboard)

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

ostream cout tied to….

A

Standard output device (screen)

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

Unbuffered ostream output?

A

cerr

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

Buffered ostream output

A

clog

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

How are data types determined for input and output?

A

Automatically by compiler

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

How are addresses displayed?

A

Hexadecimal

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

How can you print the address in a pointer variable?

A

Cast pointer to void*

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

What member function outputs one character and can be cascaded?

18
Q

Properties of stream input stream extraction operator&raquo_space;

A

Automatically skips white space characters
Returns false after end of file encountered

19
Q

How to input series of values using stream extraction operation?

A

In a while looo

20
Q

Which member function inputs one character and returns character or EOF at end of file?

21
Q

What function reads line of string but removes the delimiter and does not store

22
Q

How to skip specified number of characters in an input stream?

A

ignore member function

23
Q

How to place previous character obtained by get on a stream back into stream

24
Q

Which function returns next character from input stream but does not extract from the stream?

25
What is type-safe I/O
Throws error when << >> has not been overloaded for a user defined type
26
Which member functions input or output bytes to or from memory?
read and write
27
Member function that returns number of characters input by previous read operation on stream
gcount
28
If read inputs specified number of characters into character array, what is set if fewer than specified number are read?
failbit
29
How to set a base to hexadecimal, octal, or decimal until declared otherwise?
Use hex, oct, and dec
30
Which parameterized stream manipulator sets the base for integer output?
setbase Takes integer argument of 10, 8, or 16
31
How can floating point precision be controlled?
precision member function Sticky
32
How to set field width and return previous width? How long is it applicable?
width or setw Only applies for the next insertion or extraction
33
How is setw different than width?
Breaks larger lines into chunks of that size
34
Can you create your own stream manipulators?
Yes
35
How to force floating point number to be output with decimal point?
showpoint stream manipulator
36
Which stream manipulators left and right justify with padded characters?
left and right
37
Which stream manipulator can indicate number's sign or base be left justified while magnitude is right justified?
internal
38
How to specify fill character?
setfill or fill
39
How to force base to be output?
showbase
40
How to output floating point number in scientific format?
scientific
41
How to output X for hexadecimals or E for scientific values?
uppercase