{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

CS115_Fall2010 - copyright 2010 Oda_Eagle Production all...

Info icon This preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
copyright 2010 Oda_Eagle Production, all right reserved CS115/116/125/134/135/136/2**/3** Private Tutor e [email protected] TEL: 519-497-0989 UWaterloo CS115 Final Exam Question Pack last update December 6 th , 2009 Note: there is no solution come with this question pack, solution not for sale as well, you have to attend Eagle's class to access the full solution, please respect my work. 使用須知:本題集不付答案,答案也不發售,必須參加我的課程才可以有機會接觸到答案,請 競爭對手尊重我的勞動成果,不要擅自利用于任何商業目的。 希望所有參考這份題集的同學都能考出理想的成績! Eagle 的補習班常年招生,請加 MSN [email protected] make sure you send a email E-mail : [email protected]
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
copyright 2010 Oda_Eagle Production, all right reserved CS115/116/125/134/135/136/2**/3** Private Tutor e [email protected] TEL: 519-497-0989 Part1. Warm-up Questions the purpose of this part is let you remember most material we have learned through out this term, take them as a reminder of material you may have missed. 1. Assume the following code already exist, fill in the blank if each line of code on the left column is executed in the interaction window. ( substring str 0 ) ( substring str 4 ) ( substring str 0 1 ) ( substring str 4 5 ) ( first lst ) ( first ( rest ( rest lst ) ) ) ( first lol ) ( first ( rest lol ) ) ( first ( first lol ) ) ( rest lol ) 2. For each of the following question, write a single line of code. (1) given a string str , get a string formed by first char of str and last char of str . (2) given two strings str1 and str2 , get a string formed by insert str2 in the middle of str1 . (3) given a list lst , return a new list by putting head of lst to the tail. (4) given a list of string lst , return a new list by merging the first two strings together and keep the rest of the list. 3. For each of the following question, write a scheme function, you decide the name. (1) given a list of string los , return a new list of string by keeping only the first four digits of the string in the original list. If the string has length smaller than 4, than just keep whatever it has. (2) given a list of list lol , flatten the list, which is, if given ( list ( list 1 2 ) ( list 3 4 ) ), your function should return ( list 1 2 3 4 ).
Image of page 2
copyright 2010 Oda_Eagle Production, all right reserved CS115/116/125/134/135/136/2**/3** Private Tutor e [email protected] TEL: 519-497-0989 Part 2. Structures and Recursive Definition. 1. For each of the following questions, write a scheme definition and choose the most appropriate type for each field. (1) given data about a people , name, age, height, gender (2) given data about a employee , name, gender, title, salary (3) given data about a movie , title, director, length, restriction 2. For each of the above structures, write a recursive definition for list of that structure (1) list of people (2) list of employee (3) list of movie 3. Write a Scheme template for any of the above structure.
Image of page 3

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern