Exam Three Information

\(\boxdot\) General Information
  • First portion: closed resources - multiple choice, short answer, code tracing (50 points)

  • Second portion: coding questions - allowable resources are RSI Textbook, course web notes, Python Tutor, methods cheat sheet (30 - 40 points)

  • Two-hour interval

\(\boxdot\) Primary Topics
Selection
  • unary

    if boolean_value:  
         .
         .
  • binary

    if boolean_value:  
         .
         .
    else:  
         .  
         .
  • chained

    if boolean_value1:  
         .
         .  
    elif boolean_value2:  
         .  
         .  
    elif boolean_value3:  
         .  
         .  
    else  (optional)  
         .  
         .  
Iteration
  • for loops (definite)

    • for item in a_list:

    • for i in range(len(a_list)):

  • while loops (indefinite)

    • while boolean_object:

    • sentinel values

Strings - ' ' or " "
  • string traversal

  • string functions, operators and methods:

    • len() function

    • + - concatenation operator

    • * - repetition operator

    • : - slice operator

    • in and not in operators

    • strip()

    • split()

    • replace()

Lists - [ ]
  • list traversal

  • list functions, operators and methods:

    • len( ) function

    • + - concatenation operator

    • * - repetition operator

    • : - slice operator

    • append()

    • insert()

    • pop()

    • reverse()

    • index()

    • count()

    • remove()

  • list comprehensions

  • conversion : string \(\leftrightarrow\) list:

Tuples - ( )
  • tuple management (like strings):

    • len( ) function

    • concatenation operator +

    • slice operator :

  • tuples as a function return

Dictionaries {}
  • key and values

  • “traversing a dictionary”

  • adding a key-value pair

  • changing the value in a key-value pair

  • methods will be provided on the method cheat sheet along with those for stings and lists

Objects (Classes)
  • general class structure

  • class attributes and methods

\(\boxdot\) Types of Questions
  • multiple choice and/or short answer:

    • basic mathematics binary operators and precedence

    • for and while loops

    • strings, lists and tuples

    • methods, functions and operators for strings, lists and tuples

    • accumulator pattern

    • boolean expressions using comparison operators

    • precedence : mathematical operators, relational operators, logical operators

    • selection (if, if - else, if - elif - else)

  • error recognition:

    • basic syntax - when to use ( ), [ ]

    • indentation issues

    • improper use of strings, lists, and tuples (e.g. mutable versus immutable)

  • code reading:

    • program flow of execution (main() and other functions)

    • accumulator pattern

    • variable values at certain locations in the code

    • function return values

    • Turtle graphics and L-systems - maybe

  • code writing:

    • for and while loops

    • strings, lists, tuples, dictionaries, and Classes

    • random module functions - random() and randrange()

    • accumulator pattern

    • boolean expressions using comparison operators

    • precedence : mathematical operators, relational operators, logical operators

    • selection (if, if - else, if - elif - else)

    • proper indentation

  • not included:

    • 3n + 1 sequence

    • Newton’s method

    • image processing

    • character classification (9.19)