This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: CSC108H1F 2009 Test 2 Duration — 35 minutes Aids allowed: none Student Number: Last Name: First Name: Lecture Section: L0101 Instructor: Horton Do not turn this page until you have received the signal to start. (Please fill out the identification section above, write your name on the back of the test , and read the instructions below.) Good Luck! This midterm consists of 2 questions on 8 pages (including this one). When you receive the signal to start, please make sure that your copy is complete. Comments and docstrings are not required except where indicated, although they may help us mark your answers. They may also get you part marks if you can’t figure out how to write the code. No error checking is required: assume all user input and all argument values are valid. If you use any space for rough work, indicate clearly what you want marked. # 1: /10 # 2: /10 TOTAL : /20 Total Pages = 8 Page 1 cont’d . . . CSC108H1F Test 2 Fall 2009 Question 1. [10 marks] For the purpose of this question, we will consider the letters“a”, “e”, “i”, “o” and “u” (whether lowercase or uppercase) to be vowels, but not ”y”. Part (a) [4 marks] Consider the following function: def vowels(s, i): ’’’Return the length of the longest sequence of consecutive vowels within s that starts at index i. s is a str of length at least one, and i is a valid index into s.’’’ Complete the table below by adding four distinct test cases for function vowels . For each, provide specific....
View Full Document
This note was uploaded on 09/19/2011 for the course CSC 108 taught by Professor Gries during the Fall '08 term at University of Toronto- Toronto.
- Fall '08