CSci 157 Exam 2 Review



Exam Coverage: Chapters from ThinkCS assigned in the readings and homeworks (from Chapters 6, 8-12);
Zelle Chapters 8 - 11 (on library reserve)

This exam will focus on newer material but is comprehensive with regard to fundamentals covered in the first exam:  

The second exam will emphasize these topics

Examples from lecture, homeworks, labs, and the text may figure in the exam.

Functions

Understand how to define new functions using def, use of parameters, and local variables. Know how we call functions and pass actual arguments and how they are (implicitly) assigned to the parameters in the parameter list. Variables defined inside a function are local to that function and are not defined outside the function; this is why we use parameters and return values to communicate data between functions.

Iteration

Know for and while iteration statements and when to use them.  Be able to use and explain the Initialize-Test-Update method for designing correct while loops. Be able to say how many times a given loop will iterate, what an infinite loop is, and how to tell if a loop terminates. Be able to explain why one style of loop might be preferred in a given situation. Examples included summations, input validation, and animation. See the relevant homework problems and more examples from the Loop Practice worksheet.

Some of our examples of using for loops used sequences or range. Be able to use simple methods and operations (such as append, the indexing operator [], slices (:), etc.) on sequence data in a loop.The split method for strings can be very useful.

Nested Lists

Use of structured data such as lists nested inside another list to model data such as: game boards, matrices, calendars (lists of dates), and so on. Access/modification of individual elements using nested loops. See Nested Structured activity.

Dictionaries

Storing key/value pairs in simple and nested dictionary structures (type dict) and use of dictionary methods such as keys, values, and items. Primary examples come from the Collections Activity and ThinkCS Section 11.7.

Misc

Know the definitions of cohesion and coupling (from Art in Computer Programming) and think about how they apply to program, module, and function design.

Questions?

If at any time you find that you cannot do a problem or understand a concept or how a question on a previous test should be solved, contact me. Bring as many questions as necessary to clear up anything you can't figure out on your own.

There will be coding questions based on reading programs and there will be questions that require you to write short programs. These could feature anything covered.

Come Equipped

You may bring your own notes and handouts (no sharing).  No calculators, laptops, magnifying lenses, or iPhones needed or allowed; caffeinated beverages okay.  I assume you can do high school math computations on paper.