This exam will focus on newer material but is comprehensive with regard to fundamentals covered in the first exam:
for
and while
str
,
list
, tuple
, and filesdict
and its operationsExamples from lecture, homeworks, labs, and the text may figure in the exam.
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.
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.
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.
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.
Know the definitions of cohesion and coupling (from Art in Computer Programming) and think about how they apply to program, module, and function design.
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.
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.