Character Story Analogy Quiz

A Pixar-Themed Quiz About Streamville

(Every question references the story to reinforce memory.)

Section A — Input Streamville (Cin)

1. Cin arrives with “22 3.14 d hey” when you only asked for one integer.
Why does Cin hand you the integer immediately at the next prompt without letting you type?

A) He loves skipping ahead
B) His backpack still had extra letters
C) Cout told him to hurry
D) The output buffer overflowed


2. Cin panics when he tries to read “abc” as a number.
Which character must calm him down?

A) Broom Ignore
B) Eofbit
C) Doctor Clear
D) Sir Format


3. After Doctor Clear helps, who must sweep away the leftover junk?

A) The Error Trio
B) Sister Delimita
C) Broom Ignore
D) Cout


Section B — Output Plaza (Cout)

4. Cout uses endl. What does that signal mean?

A) "Pause."
B) “Flush the backpack now!”
C) “Hide the output.”
D) “Use fixed formatting.”


5. Sir Format gives numbers fancy outfits.
What does fixed do?

A) Limits total number of jewels
B) Makes all numbers scientific
C) Forces a fixed number of decimal places
D) Deletes trailing zeros


Section C — File I/O Portals

6. Opening a portal with ios::out is like…

A) Opening the door and adding new pages
B) Throwing all old pages away
C) Reading the notebook only
D) Creating a portal that never closes


7. Sister Delimita wants commas to separate table columns.
Why can’t Cin read CSV with >> ?

A) He dislikes commas
B) He only recognizes spaces/tabs as separators
C) CSV is too new
D) Only Cout can read CSV


Section D — Professor Stringstream

8. Why does Professor Stringstream use str() on each line?

A) To translate the data into another language
B) To erase the chalkboard and write the new line
C) To remove whitespace
D) To flush the buffer


Section E — Mixed Story Logic

9. Why must Eofbit be checked before Failbit?

A) Because Failbit is shy
B) Because they both activate at end-of-file, but Eofbit gives the true cause
C) Because Failbit lies
D) Because Eofbit is older


10. Why does Streamville insist on always closing files?

A) It politely says goodbye
B) It seals all letters and mails them (flushes the buffer)
C) It resets all manipulators
D) It makes Cin and Cout happy


🎯 STREAMVILLE QUIZ — ANSWER KEY


1. Why does Cin hand the next item without waiting for input?

B) His backpack still had extra letters
Cin keeps leftover input in his buffer, so he uses it before asking for new data.


2. Who calms Cin down after he panics from bad input?

C) Doctor Clear
Doctor Clear resets the failbit so Cin can work again.


3. Who sweeps away leftover junk after a failed read?

C) Broom Ignore
cin.ignore(...) removes leftover data after clearing the stream state.


4. What does cout << endl do?

B) “Flush the backpack now!”
endl adds a newline and forces an immediate flush.


5. What does fixed do?

C) Forces a fixed number of decimal places
fixed changes precision to refer to digits after the decimal.


6. Opening a file with ios::out is like…

B) Throwing all old pages away
ios::out overwrites the file unless combined with app.


7. Why can’t Cin read CSV with >> ?

B) He only recognizes spaces/tabs as separators
The extraction operator doesn't treat commas as delimiters.


8. Why does Professor Stringstream use str() ?

B) To erase the chalkboard and write the new line
str() replaces the internal buffer with new content.


9. Why check Eofbit before Failbit?

B) Because they both activate at end-of-file, but Eofbit gives the true cause
Failbit and eofbit often set together — eofbit explains why reading failed.


10. Why must files be closed?

B) It seals all letters and mails them (flushes the buffer)
Closing ensures all data gets written and frees resources.