1 |
h05 |
CS16 F16 |
Name: | ||||
---|---|---|---|---|
(as it would appear on official course roster) | ||||
Umail address: | @umail.ucsb.edu | section 9am or 10:30am |
||
Optional: name you wish to be called if different from name above. | ||||
Optional: name of "homework buddy" (leaving this blank signifies "I worked alone" |
h05: Homework 5
ready? | assigned | due | points |
---|---|---|---|
true | Thu 10/06 02:00PM | Tue 10/11 02:00PM |
You may collaborate on this homework with AT MOST one person, an optional "homework buddy".
MAY ONLY BE TURNED IN IN THE LECTURE/LAB LISTED ABOVE AS THE DUE DATE,
OR IF APPLICABLE, SUBMITTED ON GRADESCOPE. There is NO MAKEUP for missed assignments;
in place of that, we drop the three lowest scores (if you have zeros, those are the three lowest scores.)
Please:
- No Staples.
- No Paperclips.
- No folded down corners.
Read Chapter 3.1 - 3.3 (If you do not have a copy of the textbook yet, there is one on reserve at the library under “COMP000-STAFF - Permanent Reserve”).
PLEASE MARK YOUR HOMEWORK CLEARLY, REGARDLESS OF IF YOU WRITE IT OUT IN INK OR PENCIL!
-
1. (2 pts) What is a runtime error in C++?
2. (6 pts) Use precedence rules to re-write the following expressions:
x / 4 - 3 == 1 && 6 * x + y > 0
a / b * b < 0.5 || --flag >= 0
z * m + n / v >= 5 && b + c - d != 0 || f < g
3. (4 pts) What is the output of the following statements?
int p = 5;
while (--p > 0)
cout << p << " ";
int s = 1;
do
cout << s << " ";
while (s++ <= 5);
while (++s <= 5);