Final Exam

  • Morning class (section 403): Thursday November 16, 8:30 AM to 10:45 AM
  • Afternoon class (section 411): Thursday November 16, 11:30 AM to 1:45 PM

The final exam is worth 35% of the grade (70 points). The exam must be completed individually with no communication or collaboration with others. You may take up to 2 hours and 15 minutes to complete the exam.

The first part of the final exam requires written responses on paper. It will ask for multiple choice, written explanations, code predictions, and/or simple code writing. You may not use the computer or any electronic devices for this part of the exam.

After you have turned in your answers to the written part (you may keep the questions for the second part), you may work on the computer portion of the exam. This portion will consist of 4 to 5 problems, which you will then submit pasted in a text file to D2L. For the exam, you do not need to submit summary statements, comments or test code.

Under no circumstances should you have any communication apps open, including text apps and email. Having any such apps open will result in a 0 for the final exam. The answers you provide must be your individual answers. You may not use answers provided by anyone or any machine. Sufficient evidence to the contrary is considered a violation of academic integrity and will be treated as such.

Review of Major Concepts

The exam covers chapters 1 through 7.

General concepts

  • Input and output, through interactive shell and with files, formatting output
  • Data types: string, integer, floating point, boolean, list, dictionary, set, tuple
  • Control statements: if statements, loops
  • Loops: iteration, index-based and while
  • Functions: parameters, return values
  • Variables, name spaces, local and global variables
  • Common functions and methods for string, list and dictionary types
  • Try/except statements

General knowlege of the topics in these areas is expected. The exam will typically address these topics with multiple choice and short answer questions.

Common code techniques

  • Type conversion
  • Defining and using functions
  • Working with loops: accumulators (such as running totals, adding to a list, counting, finding min/max) and boolean responses (e.g. return true if all string elements are shorter than 10 characters, false otherwise)
  • Nested loops
  • Working with dictionaries: adding elements, looking up elements, obtaining keys and iterating through all dictionary elements

Practice Problems

  • Write a function that takes a list of integers (positive and negative) as an argument and returns the sum of all of the positive integers.
  • Write a function that takes a list of strings as an argument and returns True if the same string is repeated three times in a row anywhere in the list. If no strings are ever repeated three times in a row, it should return False.
  • Write a function that takes a list of a list of strings. It should return a count of the number of times that a sublist of strings has a total character count of more than 10 (i.e. the lengths of all of the strings in the sublist add up to 10 or more).
  • Predict the output of this code