CS 170 Final Exam Terms and Concepts
Basic Computer Concepts
- hardware components: main memory, secondary memory, central
processing unit (CPU)
- main memory: random-access memory (RAM), address
- kinds of values stored in memory: integers, real numbers
(floats), characters (using ASCII/Unicode), strings, program instructions
- secondary memory: hard disk, floppy disk, CD, flash drive
- programming languages: machine language, assembly language,
high-level languages, syntax vs. semantics
Python Statements
- Python: variables, program statements, assignment
statements (how they are different from algebra), print statements,
input statements, numeric expressions
(operators such as +, -, *, /, //, % and **) and precedence,
importance of comments
Functions
- functions: how to define a function, parameter passing,
returning a value from a function, how to call a function, local
variables in a function
Repetition
- for loops: using for loops to achieve repetition, syntax of
for loops, how indenting is important to indicate what happens
inside vs. outside of loops
- range function: how the range function works, what it
returns for different inputs, how to use it to create the sequences
that you want, how it interacts with for loops
- accumulation pattern: using for loops to accumulate value
in a variable, sums as well as products, initializing the
accumulation variable, using += or *= or just var = var + whatever
to increment the accumulation variable
Selection statements
- if elif else: know how to write programs that use if
statements to allow choices in what code is executed. Know how to
indent these properly. Understand how control flows as if
statements are executing.
- Boolean and logical expressions: understand what a Boolean
value is (true or false) and how to use relational operators and
logical operators to construct them.
While loops
- while loops: know how to write programs that use while
loops, be able to construct a while loop that is equivalent to a
given for loop, understand when while loops are preferred and when
for loops are preferred, be able to implement code with nested
loops as necessary
- Newton's Method: recall how we used Newton's method to
calculate square roots, including the use of epsilon values to
determine when two floats are close enough to be considered
equivalent
- Data validation: Know how to use data validation loops to
make sure that input from the user is correct.
Integer arithmetic
- mod and integer division: understand how these
expressions work and why they can be useful.
Strings
- strings: how strings work in Python, how we can index them
from left to right (using 0 to len-1) and from right to left (using
-1 to -len), slices of strings (including all variations of the
colon notation), concatenation using +, use of in
and not in operators.
Lists
- lists: know how to create lists, index list elements,
manipulate lists, change the contents of lists, know len, min
and max functions, concatenation, list accumulation loops,
list methods (such as append, remove, sort)
Files
- files: how to work with files including open
function, various ways to read data from files, especially f.read()
and using a for loop over a file line by line
- split: method for strings, including default empty argument
and using string delimiter arguments
Strings
- string methods: know how to use find, count, upper, lower,
replace methods on strings, know how to do multiple assignment and
return
Mutability
- mutable and immutable objects: understand what mutable and
immutable mean, know which data types fit into which category
Dictionaries
- dictionaries: know what Python dictionaries are, know how
to use them, know why/when to use them, know how to store values in
a dictionary, access values using a key, know the keys and values
methods for dictionaries, know how to use a for loop to loop
through dictionary items
Stuff about images and about object-oriented programming in Python
is important and useful, but will not be covered on the final exam.