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

Size: px
Start display at page:

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

Transcription

1 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. (In the meantime, please fill out the identification section above, and read the instructions below carefully.) This final examination consists of 7 questions on 15 pages (including this one). When you receive the signal to start, please make sure that your copy of the examination is complete. Answer each question directly on the examination paper, in the space provided. (If you need more space for one of your solutions, use the blank page and indicate clearly which part of your work should be marked.) Be aware that concise, well thought-out answers will be rewarded over long rambling ones. Also, unreadable answers will be given zero (0) so write legibly. In the programming questions, assume all input is valid. Make sure to indent your code properly. Your code will be marked based on correctness and style. Some questions in the exam follow on other questions. When answering a question you may assume that all functions in the preceding questions have been implemented correctly, and you may make use of these functions. # 1: / 8 # 2: / 10 # 3: / 20 # 4: / 15 # 5: / 27 # 6: / 10 # 7: / 10 TOTAL: /100 Good Luck! Total Pages = 15 Page 1 over...

2 Question 1. [8 marks] Consider the following Python program. def f(a, b): """missing docstring""" print(a, b) return b == 1 or a > 1 def g(x, y): """missing docstring""" x[1] = y return x def h(x, y, z): """missing docstring""" if f(y, z): return g(x, y) else: return g(x, z) Fill in the outputs for the Python shell session in the boxes below (assuming appropriate imports have been done). If you think Python will raise an Error, write error. >>> h([2,4,0], 5, 10) [0, 10, 4] >>> h([2,1,0], 1, 24) 1 55 [2, 55, 0] >>> h("456", "a", "b") z y Error If you thought that Python raised an Error for any of the above, explain what caused the error. There are two solutions that we can accept - one,we can t compare an int to a str (in f(a, b) and a > 1) or another potential error is assigning x[1] a value (x is a string which is immutable). Total Pages = 15 Page 2 cont d...

3 Question 2. [10 marks] The following implementation is incorrect it has several bugs. Your task is to identify and fix them in the code below. Notice that the headers and the docstrings are all correct; only the implementation is faulty. The errors are not syntax errors, but rather logical errors. Correct the code directly in the space provided. def earlier(str1, str2): (str, str) -> bool Soln. Return if str1 comes earlier in the alphabet than str2, and otherwise. Assume that str1 and str2 only contain characters from the alphabet. >>> earlier( anna, banana ) >>> earlier( anna, anana ) >>> earlier( Anna, banana ) >>> earlier( Anna, anana ) print( str1.upper() < str2.upper() ) return (str1.upper() < str2.upper()) def is_sorted_alpha(lst): (list of str) -> bool Return if lst is sorted in alphabetical order. Assume the strs in lst only contain characters from the alphabet. >>> is_sorted_alpha([]) >>> is_sorted_alpha([ apple ]) >>> is_sorted_alpha([ apple, apple, banana, cantaloupe, orange ]) >>> is_sorted_alpha( apple, banana, orange, melon ]) for i in range(len(lst)): if earlier(lst[i], lst[i + 1]): return Soln. for i in range(len(lst)-1): if earlier(lst[i+1], lst[i]): return return Total Pages = 15 Page 3 over...

4 Question 3. [20 marks] In this question your task is to design and implement a function check password that takes a str as input, and returns a bool that is if the input str contains at least 1 numeric value, 1 lower case letter and 1 upper case letter. For example, given a string TopSecret, the function should return and given string TopSecret15 would return. In the last part of the question, you will write an interactive program that uses the function check password. Part (a) [1 mark] Write the header of the function check password. def check_password(s): Part (b) [3 marks] Write the beginning of a docstring of the function: the types and the function description. """(str) -> bool Return a bool that is if the string contains a digit, an upper case letter and a lower case letter and otherwise. Part (c) [6 marks] Write the doctests for the function. Remember that the purpose of doctests is to make sure that your function works for any possible input. You may use c instead of the function name check password to save time. Hint: you should have at least 6 doctests. >>> check_password( ) >>> check_password( x ) >>> check_password( Ab ) >>> check_password( 9 ) >>> check_password( A ) >>> check_password( A9 ) >>> check_password( 0a ) >>> check_password( ba1 ) """ Total Pages = 15 Page 4 cont d...

5 Part (d) Write the implementation of the function. has_digit = has_lower = has_upper = for c in s: if c.islower(): has_lower = elif c.isupper(): has_upper = elif c.isdigit(): has_digit = return has_lower and has_upper and has_digit Part (e) Write a program (complete the part under the main block) that behaves as follows. It repeatedly asks the user for an input string for a password until the user gives a string that has one upper case character, one lower case character and one digit. Enter a password with at least one upper, one lower and one digit: csca20 Your password csca20 is not valid. Enter a password with at least one upper, one lower and one digit: CSCA20 Your password CSCA20 is not valid. Enter a password with at least one upper, one lower and one digit: csca20 Accepted! Complete the program below: if name == main : p = input("please, enter a password containing one upper, one lower and one digit:") while not check_password(p): print( Your password %s is not valid. %(p,)) p = input("please, enter a password containing one upper, one lower and one digit:") print( Accepted!) Total Pages = 15 Page 5 over...

6 Question 4. [15 marks] For this question you will be writing a program related to the frequency of the length of words in the English language. You will write the functions described below. You may assume that all the input has had all punctuation and numeric values removed. Complete the following functions according to their docstring descriptions. As required on your assignments, you must avoid duplicate code by having your functions call others when appropriate. A portion of your mark will be based on code reuse. Note that if you cannot complete one function you can still complete the others. Part (a) def list_to_dict(word_list): (list of str) -> dict Given a list of str (a list of English words) return a dictionary that keeps track of word length and frequency of length. Each key is a word length and the corresponding value is the number of words in the given list of that length. >>> d = list_to_dict([ This, is, some, text ]) >>> d == {2:1, 4:3} >>> d = list_to_dict([ A, little, sentence, to, create, a, dictionary ]) >>> d == {1:2, 6:2, 8:1, 2:1, 10:1} d = {} for word in word_list: if len(word) in d: d[len(word)] += 1 else: d[len(word)] = 1 return d Another solution is: d = {} for word in word_list: d[len(word)] = d.get(len(word), 0) + 1 return d Total Pages = 15 Page 6 cont d...

7 Part (b) def add_dicts(d1, d2): (dict, dict) -> dict Parameters d1 and d2 are dicts where each key is an int and each value is an int. Return dict d1 with the contents of d2 added to d1. More concisely, if key k is in d1 and in d2, update d1[k] to be the sum of d1[k] and d2[k]. If d2 has a key that is not in d1, add the key value pair from d2 to d1. >>> d1 = {1:1, 2:1, 3:2} >>> d2 = {1:3, 3:1, 4:1} >>> d = add_dicts(d1, d2) >>> d == {1:4, 2:1, 3:3, 4:1} for key in d2: d1[key] = d1.get(key, 0) + d2[key] return d1 Part (c) def file_to_dict(filename): (str) -> dict Open the file of the given filename. The contents of the file is English text. Return a dictionary that keeps track of word length and frequency of word length in the file. Each key is a length of word and the corresponding value is the number of words in the given file of that length. You may assume there is no punctuation or numeric values in the file and that words are separated by spaces. or f = open(filename, r ) d = {} for line in f: word_list = line.split( ) list_dict = list_to_dict(word_list) d = add_dicts(d, f.close() return d list_dict) f = open(filename, r ) d = {} word_list = f.read().split( ) d = list_to_dict(word_list) f.close() return d Total Pages = 15 Page 7 over...

8 Question 5. [27 marks] Complete the following short answer questions. Part (a) [3 marks] Explain what mutable means. Give an example of a type that is mutable and a type that is immutable. Mutable means that the type can be altered. Lists are mutable as are dictionaries, strings and tuples are not mutable. Part (b) [4 marks] Consider the following code in the shell and fill in the blank lines (i.e., the values of variables M, N, L and N again). >>> L = [1, [1, 2], 3] >>> M = L >>> N = L[:] >>> L[0] = 0 >>> M >>> N >>> L[1][0] = 8 >>> L >>> N >>> # END OF QUESTION Soln. >>> M [0, [1, 2], 3] >>> N [1, [1, 2], 3] >>> L [0, [8, 2], 3] >>> N [1, [8, 2], 3] Part (c) Consider the following code: 1 def do_it(x, y): 2 print([x, y]) 3 4 my_list = do_it(1, 2) 5 print(my_list) What does line 5 display? Explain your answer. nothing. do it doesn t return anything. Total Pages = 15 Page 8 cont d...

9 Part (d) Complete the function according to it s docstring. def clean(data_list): (list of str) -> list of int Given a list of str where each str has only numeric characters and possibly leading and trailing white space, return a list of int. >>> clean([ 23, 4, 55 ]) [23, 4, 55] L = [] for item in data_list: L.append(int(item.strip())) return L Part (e) Fill in a complete docstring for the following function. def unknown(l): (list) -> bool Return true if each item in L is twice the previous item and otherwise. >>> false example >>> true example i = 0 n = len(l) while i< n-1: if L[i+1]!= 2*L[i]: return i += 1 return Total Pages = 15 Page 9 over...

10 Part (f) Complete the function according it s docstring. def decrypt(characters, code): (list of str, list of int) -> list of str Given a list of characters and a list of ints representing indices, return a list of chars that is constructed by replacing each int in the code list with the char from the characters list at that index. >>> decrypt([ a, 2, s, c, 0 ], [3, 2, 3, 0, 1, 4]) [ c, s, c, a, 2, 0 ] >>> decrypt([ O, H ], [1, 0, 1, 0, 1, 0]) [ H, O, H, O, H, O ] for index in range(len(code)): code[index] = characters[code[index]] return code Total Pages = 15 Page 10 cont d...

11 Question 6. [10 marks] A university student database is being used for grade maintenance, exam and course scheduling purposes. Two tables are being used, Student and Courses. CREATE TABLE Student(Name TEXT, StudentID INTEGER, Grade REAL, Course TEXT, Section INTEGER) CREATE TABLE Courses(Course TEXT, Section INTEGER, Day TEXT, Time TEXT) An example of rows in the Student table: An example of rows in the Courses table: Cathy Smith CSCA20 1 Cathy Smith CSCB09 2 Shirley Martin CSCA20 1 CSCA20 1 Monday 2:10 CSCB09 1 Wednesday 9:10 CSCB09 2 Tuesday 1:10 The Courses table contains one row per course section (assume each section meets only once per week). For example, if MATA32 has two sections, there will be two rows for MATA32. In the Student table, there is one row for each course that a student is enrolled in. The Grade field contains the student s grade in that course. Write an SQL query to retrieve the data described below from the database. Note: you do not need to write any code to connect to the database; you only need to write the SQL query (e.g., SELECT... ). Part (a) [2 marks] The StudentID of students taking CSCA20. SELECT StudentID FROM Student WHERE Course = CSCA20 Part (b) [2 marks] The timetable of each student. In other words, the name of the student, their courses and their course day and time. SELECT Student.Name, Courses.Course, Courses.Day, Courses.Time FROM Student JOIN Courses WHERE Student.Course = Courses.Course AND Student.Section = Courses.Section Part (c) [3 marks] The names of Courses and the average Grade of the students enrolled in each course. SELECT Student.Course, AVG(Student.GPA) From Student JOIN Courses WHERE Student.Course = Courses.Course GROUP BY Student.Course or SELECT Courses.Course, AVG(Student.GPA) From Student JOIN Courses WHERE Student.Course = Courses.Course GROUP BY Courses.Course Part (d) [3 marks] Courses that have the same start time on the same day. SELECT A.Course, B.Course FROM Courses A JOIN Courses B WHERE A.Time = B.Time AND A.Day = B.Day AND A.Course!= B.Course Total Pages = 15 Page 11 over...

12 Question 7. [10 marks] This question has you write a program to manage student time tabling and uses the database from Question 6. The question has two parts and relies on a database that has already been created and populated with the following tables: CREATE TABLE Student(Name TEXT, StudentID INTEGER, Grade REAL, Course TEXT, Section INTEGER) CREATE TABLE Courses(Course TEXT, Section INTEGER, Day TEXT, Time TEXT) You may find the following function helpful: def run_query(db, q, args=none): Run the query q on database db and return the result. args is a tuple of arguments for the query. If provided, con = sqlite.connect(db) cur = con.cursor() if args == None: cur.execute(q) else: cur.execute(q, args) result = cur.fetchall() cur.close() con.close() return result Part (a) [4 marks] Complete functions search course (below) and insert student (on the next page) according to their docstring descriptions. def search_course(db, course_name): Retrieve the Section, Days and Times for the Course course_name (a str) from database db, and return a list of strs where each str is of the form Section Day Time for each section of that course. result = run_query(db, SELECT Section, Day, Time FROM Courses Where Course = (?), (course_name,)) day_time = [] for item in result: day_time.append(str(item[0]) + " " + item[1] + " " + item[2]) return day_time Total Pages = 15 Page 12 cont d...

13 def insert_student(db, course_name, section, student_name, studentid): Insert a new row into the table Student of database db with Name student_name, StudentID studentid, Course course_name, Section section and Grade of 0. # Connect to the database con = sqlite.connect(db) cur = con.cursor() # Insert the new row into the Student table # COMPLETE THIS LINE: cur.execute( ) cur.execute(insert INTO Student VALUES(?,?,?,?,?), (student_name, studentid, 0, course_name, section)) cur.close() con.commit() con.close() Part (b) [6 marks] Write a program that allows a student to add a course to their timetable. Your program will first prompt the user to enter their name, student ID and course request. Using this information, your program should then display for each section, the section number, the day and time and prompt the user to select one. Your program should then add the course to the database for the given student with an initial grade of 0. The database, timetable.db has already been created and populated with data. A sample interaction with a user may look like this: Enter your name: Anna Bretscher Enter your student ID: Enter your course request: CSCB09 Please select one of the following options (enter a section number): 1 Wednesday, 9:10 2 Tuesday, 1:10 1 When the user enters a section, your program should insert a new row in the table Student with the student information, course name and section to indicate that the student has enrolled in a section. After your program completes, the Student table should include a line for the new course request. It could look like this: Total Pages = 15 Page 13 over...

14 Cathy Smith CSCA20 1 Cathy Smith CSCB09 2 Shirley Martin CSCA20 1 Anna Bretscher CSCB09 1 We have provided some starter code to get you started and lay out the steps you need to complete. Make sure to fill in the code as indicated by the comments and to use the variable names defined. You should call the functions search course and insert student as needed. if name == " main ": db = time_table.db # Prompt user for name, student id and course # # ADD CODE BELOW name = input( Please enter your name. ) id = input( Please enter your student id. ) course = input( Please enter your course request. ) # Find the course sections, times and days for the requested course in the timetable # by calling function search_and_display. # ADD CODE BELOW options_list = search_course(db, course) # Give the user options for the course timetable and prompt for their section choice # ADD CODE BELOW options_str = for item in options_list: options_str = options_str + item + \n section = int(input(options_str)) # Insert the student data into the database by calling insert_student # ADD CODE BELOW insert_student(db, course, section, name, id) insert_student(db, course, fieldvalues[0], fieldvalues[1]) Total Pages = 15 Page 14 cont d...

15 Total Marks = 100 Total Pages = 15 Page 15 End of Solutions

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

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

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

CSC 120 Worksheet 12 Databases

CSC 120 Worksheet 12 Databases CSC 120 Worksheet 12 Databases 1 Format for SQLite Commands We will create tables and retrieve data from the tables using Python and SQLite. You can find a list of Python and SQLite commands at the end

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

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

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 2010 EXAMINATIONS CSC 108 H1S Instructors: Horton Duration 3 hours 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 AUGUST EXAMINATIONS CSC 108H1Y Instructor: Daniel Zingaro Duration three hours PLEASE HAND IN Examination Aids: None. Student Number: Last

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

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

UNIVERSITY OF TORONTO SCARBOROUGH WINTER 2016 EXAMINATIONS. CSC B20H3 Duration 3 hours. No Aids Allowed

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

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

Introduction to pysqlite

Introduction to pysqlite Introduction to pysqlite A crash course to accessing SQLite from within your Python programs. Based on pysqlite 2.0. SQLite basics SQLite is embedded, there is no server Each SQLite database is stored

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

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

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

Spring Semester 10 Exam #1 Dr. Dillon. (02/18)

Spring Semester 10 Exam #1 Dr. Dillon. (02/18) Spring Semester 10 Exam #1 Dr. Dillon. (02/18) Form 1 B Last name (printed): First name (printed): Directions: a) DO NOT OPEN YOUR EXAM BOOKLET UNTIL YOU HAVE BEEN TOLD TO BEGIN. b) You have 80 minutes

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

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

CS 1301 Exam 2 Fall 2010

CS 1301 Exam 2 Fall 2010 CS 1301 Exam 2 Fall 2010 Name : Grading TA: Devices: If your cell phone, pager, PDA, beeper, ipod, or similar item goes off during the exam, you will lose 10 points on this exam. Turn all such devices

More information

University of Washington CSE 140 Introduction to Data Programming Winter Midterm exam. February 6, 2013

University of Washington CSE 140 Introduction to Data Programming Winter Midterm exam. February 6, 2013 University of Washington CSE 140 Introduction to Data Programming Winter 2013 Midterm exam February 6, 2013 Name: Solutions UW Net ID (username): This exam is closed book, closed notes. You have 50 minutes

More information

Collections. Lists, Tuples, Sets, Dictionaries

Collections. Lists, Tuples, Sets, Dictionaries Collections Lists, Tuples, Sets, Dictionaries Homework notes Homework 1 grades on canvas People mostly lost points for not reading the document carefully Didn t play again Didn t use Y/N for playing again

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

(CC)A-NC 2.5 by Randall Munroe Python

(CC)A-NC 2.5 by Randall Munroe Python http://xkcd.com/353/ (CC)A-NC 2.5 by Randall Munroe Python Python: Operative Keywords Very high level language Language design is focused on readability Mulit-paradigm Mix of OO, imperative, and functional

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

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

Introduction to Python

Introduction to Python Introduction to Python Why is Python? Object-oriented Free (open source) Portable Powerful Mixable Easy to use Easy to learn Running Python Immediate mode Script mode Integrated Development Environment

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

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

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

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

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. CSC 120H1 F Midterm Test Solutions Fall 2017

Question 1. CSC 120H1 F Midterm Test Solutions Fall 2017 Question 1. [5 marks] Fill in the boxes below with what you would see in your Python shell if you were to type the following expressions. If that code would result in an error, then write ERROR and provide

More information

Short Answer Questions (40 points)

Short Answer Questions (40 points) CS 1112 Fall 2017 Test 2 Page 1 of 6 Short Answer Questions (40 points) 1. TRUE FALSE You have very legibly printed your name and email id below. Name = EMAILD = 2. TRUE FALSE On my honor, I pledge that

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 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

MATH 1MP3 Homework #4 Due: 11:59pm, Wednesday, March 6.

MATH 1MP3 Homework #4 Due: 11:59pm, Wednesday, March 6. MATH 1MP3 Homework #4 Due: 11:59pm, Wednesday, March 6. Important notes: To start the assignment, download the Jupyter notebook file assignment 4 template.ipynb found here: https://ms.mcmaster.ca/~matt/1mp3/homework/assignment_4_template.

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

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

CS 115 Exam 1, Fall 2015 Thu. 09/24/2015

CS 115 Exam 1, Fall 2015 Thu. 09/24/2015 CS 115 Exam 1, Fall 2015 Thu. 09/24/2015 Name: Section: Rules and Hints You may use one handwritten 8.5 11 cheat sheet (front and back). This is the only additional resource you may consult during this

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

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

1 Fall 2017 CS 1110/1111 Exam 3

1 Fall 2017 CS 1110/1111 Exam 3 1 Fall 2017 CS 1110/1111 Exam 3 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. If you have a shorter ID, leave some rows blank.

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. 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

Spring 2017 CS 1110/1111 Exam 2

Spring 2017 CS 1110/1111 Exam 2 Spring 2017 CS 1110/1111 Exam 2 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. If you have a shorter ID, leave some rows blank.

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

All programs can be represented in terms of sequence, selection and iteration.

All programs can be represented in terms of sequence, selection and iteration. Python Lesson 3 Lists, for loops and while loops Suffolk One, Ipswich, 4:30 to 6:00 Tuesday Jan 28 Nicky Hughes All programs can be represented in terms of sequence, selection and iteration. 1 Computational

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

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

CSE 160 Winter 2016: Final Exam

CSE 160 Winter 2016: Final Exam Name: Sample Solution Email address (UW NetID): CSE 160 Winter 2016: Final Exam (closed book, closed notes, no calculators) Instructions: This exam is closed book, closed notes. You have 50 minutes to

More information

CS 115 Exam 3, Spring 2014

CS 115 Exam 3, Spring 2014 Your name: Rules You may use one handwritten 8.5 x 11 cheat sheet (front and back). This is the only resource you may consult during this exam. Explain/show work if you want to receive partial credit for

More information

Python Programming: Lecture 2 Data Types

Python Programming: Lecture 2 Data Types Python Programming: Lecture 2 Data Types Lili Dworkin University of Pennsylvania Last Week s Quiz 1..pyc files contain byte code 2. The type of math.sqrt(9)/3 is float 3. The type of isinstance(5.5, float)

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

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

Question 1. CSC A08 F Midterm Test Solutions Fall 2011

Question 1. CSC A08 F Midterm Test Solutions Fall 2011 The next two questions involve the sound module that we used in the first assignment. At the end of the test, you ll find a list of the sound functions we learned about. Note that you may not need to use

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

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

Homework notes. Homework 2 grades posted on canvas. Homework 3 due tomorrow. Homework 4 posted on canvas. Due Tuesday, Oct. 3

Homework notes. Homework 2 grades posted on canvas. Homework 3 due tomorrow. Homework 4 posted on canvas. Due Tuesday, Oct. 3 References Homework notes Homework 2 grades posted on canvas Homework 3 due tomorrow Homework 4 posted on canvas Due Tuesday, Oct. 3 Style notes Comment your code! A short line of comments per logical

More information

: Intro Programming for Scientists and Engineers Final Exam

: Intro Programming for Scientists and Engineers Final Exam Final Exam Page 1 of 6 600.112: Intro Programming for Scientists and Engineers Final Exam Peter H. Fröhlich phf@cs.jhu.edu December 20, 2012 Time: 40 Minutes Start here: Please fill in the following important

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

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

CPTS 111, Fall 2011, Sections 6&7 Exam 3 Review

CPTS 111, Fall 2011, Sections 6&7 Exam 3 Review CPTS 111, Fall 2011, Sections 6&7 Exam 3 Review File processing Files are opened with the open() command. We can open files for reading or writing. The open() command takes two arguments, the file name

More information

S206E Lecture 19, 5/24/2016, Python an overview

S206E Lecture 19, 5/24/2016, Python an overview S206E057 Spring 2016 Copyright 2016, Chiu-Shui Chan. All Rights Reserved. Global and local variables: differences between the two Global variable is usually declared at the start of the program, their

More information

Spring 2017 CS 1110/1111 Exam 3

Spring 2017 CS 1110/1111 Exam 3 Spring 2017 CS 1110/1111 Exam 3 Bubble in your computing ID, top to bottom, in the footer of this page. We use an optical scanner to read it, so fill in the bubbles darkly. If you have a shorter ID, leave

More information

61A Lecture 3. Friday, September 5

61A Lecture 3. Friday, September 5 61A Lecture 3 Friday, September 5 Announcements There's plenty of room in live lecture if you want to come (but videos are still better) Please don't make noise outside of the previous lecture! Homework

More information

First cut, scope. Defining scope. Find the namespace. Passing argument to parameter. A function s namespace 6/13/2017. chapter 8.

First cut, scope. Defining scope. Find the namespace. Passing argument to parameter. A function s namespace 6/13/2017. chapter 8. chapter 8 First cut, scope More On Functions Defining scope The set of program statements over which a variable exists, i.e., can be referred to it is about understanding, for any variable, what its associated

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

\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

Sequence types. str and bytes are sequence types Sequence types have several operations defined for them. Sequence Types. Python

Sequence types. str and bytes are sequence types Sequence types have several operations defined for them. Sequence Types. Python Python Sequence Types Sequence types str and bytes are sequence types Sequence types have several operations defined for them Indexing Python Sequence Types Each element in a sequence can be extracted

More information

Exam 2, Form A CSE 231 Spring 2014 (1) DO NOT OPEN YOUR EXAM BOOKLET UNTIL YOU HAVE BEEN TOLD TO BEGIN.

Exam 2, Form A CSE 231 Spring 2014 (1) DO NOT OPEN YOUR EXAM BOOKLET UNTIL YOU HAVE BEEN TOLD TO BEGIN. Name: Section: Date: INSTRUCTIONS: (1) DO NOT OPEN YOUR EXAM BOOKLET UNTIL YOU HAVE BEEN TOLD TO BEGIN. (2) This exam booklet contains 30 questions, each of which will be weighted equally at 5 points each.

More information

Exam 2, Form B CSE 231 Spring 2014 (1) DO NOT OPEN YOUR EXAM BOOKLET UNTIL YOU HAVE BEEN TOLD TO BEGIN.

Exam 2, Form B CSE 231 Spring 2014 (1) DO NOT OPEN YOUR EXAM BOOKLET UNTIL YOU HAVE BEEN TOLD TO BEGIN. Name: Section: Date: INSTRUCTIONS: (1) DO NOT OPEN YOUR EXAM BOOKLET UNTIL YOU HAVE BEEN TOLD TO BEGIN. (2) This exam booklet contains 30 questions, each of which will be weighted equally at 5 points each.

More information

Introduction to Python Programming

Introduction to Python Programming advances IN SYSTEMS AND SYNTHETIC BIOLOGY 2018 Anna Matuszyńska Oliver Ebenhöh oliver.ebenhoeh@hhu.de Ovidiu Popa ovidiu.popa@hhu.de Our goal Learning outcomes You are familiar with simple mathematical

More information

Table of Contents EVALUATION COPY

Table of Contents EVALUATION COPY Table of Contents Introduction... 1-2 A Brief History of Python... 1-3 Python Versions... 1-4 Installing Python... 1-5 Environment Variables... 1-6 Executing Python from the Command Line... 1-7 IDLE...

More information

CMSC330 Fall 2016 Midterm #1 2:00pm/3:30pm

CMSC330 Fall 2016 Midterm #1 2:00pm/3:30pm CMSC330 Fall 2016 Midterm #1 2:00pm/3:30pm Name: Discussion Time: 10am 11am 12pm 1pm 2pm 3pm TA Name (Circle): Alex Austin Ayman Brian Damien Daniel K. Daniel P. Greg Tammy Tim Vitung Will K. Instructions

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

Name Section: M/W T/TH Number Definition Matching (8 Points)

Name Section: M/W T/TH Number Definition Matching (8 Points) Name Section: M/W T/TH Number Definition Matching (8 Points) 1. (8 pts) Match the words with their definitions. Choose the best definition for each word. Iteration Counter Event Counter Loop Abstract Step

More information

Data Structures. Lists, Tuples, Sets, Dictionaries

Data Structures. Lists, Tuples, Sets, Dictionaries Data Structures Lists, Tuples, Sets, Dictionaries Collections Programs work with simple values: integers, floats, booleans, strings Often, however, we need to work with collections of values (customers,

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

Python Review IPRE

Python Review IPRE Python Review 2 Jay Summet 2005-12-31 IPRE Outline Compound Data Types: Strings, Tuples, Lists & Dictionaries Immutable types: Strings Tuples Accessing Elements Cloning Slices Mutable Types: Lists Dictionaries

More information

Math 1MP3, final exam

Math 1MP3, final exam Math 1MP3, final exam 23 April 2015 Please write your name and student number on this test and on your answer sheet You have 120 minutes No external aids (calculator, textbook, notes) Please number your

More information

Objectives. Chapter 4: Control Structures I (Selection) Objectives (cont d.) Control Structures. Control Structures (cont d.) Relational Operators

Objectives. Chapter 4: Control Structures I (Selection) Objectives (cont d.) Control Structures. Control Structures (cont d.) Relational Operators Objectives Chapter 4: Control Structures I (Selection) In this chapter, you will: Learn about control structures Examine relational and logical operators Explore how to form and evaluate logical (Boolean)

More information

https://lambda.mines.edu Why study Python in Principles of Programming Languages? Multi-paradigm Object-oriented Functional Procedural Dynamically typed Relatively simple with little feature multiplicity

More information

Getting Started. Office Hours. CSE 231, Rich Enbody. After class By appointment send an . Michigan State University CSE 231, Fall 2013

Getting Started. Office Hours. CSE 231, Rich Enbody. After class By appointment send an  . Michigan State University CSE 231, Fall 2013 CSE 231, Rich Enbody Office Hours After class By appointment send an email 2 1 Project 1 Python arithmetic Do with pencil, paper and calculator first Idle Handin Help room 3 What is a Computer Program?

More information

CS 115 Exam 2 (Section 1) Spring 2017 Thu. 03/31/2017

CS 115 Exam 2 (Section 1) Spring 2017 Thu. 03/31/2017 CS 115 Exam 2 (Section 1) Spring 2017 Thu. 03/31/2017 Name: Rules and Hints You may use one handwritten 8.5 x 11 cheat sheet (front and back). This is the only additional resource you may consult during

More information

THE AUSTRALIAN NATIONAL UNIVERSITY Final Examination November COMP1730 / COMP6730 Programming for Scientists

THE AUSTRALIAN NATIONAL UNIVERSITY Final Examination November COMP1730 / COMP6730 Programming for Scientists THE AUSTRALIAN NATIONAL UNIVERSITY Final Examination November 2016 COMP1730 / COMP6730 Programming for Scientists Study Period: 15 minutes Time Allowed: 3 hours Permitted Materials: One A4 page (1 sheet)

More information

CS 111X - Fall Test 1

CS 111X - Fall Test 1 CS 111X - Fall 2016 - Test 1 1/9 Computing ID: CS 111X - Fall 2016 - Test 1 Name: Computing ID: On my honor as a student, I have neither given nor received unauthorized assistance on this exam. Signature:

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

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

Question 0. Do not turn this page until you have received the signal to start. CSCA08 Fall 2017 Final Exam Duration 170 minutes Aids allowed: none Last Name: Student Number: Markus Login: First Name: A Question 0. [1 mark] Carefully read and follow all instructions on this page,

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

2. Explain the difference between read(), readline(), and readlines(). Give an example of when you might use each.

2. Explain the difference between read(), readline(), and readlines(). Give an example of when you might use each. CMSC 0 Fall 0 Name Final Review Worksheet This worksheet is NOT guaranteed to cover every topic you might see on the exam. It is provided to you as a courtesy, as additional practice problems to help you

More information

Student Number: Lab day:

Student Number: Lab day: CSC 148H1 Summer 2008 Midterm Test Duration 60 minutes Aids allowed: none Last Name: Student Number: Lab day: First Name: Lecture Section: L0101 Instructor: R. Danek Do not turn this page until you have

More information

Final Examination, Semester 1, 2015 COMP10001 Foundations of Computing

Final Examination, Semester 1, 2015 COMP10001 Foundations of Computing Student Number The University of Melbourne Department of Computing and Information Systems Final Examination, Semester 1, 2015 COMP10001 Foundations of Computing Reading Time: 15 minutes. Writing Time:

More information

CPSC 217 Midterm (Python 3 version)

CPSC 217 Midterm (Python 3 version) CPSC 217 Midterm (Python 3 version) Duration: 60 minutes 7 March 2011 This exam has 81 questions and 14 pages. This exam is closed book. No notes, books, calculators or electronic devices, or other assistance

More information

Data 8 Final Review #1

Data 8 Final Review #1 Data 8 Final Review #1 Topics we ll cover: Visualizations Arrays and Table Manipulations Programming constructs (functions, for loops, conditional statements) Chance, Simulation, Sampling and Distributions

More information

Algorithms for Bioinformatics

Algorithms for Bioinformatics These slides are based on previous years slides of Alexandru Tomescu, Leena Salmela and Veli Mäkinen 582670 Algorithms for Bioinformatics Lecture 1: Primer to algorithms and molecular biology 2.9.2014

More information

CS 115 Lecture 8. Selection: the if statement. Neil Moore

CS 115 Lecture 8. Selection: the if statement. Neil Moore CS 115 Lecture 8 Selection: the if statement Neil Moore Department of Computer Science University of Kentucky Lexington, Kentucky 40506 neil@cs.uky.edu 24 September 2015 Selection Sometime we want to execute

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

Selection statements. CSE 1310 Introduction to Computers and Programming Alexandra Stefan University of Texas at Arlington

Selection statements. CSE 1310 Introduction to Computers and Programming Alexandra Stefan University of Texas at Arlington Selection s CSE 1310 Introduction to Computers and Programming Alexandra Stefan University of Texas at Arlington 1 Book reference Book: The practice of Computing Using Python 2-nd edition Second hand book

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