CS 1510 Test #1 Study Guide
For Thursday, October 15th test...


  1. How to understand code: Practice, Practice, Practice. Things to do. Things to try.

    Test advice. Understanding code by modifying it and getting better at algorithms by adapting them.

    How to study and prepare:

    Review of session #12 (Thursday, October 1st).
                              ( and review of many other related sessions on binary, hexadecimal, Strings, if, for and while techniques ).

    Suggestions for exam preparation (These two things can make the DIFFERENCE).

  2. Practice Python Sample Exam questions.

  3. Write the expression that would cause name2 to output what is shown:
    >>> name = "Mark Jacobson"
    >>> name2 = ?????
    >>> name2
        Jacobson, Mark
    

  4. What is the output for the following?
    >>> helpR = "          1         2         3         4     "
    >>> seeEm = "0123456789012345678901234567890123456789012345"
    >>> names = "Richie Havens: Here comes the sun.  Woodstock."
    
    >>> names
    'Richie Havens: Here comes the sun.  Woodstock.'
    >>> len(names)
    46
    >>> names.count("o")
    4
    >>> names.find("o")
    21
    >>> names.find("o", names.find("o")+1)
    37
    >>> names.find("o", names.find("o", names.find("o")+1) + 1)
    38
    >>> names.find("o", names.find("o", names.find("o", names.find("o")+1) + 1) + 1)
    42
    >>> 
    >>> names
    'Richie Havens: Here comes the sun.  Woodstock.'
    
    >>> print("\n" + helpR + "\n" + seeEm + "\n" + names)
    
              1         2         3         4     
    0123456789012345678901234567890123456789012345
    Richie Havens: Here comes the sun.  Woodstock.
    

  5. In general, what will be on the exam?

    • Short answer questions
    • Code to trace or debug
    • Code to write
    • Show the output

    You have seen many examples of code to trace, debug, and write in class. They are scattered throughout the lecture notes, along with a few exercises done or suggested to from the textbook.

    You don't need to memorize all the esoteric details of Python. In class, we have used a relatively small subset of what the textbook presents. Many of those are nice power tools for us to use once we understand how to write code. On the exam, I will generally ask you to use something specific.

  6. String Code Tracing and String Processing examples.

  7. ... more stuff ....