PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science

Size: px
Start display at page:

Download "PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science"

Transcription

1 PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science APRIL 2010 EXAMINATIONS CSC 108 H1S Instructors: Horton Duration 3 hours PLEASE HAND IN Examination Aids: None Student Number: Family Name(s): Given Name(s): Do not turn this page until you have received the signal to start. In the meantime, please read the instructions below carefully. # 1: / 7 # 2: / 6 This final examination paper consists of 10 questions on 20 pages (including this one). When you receive the signal to start, please make sure that your copy of the final examination 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. You do not need to put import statements in your answers. You may not use break or continue on this exam. If you use any space for rough work, indicate clearly what you want marked. Assume all input is valid unless otherwise indicated; there is no need to error-check. # 3: / 6 # 4: /12 # 5: / 6 # 6: /18 # 7: / 7 # 8: / 6 # 9: /10 # 10: / 8 TOTAL: /86 Page 1 of 20 Good Luck! cont d...

2 Question 1. Part (a) [7 marks] [3 marks] Write the following function, according to its docstring: def flip_lists(l): L is a list of 2-element lists. Reverse the order of the elements in the sublists of L. Part (b) [4 marks] Write the following function, according to its docstring: def valid_sizes(l, a, b): L is a list of lists; a and b are ints; a <= b. Return True iff each sublist has size between a and b inclusive. Page 2 of 20 Student #: cont d...

3 Question 2. [6 marks] Write the following function, according to its docstring: def interleave(s1, s2): Return a new string that contains the characters of string s1 and string s2 "interleaved" so that it contains the first character of s1, the first character of s2, the second character of s1, the second character of s2, etc. If one string is longer than the other, the "extra" characters are added on at the end. For example, interleave("ab", "12345") returns "a1b2345". Page 3 of 20 Student #: cont d...

4 Question 3. [6 marks] The left-hand column in the table below shows a series of code fragments to be interpreted by the Python shell. For each, show the expected output in the right-hand column; if it would generate an error say so, and give the reason why. Hint: Use the memory model to predict what will happen. The next page is provided for your rough work. Code x = (1, 2, 3) for item in x: item = item + 1 print x x = (1, 2, 3) for i in range(len(x)): x[i] = x[i] + 1 print x x = ([1, 2], [], [8, 9, 3]) for item in x: item.append(5) print x x = [6, 7, 8] for item in x: item = item + 1 print x x = [6, 7, 8] for i in range(len(x)): x[i] = x[i] + 1 print x x = [[1, 2], [], [8, 9, 3]] for item in x: item.append(5) print x Output (or error plus reason) Page 4 of 20 Student #: cont d...

5 Use the space below for rough work. This page will not be marked. Page 5 of 20 Student #: cont d...

6 Question 4. [12 marks] Below are several functions that attempt to return True iff the given string has two characters in a row that are the same. For each version, indicate whether or not the function works. If it does not, write a call to the function that demonstrates one case where it fails (i.e., the return value is incorrect or the function generates an error), and state what happens. Part (a) [3 marks] def doubles1(s): answer = False previous = s[0] for char in s: if char == previous: answer = True previous = char return answer Does the function work (circle one)?: works doesn t work If it doesn t work, a call to the function that demonstrates this: and the outcome of that call (circle one): incorrect return value error Part (b) [3 marks] def doubles2(s): if s == "": return False else: answer = False previous = s[0] for char in s: if char == previous: answer = True previous = char return answer Does the function work (circle one)?: works doesn t work If it doesn t work, a call to the function that demonstrates this: and the outcome of that call (circle one): incorrect return value error Page 6 of 20 Student #: cont d...

7 Part (c) [3 marks] def doubles3(s): answer = False if s == "": return False else: answer = False previous = s[0] i = 1 while i < len(s): if s[i] == previous: answer = True previous = s[i] i = i + 1 return answer Does the function work (circle one)?: works doesn t work If it doesn t work, a call to the function that demonstrates this: and the outcome of that call (circle one): incorrect return value error Part (d) [3 marks] def doubles4(s): answer = False i = 0 while i < len(s): if s[i] == s[i + 1]: answer = True i = i + 1 return answer Does the function work (circle one)?: works doesn t work If it doesn t work, a call to the function that demonstrates this: and the outcome of that call (circle one): incorrect return value error Page 7 of 20 Student #: cont d...

8 Question 5. [6 marks] Suppose we record information about students in a dictionary, where each key is student number (an int), and its value is a dictionary of information about that student. These inner dictionaries are structured like this: {"gpa": 3.95, "name": "Lucia", "campus": "stg"}. Suppose also that we have put the students into groups for a project, and that we keep track of the groups in a list of lists, where each inner list contains the student numbers of the members of one group. Write the following function according to its docstring: def describe_groups(groups, students): For each group, print the group size, average GPA, and the number of stg students. groups is a list, and students is a dict, as described above. Page 8 of 20 Student #: cont d...

9 Question 6. [18 marks] Students in my other course, csc343, get 3 grace days (sorry about that!). For each assignment, I have a file with the grades and information about grace day ussage. Here is the beginning of the Assignment 1 file: * CSC343H1S 20101: Assignment 1 marks for Horton s section A1 / 75 A1grace / ,Simpson,Homer,65, ,Kent,Clark,36, ,Horton,Diane,47, ,Flintstone,Wilma,70, ,Rubble,Barney,55,2 The first several lines are a header with information that is irrelevant to this question and will therefore need to be skipped over. The number of lines in the header is unknown; it ends with a blank line. The remaining lines have the following components, separated by commas: a nine-digit student number family name, which might include blanks first names, which might include blanks assignment grade (between 0 and 100) number of grade days used (between 0 and 3) The list of students may not be exactly the same from one assignment file to another, since students can add and drop courses. Your job is to write a program that will read my grades files a1.txt, a2.txt, and a3.txt and print the student number (one per line) of every student who has used more than three grace days in total. Your program will build and use a dictionary where each key is a student number, and its value is the number of grace days used by that student. The dictionary will start out empty, and each file you read will update it. You will write three helper functions and then the main block. Wherever appropriate, you should call functions from earlier parts of the question in your solutions for later parts, even if you haven t written them. Just assume they work. Page 9 of 20 Student #: cont d...

10 Part (a) [3 marks] Write this helper function, according to its docstring. def skip_header(r): r is an open reader for a grade file (in which nothing has been read yet). Skip past the header and the blank line, so that the next line to be read is the first line of student data. Part (b) [7 marks] Write this helper function, according to its docstring. def add_grace(r, grace_used): r is an open reader for a grade file (in which nothing has been read yet). grace_used is a dict whose keys are student numbers (as strings) and whose values are ints indicating the number of grace days used by a student. Read the grace day usage information in r and update grace_used for each student encountered in r. If a student is not in the dict, add him or her. Page 10 of 20 Student #: cont d...

11 Part (c) [3 marks] Write this helper function, according to its docstring. def print_overused(grace_used, limit): grace_used is a dict whose keys are student numbers (as strings) and whose values are ints indicating the number of grace days used by a student. Print, one per line, the student number of every student whose number of grace days used exceeds limit (an int). Part (d) [5 marks] Write the main block (including its if statement), so that the program accomplishes what was described in the question. Page 11 of 20 Student #: cont d...

12 Question 7. [7 marks] Below is the outline of a program for keeping track of your DVDs. Its main block will use a variable called dvds to store information about them. You have three tasks: 1. Complete the main loop so that it calls the appropriate function from the main_choices dictionary. Note that all these functions need one argument: dvds. 2. Modify the program as appropriate so that it initializes the variable dvds by loading it from a cpickle file called data.pkl, if that file exists. If not, it should initialize dvds to be an empty dictionary. Recall that you can use os.path.exists( data.pkl ) to see if file data.pkl exists. 3. Modify the program as so that right before it ends, it saves the contents of variable dvds in a cpickle file called data.pkl. You may add, delete or change existing code. If your new code won t fit in the space available, use arrows to point to where the pieces should go. import easygui, cpickle, sys, os # Definitions of functions acquire_dvd, list_dvds, lend_dvd and return_dvd # omitted to save space. def quit(dvds): sys.exit() if name == main : main_choices = {"lend" : lend_dvd, "return" : return_dvd, "acquire": acquire_dvd, "list": list_dvds, "quit": quit} while 1: choice = easygui.buttonbox("action", "DVD library", main_choices.keys()) # Make sure the user chose something. if choice: Page 12 of 20 Student #: cont d...

13 Question 8. [6 marks] Don t guess. There is a 1-mark deduction for wrong answers on this question. Part (a) [2 marks] def f1(l): sum = 0 for item in L: for i in range(1, 101): if item >= i: sum = sum + 1 return sum Let n be the size of the list L passed to this function. Which of the following most accurately describes how the runtime of this function grow as n grows? Circle one. (a) It grows linearly, like n does. (c) It grows less than linearly. (b) It grows quadratically, like n 2 does. (d) It grows more than quadratically. Part (b) [2 marks] def f2(l): sum = 0 i = 1 while i < len(l): sum = sum + L[i] i = i * 2 return sum Let n be the size of the list L passed to this function. Which of the following most accurately describes how the runtime of this function grow as n grows? Circle one. (a) It grows linearly, like n does. (c) It grows less than linearly. (b) It grows quadratically, like n 2 does. (d) It grows more than quadratically. Part (c) [2 marks] def f3(l): for i in range(len(l)): L[i] = L[i] + 1 sum = 0 for item in L: sum = sum + item return sum Let n be the size of the list L passed to this function. Which of the following most accurately describes how the runtime of this function grow as n grows? Circle one. (a) It grows linearly, like n does. (c) It grows less than linearly. (b) It grows quadratically, like n 2 does. (d) It grows more than quadratically. Page 13 of 20 Student #: cont d...

14 Question 9. [10 marks] Consider the following class: class AcademicHistory( builtin.object) A student s academic history. Methods defined here: cmp (self, other) Return -1 if this student s average is lower than other s, +1 if it is higher, and 0 if they are equal. init (self, stnum, family_name, first_name) A new academic history for the student with student number stnum (an int), and the given family_name and first_name (strs). str (self) Return a str with the student s student number, name, course results, and average grade. average(self) Return the average grade (a float) among this student s completed courses. complete(self, course, grade) Record the fact that the student completed this course (a str) with this grade (an int). Page 14 of 20 Student #: cont d...

15 Part (a) [7 marks] 1. Create an AcademicHistory for a student named Nora Kingston, and make variable nora refer to it. Record the fact that she completed CSC108 with a grade of Which method does the above code call without mentioning it by name? 3. Without calling any AcademicHistory method by name, print out Nora s academic history. 4. Suppose you have a second AcademicHistory called balraj. Write a loop that will record the fact that Balraj earned 100 in each of these courses: HIS150, MUS100 and POL Write a single line of code that will cause str to be called without mentioning it by name. Part (b) [3 marks] Complete the following function according to its docstring description. def best_student(l): L is a non-empty list of AcacemicHistories. Return the student number of the one with the highest average. Page 15 of 20 Student #: cont d...

16 Question 10. [8 marks] Throughout this question, assume that we are sorting lists into non-descending order. Do not guess. There is a one-mark deduction for incorrect answers. Part (a) [2 marks] Consider the following lists: L1 = [9, 8, 7, 6, 5, 4, 3, 2, 1] and L2 = [8, 1, 3, 6, 9, 7, 4, 2, 5] Which list would cause bubblesort to do more swaps? Circle one answer. L1 L2 they would both require an equal number of swaps Part (b) [2 marks] Suppose you have a list of 100 elements. Is it possible that if you call bubblesort on it, no items will move? Circle one. yes no Part (c) [2 marks] Consider a list of 100 distinct numbers in order from largest to smallest, in other words, backwards to the order we want. Which sorting technique would cause items to be moved more times, if called on this list? Circle one. selection sort insertion sort Part (d) [2 marks] We are partly through sorting a list, and have completed 4 passes through the data. The list currently contains [9, 12, 42, 59, 2, 99, 10, 60] Which sorting technique are we definitely not using. Circle one. selection sort insertion sort Page 16 of 20 Student #: cont d...

17 [Use the space below for rough work. This page will not be marked, unless you clearly indicate the part of your work that you want us to mark.] Page 17 of 20 Student #: cont d...

18 [Use the space below for rough work. This page will not be marked, unless you clearly indicate the part of your work that you want us to mark.] Page 18 of 20 Student #: cont d...

19 Short Python function/method descriptions: builtins : len(x) -> integer Return the length of the list, tuple, dict, or string x. max(l) -> value Return the largest value in L. min(l) -> value Return the smallest value in L. open(name[, mode]) -> file object Open a file. Legal modes are "r" (read), "w" (write), and "a" (append). range([start], stop, [step]) -> list of integers Return a list containing the integers starting with start and ending with stop - 1 with step specifying the amount to increment (or decrement). If start is not specified, the list starts at 0. If step is not specified, the values are incremented by 1. cpickle: dump(obj, file) Write an object in pickle format to the given file. load(file) --> object Load a pickle from the given file dict: D[k] --> value Return the value associated with the key k in D. k in d --> boolean Return True if k is a key in D and False otherwise. D.get(k) -> value Return D[k] if k in D, otherwise return None. D.keys() -> list of keys Return the keys of D. D.values() -> list of values Return the values associated with the keys of D. D.items() -> list of (key, value) pairs Return the (key, value) pairs of D, as 2-tuples. file (also called a "reader"): F.close() Close the file. F.read([size]) -> read at most size bytes, returned as a string. If the size argument is negative or omitted, read until EOF (End of File) is reached. F.readline([size]) -> next line from the file, as a string. Retain newline. A non-negative size argument limits the maximum number of bytes to return (an incomplete line may be returned then). Return an empty string at EOF. float: float(x) -> floating point number Convert a string or number to a floating point number, if possible. int: int(x) -> integer Convert a string or number to an integer, if possible. A floating point argument will be truncated towards zero. list: x in L --> boolean Return True if x is in L and False otherwise. L.append(x) Append x to the end of the list L. Page 19 of 20 Student #: cont d...

20 L.index(value) -> integer Returns the lowest index of value in L. L.insert(index, x) Insert x at position index. L.remove(value) Removes the first occurrence of value from L. L.reverse() Reverse *IN PLACE* L.sort() Sorts the list in ascending order. str: x in s --> boolean Return True if x is in s and False otherwise. str(x) -> string Convert an object into its string representation, if possible. S.find(sub[,i]) -> integer Return the lowest index in S (starting at S[i], if i is given) where the string sub is found or -1 if sub does not occur in S. S.index(sub) -> integer Like find but raises an exception if sub does not occur in S. S.isdigit() -> boolean Return True if all characters in S are digits and False otherwise. S.lower() -> string Return a copy of the string S converted to lowercase. S.lstrip([chars]) -> string Return a copy of the string S with leading whitespace removed. If chars is given and not None, remove characters in chars instead. S.replace(old, new) -> string Return a copy of string S with all occurrences of the string old replaced with the string new. S.rstrip([chars]) -> string Return a copy of the string S with trailing whitespace removed. If chars is given and not None, remove characters in chars instead. S.split([sep]) -> list of strings Return a list of the words in S, using string sep as the separator and any whitespace string if sep is not specified. S.strip() -> string Return a copy of S with leading and trailing whitespace removed. S.upper() -> string Return a copy of the string S converted to uppercase. Total Marks = 86 Page 20 of 20 Student #: End of Final Examination

PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science

PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science SUMMER 2012 EXAMINATIONS CSC 108 H1Y Instructors: Janicki Duration NA PLEASE HAND IN Examination Aids: None Student Number: Family Name(s):

More information

PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science

PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science DECEMBER 2009 EXAMINATIONS CSC 108 H1F Instructors: Gries, Horton, Zingaro Duration 3 hours PLEASE HAND IN Examination Aids: None Student

More information

PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science

PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science APRIL 2012 EXAMINATIONS CSC 108 H1S Instructors: Campbell Duration 3 hours PLEASE HAND IN Examination Aids: None Student Number: Family

More information

PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science

PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science DECEMBER 2013 EXAMINATIONS CSC 108 H1F Instructors: Craig and Gries Duration 3 hours PLEASE HAND IN Examination Aids: None Student Number:

More information

PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science

PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science APRIL/MAY 2009 EXAMINATIONS CSC 108H1S Instructor: Horton Duration 3 hours PLEASE HAND IN Examination Aids: None Student Number: Last (Family)

More information

Question 1. December 2009 Final Examination Marking Scheme CSC 108 H1F

Question 1. December 2009 Final Examination Marking Scheme CSC 108 H1F Question 1. [10 marks] Below are five segments of code. Each one runs without error. To the right of each segment, show the output it generates. L = [1, 2, 3, 4] for item in L: item = item * 5 print L

More information

CSC148 Fall 2017 Ramp Up Session Reference

CSC148 Fall 2017 Ramp Up Session Reference Short Python function/method descriptions: builtins : input([prompt]) -> str Read a string from standard input. The trailing newline is stripped. The prompt string, if given, is printed without a trailing

More information

Question 1. Part (a) Part (b) December 2013 Final Examination Marking Scheme CSC 108 H1F. [13 marks] [4 marks] Consider this program:

Question 1. Part (a) Part (b) December 2013 Final Examination Marking Scheme CSC 108 H1F. [13 marks] [4 marks] Consider this program: Question 1. Part (a) [4 marks] Consider this program: [13 marks] def square(x): (number) -> number Write what this program prints, one line per box. There are more boxes than you need; leave unused ones

More information

UNIVERSITY OF TORONTO SCARBOROUGH. December 2017 EXAMINATIONS. CSCA20H3 Duration 3 hours. Examination Aids: Instructor: Bretscher

UNIVERSITY OF TORONTO SCARBOROUGH. December 2017 EXAMINATIONS. CSCA20H3 Duration 3 hours. Examination Aids: Instructor: Bretscher PLEASE HAND IN UNIVERSITY OF TORONTO SCARBOROUGH December 2017 EXAMINATIONS CSCA20H3 Duration 3 hours PLEASE HAND IN Examination Aids: None Student Number: Last (Family) Name(s): First (Given) Name(s):

More information

UNIVERSITY OF TORONTO SCARBOROUGH. Wnter 2016 EXAMINATIONS. CSC A20H Duration 2 hours 45 mins. No Aids Allowed

UNIVERSITY OF TORONTO SCARBOROUGH. Wnter 2016 EXAMINATIONS. CSC A20H Duration 2 hours 45 mins. No Aids Allowed Student Number: Last Name: First Name: UNIVERSITY OF TORONTO SCARBOROUGH Wnter 2016 EXAMINATIONS CSC A20H Duration 2 hours 45 mins No Aids Allowed Do not turn this page until you have received the signal

More information

Student Number: Comments are not required except where indicated, although they may help us mark your answers.

Student Number: Comments are not required except where indicated, although they may help us mark your answers. CSC 108H5 F 2018 Midterm Test Duration 90 minutes Aids allowed: none Student Number: utorid: Last Name: First Name: Do not turn this page until you have received the signal to start. (Please fill out the

More information

Do not turn this page until you have received the signal to start. In the meantime, please read the instructions below carefully.

Do not turn this page until you have received the signal to start. In the meantime, please read the instructions below carefully. UNIVERSITY OF TORONTO MISSISSAUGA DECEMBER 2014 FINAL EXAMINATION CSC108H5F Instructor: Zingaro, Petersen, Tong Duration: 3 hours Examination Aids: None Student Number: Family Name(s): Given Name(s): The

More information

UNIVERSITY OF TORONTO Faculty of Arts and Science APRIL 2014 EXAMINATIONS. CSC 108 H1S Instructors: Campbell and Papadopoulou.

UNIVERSITY OF TORONTO Faculty of Arts and Science APRIL 2014 EXAMINATIONS. CSC 108 H1S Instructors: Campbell and Papadopoulou. PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science APRIL 2014 EXAMINATIONS CSC 108 H1S Instructors: Campbell and Papadopoulou Duration 3 hours PLEASE HAND IN Examination Aids: None Student

More information

Student Number: Comments are not required except where indicated, although they may help us mark your answers.

Student Number: Comments are not required except where indicated, although they may help us mark your answers. CSC 108H5 F 2014 Midterm Test Duration 50 minutes Aids allowed: none Last Name: Student Number: First Name: Lecture Section: L0101 Instructor: Dan Zingaro (9:00-10:00) Lecture Section: L0102 Instructor:

More information

Student Number: Instructor: Brian Harrington

Student Number: Instructor: Brian Harrington CSC A08 2012 Midterm Test Duration 50 minutes Aids allowed: none Last Name: Student Number: First Name: Instructor: Brian Harrington Do not turn this page until you have received the signal to start. (Please

More information

PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science

PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science APRIL 2016 EXAMINATIONS CSC 108 H1S Instructor(s): Smith and Fairgrieve Duration 3 hours PLEASE HAND IN No Aids Allowed You must earn at

More information

PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science

PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science APRIL 2015 EXAMINATIONS CSC 108 H1S Instructor: Fairgrieve and Hagerman Duration 3 hours PLEASE HAND IN Examination Aids: None You must

More information

UTORid: Lecture Section: (circle one): L0101 (MWF10) L0201 (MWF11) Instructor: Jacqueline Smith Jen Campbell

UTORid: Lecture Section: (circle one): L0101 (MWF10) L0201 (MWF11) Instructor: Jacqueline Smith Jen Campbell CSC 108H1 F 2017 Midterm Test Duration 50 minutes Aids allowed: none Last Name: UTORid: First Name: Lecture Section: (circle one): L0101 (MWF10) L0201 (MWF11) Instructor: Jacqueline Smith Jen Campbell

More information

Short Python function/method descriptions:

Short Python function/method descriptions: Last Name First Name Student#. Short Python function/method descriptions: builtins : len(x) -> integer Return the length of the list, tuple, dict, or string x. max(l) -> value Return the largest value

More information

Do not turn this page until you have received the signal to start.

Do not turn this page until you have received the signal to start. CSCA08 Fall 2014 Final Exam Duration 160 minutes Aids allowed: none Student Number: A Instructor: Brian Harrington Last Name: First Name: UtorID (Markus Login): Do not turn this page until you have received

More information

PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science

PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science DECEMBER 2016 EXAMINATIONS CSC 108 H1F Instructor(s): Smith, Gries, de Lara Duration 3 hours PLEASE HAND IN No Aids Allowed You must earn

More information

Do not turn this page until you have received the signal to start.

Do not turn this page until you have received the signal to start. CSCA48 Fall 2015 Final Exam Duration 150 minutes Aids allowed: none Student Number: Instructor: Brian Harrington and Anna Bretscher Last Name: First Name: UtorID (Markus Login): Do not turn this page until

More information

Short Python function/method descriptions:

Short Python function/method descriptions: Last Name First Name Student#. Short Python function/method descriptions: builtins : len(x) -> integer Return the length of the list, tuple, dict, or string x. max(l) -> value Return the largest value

More information

UNIVERSITY OF TORONTO Faculty of Arts and Science DECEMBER 2017 EXAMINATIONS. CSC 108 H1F Instructor(s): Campbell, Fairgrieve, and Smith

UNIVERSITY OF TORONTO Faculty of Arts and Science DECEMBER 2017 EXAMINATIONS. CSC 108 H1F Instructor(s): Campbell, Fairgrieve, and Smith PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science DECEMBER 2017 EXAMINATIONS CSC 108 H1F Instructor(s): Campbell, Fairgrieve, and Smith Duration 3 hours PLEASE HAND IN No Aids Allowed You

More information

Good Luck! CSC207, Fall 2012: Quiz 1 Duration 25 minutes Aids allowed: none. Student Number:

Good Luck! CSC207, Fall 2012: Quiz 1 Duration 25 minutes Aids allowed: none. Student Number: CSC207, Fall 2012: Quiz 1 Duration 25 minutes Aids allowed: none Student Number: Last Name: Lecture Section: L0101 First Name: Instructor: Horton Please fill out the identification section above as well

More information

CSC A20H3 S 2011 Test 1 Duration 90 minutes Aids allowed: none. Student Number:

CSC A20H3 S 2011 Test 1 Duration 90 minutes Aids allowed: none. Student Number: CSC A20H3 S 2011 Test 1 Duration 90 minutes Aids allowed: none Last Name: Lecture Section: L0101 Student Number: First Name: Instructor: Bretscher Do not turn this page until you have received the signal

More information

Do not turn this page until you have received the signal to start.

Do not turn this page until you have received the signal to start. CSCA48 Winter 2015 Midterm Exam Duration 100 minutes Aids allowed: none Student Number: Instructors: Anna Bretscher & Brian Harrington Last Name: First Name: UtorID (Markus Login): Please place a checkmark

More information

PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science

PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science APRIL 2017 EXAMINATIONS CSC 104 H1S Instructor(s): G. Baumgartner Duration 3 hours PLEASE HAND IN No Aids Allowed Student Number: Last (Family)

More information

Do not turn this page until you have received the signal to start.

Do not turn this page until you have received the signal to start. CSCA08 Fall 2015 Term Test #2 Duration 110 minutes Aids allowed: none Last Name: Student Number: Markus Login: First Name: Please place a checkmark ( ) beside your tutorial session Tutorial Number Date/Time

More information

PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science

PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science AUGUST EXAMINATIONS CSC 108H1Y Instructor: Daniel Zingaro Duration three hours PLEASE HAND IN Examination Aids: None. Student Number: Last

More information

CSC 108H1 F 2009 Test 1 Duration 35 minutes Aids allowed: none. Student Number:

CSC 108H1 F 2009 Test 1 Duration 35 minutes Aids allowed: none. Student Number: CSC 108H1 F 2009 Test 1 Duration 35 minutes Aids allowed: none Last Name: Student Number: First Name: Lecture Section: L0102 Instructor: Gries Do not turn this page until you have received the signal to

More information

Question 1. Part (a) Part (b) Part (c) April 2015 Final Examination Solutions CSC 108 H1S. [16 marks] [3 marks]

Question 1. Part (a) Part (b) Part (c) April 2015 Final Examination Solutions CSC 108 H1S. [16 marks] [3 marks] Question 1. Part (a) [3 marks] [16 marks] Consider this Python code: L = [8, 12, 3] X = L.sort() Y = L[:] L.extend([1]) Write what this code prints when run, with one line per box. There may be more boxes

More information

UNIVERSITY OF TORONTO Faculty of Arts and Science

UNIVERSITY OF TORONTO Faculty of Arts and Science UNIVERSITY OF TORONTO Faculty of Arts and Science Midterm 2 s CSC148H1F Duration: 50 min. Instructors: Diane Horton, David Liu. Examination Aids: Provided aid sheet Name: Student Number: Please read the

More information

CS 1110 Prelim 2 April 26th, 2016

CS 1110 Prelim 2 April 26th, 2016 Circle your lab/situation: CS 1110 Prelim 2 April 26th, 2016 ACCEL: Tue 12:20 Tue 1:25 Tue 2:30 Tue 3:35 ACCEL : Wed 10:10 Wed 11:15 Wed 12:20 Wed 1:25 Wed 2:30 Wed 3:35 PHILLIPS : Tue 12:20 Tue 1:25 Wed

More information

UNIVERSITY OF TORONTO SCARBOROUGH. Fall 2015 EXAMINATIONS. CSC A20H Duration 3 hours. No Aids Allowed

UNIVERSITY OF TORONTO SCARBOROUGH. Fall 2015 EXAMINATIONS. CSC A20H Duration 3 hours. No Aids Allowed Student Number: Last Name: First Name: UNIVERSITY OF TORONTO SCARBOROUGH Fall 2015 EXAMINATIONS CSC A20H Duration 3 hours No Aids Allowed Do not turn this page until you have received the signal to start.

More information

Do not turn this page until you have received the signal to start. In the meantime, please read the instructions below carefully.

Do not turn this page until you have received the signal to start. In the meantime, please read the instructions below carefully. CSC 148 H1 / L0101 Term Test # 2 13 March 2013 Duration: Aids Allowed: 50 minutes None Student Number: Last (Family) Name(s): First (Given) Name(s): Do not turn this page until you have received the signal

More information

UNIVERSITY OF TORONTO Faculty of Arts and Science. Midterm Sample Solutions CSC324H1 Duration: 50 minutes Instructor(s): David Liu.

UNIVERSITY OF TORONTO Faculty of Arts and Science. Midterm Sample Solutions CSC324H1 Duration: 50 minutes Instructor(s): David Liu. UNIVERSITY OF TORONTO Faculty of Arts and Science Midterm Sample s CSC324H1 Duration: 50 minutes Instructor(s): David Liu. No Aids Allowed Name: Student Number: Please read the following guidelines carefully.

More information

PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science

PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science APRIL 2015 EXAMINATIONS CSC 343 H1S Instructor: Horton and Liu Duration 3 hours PLEASE HAND IN Examination Aids: None Student Number: Family

More information

Chapter 1 Summary. Chapter 2 Summary. end of a string, in which case the string can span multiple lines.

Chapter 1 Summary. Chapter 2 Summary. end of a string, in which case the string can span multiple lines. Chapter 1 Summary Comments are indicated by a hash sign # (also known as the pound or number sign). Text to the right of the hash sign is ignored. (But, hash loses its special meaning if it is part of

More information

CSC 108H1 F 2010 Test 1 Duration 45 minutes Aids allowed: none. Student Number:

CSC 108H1 F 2010 Test 1 Duration 45 minutes Aids allowed: none. Student Number: CSC 108H1 F 2010 Test 1 Duration 45 minutes Aids allowed: none Last Name: Lecture Section: L0101 Student Number: First Name: Instructors: Horton and Engels Do not turn this page until you have received

More information

Do not turn this page until you have received the signal to start. In the meantime, please read the instructions below carefully.

Do not turn this page until you have received the signal to start. In the meantime, please read the instructions below carefully. CSC A48 Winter 2014 CSCA48 Final Exam 23 April 2014 Duration: Aids Allowed: 150 minutes None Student Number: UTORid: Last (Family) Name(s): First (Given) Name(s): Do not turn this page until you have received

More information

You may not share any information or materials with classmates during the exam and you may not use any electronic devices.

You may not share any information or materials with classmates during the exam and you may not use any electronic devices. ICS 31 UC IRVINE WINTER 2014 DAVID G. KAY Second Midterm YOUR NAME YOUR LAB: YOUR STUDENT ID (8 DIGITS) SECTION (1 TO 9) ******************** YOUR UCINET ID TIME MWF AT: 8 10 12 2 4 6 ****** K E Y ******

More information

CIS192 Python Programming

CIS192 Python Programming CIS192 Python Programming Data Types Joseph Cappadona University of Pennsylvania September 03, 2015 Joseph Cappadona (University of Pennsylvania) CIS 192 September 03, 2015 1 / 32 Outline 1 Data Types

More information

CS150 Sample Final. Name: Section: A / B

CS150 Sample Final. Name: Section: A / B CS150 Sample Final Name: Section: A / B Date: Start time: End time: Honor Code: Signature: This exam is closed book, closed notes, closed computer, closed calculator, etc. You may only use (1) the final

More information

ICS 31 UC IRVINE. ############## YOUR UCINET #### K E Y #### ############## Second Midterm YOUR NAME YOUR STUDENT ID (8 DIGITS)

ICS 31 UC IRVINE. ############## YOUR UCINET #### K E Y #### ############## Second Midterm YOUR NAME YOUR STUDENT ID (8 DIGITS) ICS 31 UC IRVINE SPRING 2017 DAVID G. KAY YOUR NAME YOUR STUDENT ID (8 DIGITS) ############## YOUR UCINET ID @UCI.EDU #### K E Y #### ############## Second Midterm You have 75 minutes (until the end of

More information

CIS192: Python Programming Data Types & Comprehensions Harry Smith University of Pennsylvania September 6, 2017 Harry Smith (University of Pennsylvani

CIS192: Python Programming Data Types & Comprehensions Harry Smith University of Pennsylvania September 6, 2017 Harry Smith (University of Pennsylvani CIS192: Python Programming Data Types & Comprehensions Harry Smith University of Pennsylvania September 6, 2017 Harry Smith (University of Pennsylvania) CIS 192 Fall Lecture 2 September 6, 2017 1 / 34

More information

\n is used in a string to indicate the newline character. An expression produces data. The simplest expression

\n is used in a string to indicate the newline character. An expression produces data. The simplest expression Chapter 1 Summary Comments are indicated by a hash sign # (also known as the pound or number sign). Text to the right of the hash sign is ignored. (But, hash loses its special meaning if it is part of

More information

CS150 Sample Final Solution

CS150 Sample Final Solution CS150 Sample Final Solution Name: Section: A / B Date: Start time: End time: Honor Code: Signature: This exam is closed book, closed notes, closed computer, closed calculator, etc. You may only use (1)

More information

Python allows variables to hold string values, just like any other type (Boolean, int, float). So, the following assignment statements are valid:

Python allows variables to hold string values, just like any other type (Boolean, int, float). So, the following assignment statements are valid: 1 STRINGS Objectives: How text data is internally represented as a string Accessing individual characters by a positive or negative index String slices Operations on strings: concatenation, comparison,

More information

Do not turn this page until you have received the signal to start. In the meantime, please read the instructions below carefully.

Do not turn this page until you have received the signal to start. In the meantime, please read the instructions below carefully. CSC 165 H1 Term Test 2 / L5101 Fall 2011 Duration: Aids Allowed: 60 minutes none Student Number: Family Name(s): Given Name(s): Do not turn this page until you have received the signal to start. In the

More information

>>> print( X ) [0,1,2,3] def mystery(l):??

>>> print( X ) [0,1,2,3] def mystery(l):?? REVIEW EXERCISES Problem 4 What is the output of the following script? Disclaimer. I cannot guarantee that the exercises of the final exam are going to look like this. Also, for the most part, the exercises

More information

CS 1301 Exam 1 Fall 2010

CS 1301 Exam 1 Fall 2010 CS 1301 Exam 1 Fall 2010 Name : Grading TA: Integrity: By taking this exam, you pledge that this is your work and you have neither given nor received inappropriate help during the taking of this exam in

More information

UNIVERSITY OF TORONTO Faculty of Arts and Science

UNIVERSITY OF TORONTO Faculty of Arts and Science UNIVERSITY OF TORONTO Faculty of Arts and Science Midterm 1 s CSC148H1F Duration: 50 min. Instructors: Diane Horton, David Liu. Examination Aids: Provided aid sheet Name: Student Number: Please read the

More information

Module 07: Efficiency

Module 07: Efficiency Module 07: Efficiency Topics: Basic introduction to run-time efficiency Analyzing recursive code Analyzing iterative code 1 Consider the following two ways to calculate the maximum of a nonempty list.

More information

CS 1110 Prelim 1, March 2018

CS 1110 Prelim 1, March 2018 Last Name: First Name: Cornell NetID, all caps: CS 1110 Prelim 1, March 2018 This 90-minute exam has 7 questions worth a total of 69 points. You may separate the pages while working on the exam; we have

More information

Midterm #1 Fall minutes

Midterm #1 Fall minutes 15-112 Midterm #1 Fall 2014 80 minutes Name: Andrew ID: @andrew.cmu.edu Section: INSTRUCTIONS You may not use any books, notes, or electronic devices during this exam. You may not ask questions about the

More information

CSCA20 Worksheet Strings

CSCA20 Worksheet Strings 1 Introduction to strings CSCA20 Worksheet Strings A string is just a sequence of characters. Why do you think it is called string? List some real life applications that use strings: 2 Basics We define

More information

CS 1110 Final Exam May 9th, 2013 SOLUTIONS

CS 1110 Final Exam May 9th, 2013 SOLUTIONS Last Name: UTION First Name: SOL Cornell NetID, all caps: SU1110 CS 1110 Final Exam May 9th, 2013 SOLUTIONS This 150-minute exam has 7 questions worth a total of 53 points. When permitted to begin, scan

More information

CS 1110 Final, May 2017

CS 1110 Final, May 2017 Last Name: First Name: Cornell NetID, all caps: CS 1110 Final, May 2017 This 150-minute exam has 9 questions worth a total of 117 points. You may separate the pages while working on the exam; we have a

More information

Spring 2017 CS 1110/1111 Exam 1

Spring 2017 CS 1110/1111 Exam 1 CS 1110/1111 Spring 2017 Exam 1 page 1 of 6 Spring 2017 CS 1110/1111 Exam 1 Bubble in your computing ID in the footer of this page. We use an optical scanner to read it, so fill in the bubbles darkly.

More information

CS 1110 Regular Prelim 1, March 14th, 2017

CS 1110 Regular Prelim 1, March 14th, 2017 Last Name: First Name: Cornell NetID, all caps: CS 1110 Regular Prelim 1, March 14th, 2017 This 90-minute exam has 9 questions worth a total of 104 points. You may tear the pages apart; we have a stapler

More information

CS 2316 Exam 1 Spring 2014

CS 2316 Exam 1 Spring 2014 CS 2316 Exam 1 Spring 2014 Name : Grading TA: Integrity: By taking this exam, you pledge that this is your work and you have neither given nor received inappropriate help during the taking of this exam

More information

Midterm I Practice Problems

Midterm I Practice Problems 15-112 Midterm I Practice Problems Name: Section: andrewid: This PRACTICE midterm is not meant to be a perfect representation of the upcoming midterm! You are responsible for knowing all material covered

More information

Midterm Exam 2B Answer key

Midterm Exam 2B Answer key Midterm Exam 2B Answer key 15110 Principles of Computing Fall 2015 April 6, 2015 Name: Andrew ID: Lab section: Instructions Answer each question neatly in the space provided. There are 6 questions totaling

More information

SQL: Data Definition Language. csc343, Introduction to Databases Diane Horton Fall 2017

SQL: Data Definition Language. csc343, Introduction to Databases Diane Horton Fall 2017 SQL: Data Definition Language csc343, Introduction to Databases Diane Horton Fall 2017 Types Table attributes have types When creating a table, you must define the type of each attribute. Analogous to

More information

Duration: 90 minutes. Page 1 of 14 Q2: /13 Q3: /13 TOTAL: /38. Bonus /1

Duration: 90 minutes. Page 1 of 14 Q2: /13 Q3: /13 TOTAL: /38. Bonus /1 CSCA48 Winter 2018 Term Test #2 Duration: 90 minutes Aids Allowed: none First Name: Student Number: Markus Login: Last Name: Carefully read and follow all instructions on this page, and fill in all fields.

More information

CS 1110 Prelim 1 March 15th, 2016

CS 1110 Prelim 1 March 15th, 2016 Circle your lab/situation: CS 1110 Prelim 1 March 15th, 2016 ACCEL: Tue 12:20 Tue 1:25 Tue 2:30 Tue 3:35 ACCEL : Wed 10:10 Wed 11:15 Wed 12:20 Wed 1:25 Wed 2:30 Wed 3:35 PHILLIPS : Tue 12:20 Tue 1:25 Wed

More information

Basic Scripting, Syntax, and Data Types in Python. Mteor 227 Fall 2017

Basic Scripting, Syntax, and Data Types in Python. Mteor 227 Fall 2017 Basic Scripting, Syntax, and Data Types in Python Mteor 227 Fall 2017 Basic Shell Scripting/Programming with Python Shell: a user interface for access to an operating system s services. The outer layer

More information

Programming. We will be introducing various new elements of Python and using them to solve increasingly interesting and complex problems.

Programming. We will be introducing various new elements of Python and using them to solve increasingly interesting and complex problems. Plan for the rest of the semester: Programming We will be introducing various new elements of Python and using them to solve increasingly interesting and complex problems. We saw earlier that computers

More information

CS2304: Python for Java Programmers. CS2304: Sequences and Collections

CS2304: Python for Java Programmers. CS2304: Sequences and Collections CS2304: Sequences and Collections Sequences In Python A sequence type in python supports: The in membership operator. The len() function. Slicing like we saw with strings, s[1:3]. And is iterable (for

More information

CS112 Spring 2012 Dr. Kinga Dobolyi. Exam 2. Do not open this exam until you are told. Read these instructions:

CS112 Spring 2012 Dr. Kinga Dobolyi. Exam 2. Do not open this exam until you are told. Read these instructions: CS112 Spring 2012 Dr. Kinga Dobolyi Exam 2 Do not open this exam until you are told. Read these instructions: 1. This is a closed book exam. No calculators, notes, or other aids are allowed. If you have

More information

CS150 - Sample Final

CS150 - Sample Final CS150 - Sample Final Name: Honor code: You may use the following material on this exam: The final exam cheat sheet which I have provided The matlab basics handout (without any additional notes) Up to two

More information

CS 303E Fall 2011 Exam 2 Solutions and Criteria November 2, Good Luck!

CS 303E Fall 2011 Exam 2 Solutions and Criteria November 2, Good Luck! CS 303E Fall 2011 Exam 2 Solutions and Criteria November 2, 2011 Name: EID: Section Number: Friday discussion time (circle one): 9-10 10-11 11-12 12-1 2-3 Friday discussion TA(circle one): Wei Ashley Answer

More information

Structure and Interpretation of Computer Programs

Structure and Interpretation of Computer Programs CS 61A Fall 2016 Structure and Interpretation of Computer Programs Final INSTRUCTIONS You have 3 hours to complete the exam. The exam is closed book, closed notes, closed computer, closed calculator, except

More information

Question 1. Part (a) Simple Syntax [1 mark] Circle add_ints(), because it is missing arguments to the function call. Part (b) Simple Syntax [1 mark]

Question 1. Part (a) Simple Syntax [1 mark] Circle add_ints(), because it is missing arguments to the function call. Part (b) Simple Syntax [1 mark] Note to Students: This file contains sample solutions to the term test together with the marking scheme and comments for each question. Please read the solutions and the marking schemes and comments carefully.

More information

Spring Semester 11 Exam #1 Dr. Dillon. (02/15)

Spring Semester 11 Exam #1 Dr. Dillon. (02/15) Spring Semester 11 Exam #1 Dr. Dillon. (02/15) Form 1 A Last name (printed): First name (printed): Directions: a) DO NOT OPEN YOUR EXAM BOOKLET UNTIL YOU HAVE BEEN TOLD TO BEGIN. b) You may use one 8.5"

More information

Overview of List Syntax

Overview of List Syntax Lists and Sequences Overview of List Syntax x = [0, 0, 0, 0] Create list of length 4 with all zeroes x 4300112 x.append(2) 3 in x x[2] = 5 x[0] = 4 k = 3 Append 2 to end of list x (now length 5) Evaluates

More information

بسم اهلل الرمحن الرحيم

بسم اهلل الرمحن الرحيم بسم اهلل الرمحن الرحيم Fundamentals of Programming C Session # 10 By: Saeed Haratian Fall 2015 Outlines Examples Using the for Statement switch Multiple-Selection Statement do while Repetition Statement

More information

Honors Computer Science Python Mr. Clausen Programs 4A, 4B, 4C, 4D, 4E, 4F

Honors Computer Science Python Mr. Clausen Programs 4A, 4B, 4C, 4D, 4E, 4F PROGRAM 4A Full Names (25 points) Honors Computer Science Python Mr. Clausen Programs 4A, 4B, 4C, 4D, 4E, 4F This program should ask the user for their full name: first name, a space, middle name, a space,

More information

UNIVERSITY OF TORONTO Faculty of Arts and Science. Midterm 1 CSC148H1F L0201 (Liu)

UNIVERSITY OF TORONTO Faculty of Arts and Science. Midterm 1 CSC148H1F L0201 (Liu) UNIVERSITY OF TORONTO Faculty of Arts and Science Midterm 1 CSC148H1F L0201 (Liu) October 21, 2016 (50 min.) Examination Aids: Provided aid sheet (back page, detachable!) Name: Student Number: Please read

More information

Babu Madhav Institute of Information Technology, UTU 2015

Babu Madhav Institute of Information Technology, UTU 2015 Five years Integrated M.Sc.(IT)(Semester 5) Question Bank 060010502:Programming in Python Unit-1:Introduction To Python Q-1 Answer the following Questions in short. 1. Which operator is used for slicing?

More information

CSC148 Recipe for Designing Classes

CSC148 Recipe for Designing Classes Part 1: Define the API for the class CSC148 Recipe for Designing Classes Download the sample code here: https://www.teach.cs.toronto.edu/~csc148h/fall/lectures/object-oriented-programming/common/course.

More information

Question 1. Part (a) Functions [2 marks] def make_a_wish(): print("happy Halloween") make_a_wish() Part (b) Loops and Lists [3 marks]

Question 1. Part (a) Functions [2 marks] def make_a_wish(): print(happy Halloween) make_a_wish() Part (b) Loops and Lists [3 marks] Question 1. [9 marks] Treat each subquestion independently (i.e., code in one question is not related to code in another), and answer each question in the space provided. Part (a) Functions [2 marks] Write

More information

CS 1110 Prelim 2 November 14th, 2013

CS 1110 Prelim 2 November 14th, 2013 CS 1110 Prelim 2 November 14th, 2013 This 90-minute exam has 6 questions worth a total of 100 points. Scan the whole test before starting. Budget your time wisely. Use the back of the pages if you need

More information

CS 1110 Prelim 2 April 21, 2015

CS 1110 Prelim 2 April 21, 2015 CS 1110 Prelim 2 April 21, 2015 (Print Last Name) (Print First Name) (Net ID) Circle Your Lab: ACCEL: Tue 12:20 Tue 1:25 Tue 2:30 Tue 3:35 ACCEL : Wed 10:10 Wed 11:15 Wed 12:20 Wed 1:25 Wed 2:30 Wed 3:35

More information

Python: Short Overview and Recap

Python: Short Overview and Recap Python: Short Overview and Recap Benjamin Roth CIS LMU Benjamin Roth (CIS LMU) Python: Short Overview and Recap 1 / 39 Data Types Object type Example creation Numbers (int, float) 123, 3.14 Strings this

More information

Types, lists & functions

Types, lists & functions Week 2 Types, lists & functions Data types If you want to write a program that allows the user to input something, you can use the command input: name = input (" What is your name? ") print (" Hello "+

More information

Review Sheet for Midterm #1 COMPSCI 119 Professor William T. Verts

Review Sheet for Midterm #1 COMPSCI 119 Professor William T. Verts Review Sheet for Midterm #1 COMPSCI 119 Professor William T. Verts Simple Data Types There are a number of data types that are considered primitive in that they contain only a single value. These data

More information

THE AUSTRALIAN NATIONAL UNIVERSITY Mid Semester Examination September COMP1730 / COMP6730 Programming for Scientists

THE AUSTRALIAN NATIONAL UNIVERSITY Mid Semester Examination September COMP1730 / COMP6730 Programming for Scientists THE AUSTRALIAN NATIONAL UNIVERSITY Mid Semester Examination September 2016 COMP1730 / COMP6730 Programming for Scientists Study Period: 15 minutes Time Allowed: 2 hours Permitted Materials: One A4 page

More information

To become familiar with array manipulation, searching, and sorting.

To become familiar with array manipulation, searching, and sorting. ELECTRICAL AND COMPUTER ENGINEERING 06-88-211: COMPUTER AIDED ANALYSIS LABORATORY EXPERIMENT #2: INTRODUCTION TO ARRAYS SID: OBJECTIVE: SECTIONS: Total Mark (out of 20): To become familiar with array manipulation,

More information

School of Computer Science Introduction to Algorithms and Programming Winter Midterm Examination # 1 Wednesday, February 11, 2015

School of Computer Science Introduction to Algorithms and Programming Winter Midterm Examination # 1 Wednesday, February 11, 2015 Page 1 of 8 School of Computer Science 60-141-01 Introduction to Algorithms and Programming Winter 2015 Midterm Examination # 1 Wednesday, February 11, 2015 Marking Exemplar Duration of examination: 75

More information

CS 1110 Prelim 1 March 10, 2015

CS 1110 Prelim 1 March 10, 2015 CS 1110 Prelim 1 March 10, 2015 (Print Last Name) (Print First Name) (Net ID) Circle Your Lab: ACCEL: Tue 12:20 Tue 1:25 Tue 2:30 Tue 3:35 ACCEL : Wed 10:10 Wed 11:15 Wed 12:20 Wed 1:25 Wed 2:30 Wed 3:35

More information

Good Luck! Marking Guide. APRIL 2014 Final Exam CSC 209H5S

Good Luck! Marking Guide. APRIL 2014 Final Exam CSC 209H5S APRIL 2014 Final Exam CSC 209H5S Last Name: Student #: First Name: Signature: UNIVERSITY OF TORONTO MISSISSAUGA APRIL 2014 FINAL EXAMINATION CSC209H5S System Programming Daniel Zingaro Duration - 3 hours

More information

Structure and Interpretation of Computer Programs

Structure and Interpretation of Computer Programs CS 6A Fall 206 Structure and Interpretation of Computer Programs Final Solutions INSTRUCTIONS You have hours to complete the exam. The exam is closed book, closed notes, closed computer, closed calculator,

More information

AP Computer Science Principles Programming Question Tips. 1: Which algorithm/code segment achieves some result?

AP Computer Science Principles Programming Question Tips. 1: Which algorithm/code segment achieves some result? AP Computer Science Principles Programming Question Tips Name: Recall that roughly 40 percent of the questions on the AP exam will be programming or algorithm questions. These will often fall into one

More information

University of Toronto Mississauga. Flip to the back cover and write down your name and student number.

University of Toronto Mississauga. Flip to the back cover and write down your name and student number. University of Toronto Mississauga Midterm Test Course: CSC258H5 Winter 2016 Instructor: Larry Zhang Duration: 50 minutes Aids allowed: None Last Name: Given Name: Flip to the back cover and write down

More information

PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science

PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science AUGUST 2011 EXAMINATIONS CSC 209H1Y Instructor: Daniel Zingaro Duration three hours PLEASE HAND IN Examination Aids: one two-sided 8.5x11

More information

Last Name: UTION First Name: SOL Cornell NetID: CS1110. Solution: CS 1110 Prelim 2 April 26, 2016

Last Name: UTION First Name: SOL Cornell NetID: CS1110. Solution: CS 1110 Prelim 2 April 26, 2016 Last Name: UTION First Name: SOL Cornell NetID: CS1110 CS 1110 Prelim 2 April 26, 2016 1. [6 points] What is the output if the following module is run: def F1(x): y = [] # empty list n = len(x) for k in

More information

CS8 Final Exam E03, 09M, Phill Conrad, UC Santa Barbara 09/10/2009

CS8 Final Exam E03, 09M, Phill Conrad, UC Santa Barbara 09/10/2009 CS8 Final Exam E03, 09M, Phill Conrad, UC Santa Barbara 09/10/2009 Name: Umail Address: @ umail.ucsb.edu Please write your name only on this page. That allows me to grade your exams without knowing whose

More information

Slide Set 15 (Complete)

Slide Set 15 (Complete) Slide Set 15 (Complete) for ENCM 339 Fall 2017 Section 01 Steve Norman, PhD, PEng Electrical & Computer Engineering Schulich School of Engineering University of Calgary November 2017 ENCM 339 Fall 2017

More information