Skip to content

Instantly share code, notes, and snippets.

@noynaert
Last active November 16, 2021 17:09
Show Gist options
  • Save noynaert/33c0c1f35d3acc3e88c0b917321afb54 to your computer and use it in GitHub Desktop.
Save noynaert/33c0c1f35d3acc3e88c0b917321afb54 to your computer and use it in GitHub Desktop.
Study Guide for CSC184, exam 02, Fall 2021, Missouri Western State University

Study Guide, Exam 02, CSC184, F2021

Chapter 8

Terms

  • String
  • Sequence
  • Traverse
  • Index
  • Offset
  • Immutable
  • Slice

Coding and concepts

  • Be able to index strings
  • Be able to print the characters in a string without using an index using for...in
  • Be able to print the characters in a string using an index and a while loop
  • Be able to print the characters in a string using an index and a for loop
  • Be able to return the index of the first occurance of a character in a string
  • Be able to count the occurrences of a character in a string
  • Be able to do simple string formatting
  • Be able to evaluate string slicing syntax
    • word[0:1]
    • word[2:5]
    • word[5:]
    • word[:5]
    • word[:]
  • Know how strings are sorted
    • String comparison are done with the same relational operators as numbers
    • They are based on their ASCII/Unicode values
      • Blanks, tabs, and other white space come before all the printing characters
      • Digits come before upper case letters
      • Upper case letters come before lower case
      • If everything else is equal then shorter beast longer. So "cat" would come before "catnip"
    • Be able to use the in operator with strings

Chapter 9

Terms

  • file
  • open
  • close

Concepts and Coding

  • Be able to open a file and read it one line at a time.
  • Be able to read to the the end of file
  • Be able to read all the lines from a file and store them in an array of strings.

Chapter 10

Terms

  • List (in other languages "lists" are called "arrays")
  • Mutable

Concepts and Coding

  • Lists are a sequence

  • Lists are mutable

  • range function

    • With one parameter (stop)
    • With two parameters (start, stop)
    • With three parameters (start, stop, step)
    • Traversing lists with ranges and for

    What sequence would be produced by range(3,10,2) ?

Searching

  • What is a linear search?

  • What is a binary search?

    • What condition must be true in order to use a binary search?
  • What does an O(N) growth rate mean?

  • What does and O(log n)growth rate mean?

  • What is an O(n2) growth rate mean? Why is it bad?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment