This is a blue quiz. The people to your left and right should have a blue quiz. |
Print your name here____________________________________________________ ID#___________________
Please write your answers on this sheet, and print your name and ID number above. This quiz covers iteration beyond Sec. 5.5 and basic file I/O operations from Secs. 8.1 and 8.2.
Question 1.
In Fig. 5.9, page 260, what is the value of each relational expression
in the logical expression assigned to digitRead in the while loop if
the value of nextChar is '2'? If the value of nextChar is 'a'? (HINT:
For the 'a' case, see page 715.)
Question 2.
Let x be type float, n type int, and c type char.
Indicate the contents
of each variable after each read operation performed on the input stream:
316 7 98.1 AB*<nwln>44 Q <nwln>
where "<nwln>" means that a newline is enter (also known as '\n'). Assume that the input buffer is reset to the first character before the start of questions 2A and 2B below.
2A. cin >> n >> x; cin >> c >> n;
2B. cin >> c >> c >> c >> x >> n;