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?

A

put

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?

A

get

21
Q

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

A

getline

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

A

putback

24
Q

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

A

peek

25
Q

What is type-safe I/O

A

Throws error when &laquo_space;» has not been overloaded for a user defined type

26
Q

Which member functions input or output bytes to or from memory?

A

read and write

27
Q

Member function that returns number of characters input by previous read operation on stream

A

gcount

28
Q

If read inputs specified number of characters into character array, what is set if fewer than specified number are read?

A

failbit

29
Q

How to set a base to hexadecimal, octal, or decimal until declared otherwise?

A

Use hex, oct, and dec

30
Q

Which parameterized stream manipulator sets the base for integer output?

A

setbase
Takes integer argument of 10, 8, or 16

31
Q

How can floating point precision be controlled?

A

precision member function
Sticky

32
Q

How to set field width and return previous width? How long is it applicable?

A

width or setw
Only applies for the next insertion or extraction

33
Q

How is setw different than width?

A

Breaks larger lines into chunks of that size

34
Q

Can you create your own stream manipulators?

A

Yes

35
Q

How to force floating point number to be output with decimal point?

A

showpoint stream manipulator

36
Q

Which stream manipulators left and right justify with padded characters?

A

left and right

37
Q

Which stream manipulator can indicate number’s sign or base be left justified while magnitude is right justified?

A

internal

38
Q

How to specify fill character?

A

setfill or fill

39
Q

How to force base to be output?

A

showbase

40
Q

How to output floating point number in scientific format?

A

scientific

41
Q

How to output X for hexadecimals or E for scientific values?

A

uppercase