COLLEGE OF ENGINEERING School of Electrical Engineering and Computer Science
• What we learned from Midterm 2
13/2/2020 CS 161
CS 161Introduction to CS I
Lecture 24
Week 9 tips
• This week• Assignment 5 peer reviews – due Weds. 3/4 at midnight• Study session – Thursday 3/5 from 6-7 p.m. in LINC 268• Assignment 5 – due Sunday 3/8 at midnight
• Beyond week 9• Proficiency demo – week 10• Makeup assignment (6) – week 10• Final exam – Monday 3/16 from 6-7:50 p.m. in LINC 128
3/2/2020 CS 161 2
Midterm 2 solutions• Your opportunity to fill in gaps in understanding• Use any errors to highlight what to you can spend more time on
• Solutions (forms 1 and 2) are posted on course website• Calendar -> 03/02 (lecture 24)• Direct links:
http://classes.engr.oregonstate.edu/eecs/winter2020/cs161-020/calendar/CS161_Midterm_2_W20_form1_soln.pdfhttp://classes.engr.oregonstate.edu/eecs/winter2020/cs161-020/calendar/CS161_Midterm_2_W20_form2_soln.pdf
• Midterms for pickup on Wednesday
3/2/2020 CS 161 3
Midterm 2 solutions
• Return type of a function (Q11, form 1)• Function overloading (Q12, form 1)• Dangling pointer vs. memory leak (Q14, form 1)• Order of freeing 2D array (Q18, form 1)• Allocate hobbit holes (Q19, form 1)• Pointer to item on the stack (Q20, form 1)• If/else – only one branch can execute (Q21, form 1)
43/2/2020 CS 161
Midterm 2 solutions• What type is given by "new int"?
(Q23, form 1)• Precedence of dereference vs.
indexing (Q30, form 1)• Recall lab 6: why did you have to do
(*r)[3] instead of *r[3] for string* r?• Boolean expressions (Q32, form1)• Pass by value does not change variable
(Q33, form 1)
53/2/2020 CS 161
a++ a-- [] . ->! ++a --a *p &a
* / %+ -
< <= > >=
== !=&&||
= += -= *= /= %=
Operator precedence
Midterm 2 solutions
• Declaring references and pointers (Q35, form 1)• Extra credit
63/2/2020 CS 161
Top Related