Name:
CIS 120e Midterm I
October 15, 2010
1
/18
2
/12
3
/12
4
/16
5
/12
6
/08
7
/22
Total
/100
Do not begin the exam until you are told to do so.
You have 50 minutes to complete the exam.
There are 10 pages in this exam.
Make sure your name is on the
Name:
CIS 120 Midterm I
February 18, 2011
1
/10
2
/12
3
/6
4
/12
6
/10
Total
/50
Do not begin the exam until you are told to do so.
You have 50 minutes to complete the exam.
There are 50 total points.
There are 11 pages in this exam.
Make sure your n
CIS 120 Programming Languages and Techniques
Final Exam, May 3, 2011
Name:
Pennkey:
My signature below certies that I have complied with the University of Pennsylvanias Code
of Academic Integrity in completing this examination.
Signature
Date
Scores:
1
2
Name:
CIS 120e Midterm I Review
This is a review for the midterm. These problems are intended to
be indicative of the kind that might appear on the exam, though you
should, of course, expect variations.
Reminder: there will be at least one problem on th
CIS 120 Programming Languages and Techniques
Midterm II
November 12, 2010
Review problems
1. Pages 12 to 14 dene a simplied version of the Java Collection interface (the SimpleCollection
and SimpleIterator interfaces), together with a concrete implementat
Name:
CIS 120e Midterm I
October 15, 2010
1
/18
2
/12
3
/12
4
/16
5
/12
6
/08
7
/22
Total
/100
Do not begin the exam until you are told to do so.
You have 50 minutes to complete the exam.
There are 10 pages in this exam.
Make sure your name is on the
CIS 120 Programming Languages and Techniques
Midterm II
November 12, 2010
Answer key for review problems
1. Pages 10 to 12 dene a simplied version of the Java Collection interface (the SimpleCollection
and SimpleIterator interfaces), together with a concr
Name:
CIS 120e Midterm I Review
This is a review for the midterm. These problems are intended to
be indicative of the kind that might appear on the exam, though you
should, of course, expect variations.
Reminder: there will be at least one problem on th
CIS 120 Programming Languages and Techniques
Midterm II
November 12, 2010
Answer key
1. (14 points) Pages 7 to 9 dene a simplied version of the Java Collection interface (the
SimpleCollection and SimpleIterator interfaces), together with a concrete implem
CIS 120 Programming Languages and Techniques
Final
December 16, 2010
Name:
Pennkey:
Scores:
1
2
3
4
5
6
7
8
Total (120 max)
OCaml
1. (14 points) Recall the fold and member functions that we saw in the OCaml part of the course:
let rec fold (c:a > b > b)
CIS 120 Programming Languages and Techniques
Final
December 16, 2010
Answer key
OCaml
1. (14 points) Recall the fold and member functions that we saw in the OCaml part of the course:
let rec fold (c:a > b > b) (b:b) (l:a list) : b =
begin match l with

CIS 120 Programming Languages and Techniques
Midterm II
November 12, 2010
Name:
Pennkey:
Scores:
1
2
3
4
5
6
Total (50 max)
1. (14 points) Pages 7 to 9 dene a simplied version of the Java Collection interface (the
SimpleCollection and SimpleIterator inter
Name:
CIS 120 Midterm I Review
This is a review for the midterm. These problems are intended to
be indicative of the kind that might appear on the exam, though you
should, of course, expect variations.
Reminder: there will be at least one problem on the
Name:
Pennkey:
CIS 120 Midterm I
October 12, 2011
1
/25
2
/20
3
/10
4
/25
5
/20
Total
/100
Do not begin the exam until you are told to do so.
You have 50 minutes to complete the exam.
There are 100 total points.
There are 9 pages in this exam.
Make s
CIS 160  Fall 2012
(instructor Val Tannen)
Midterm 1 SOLUTIONS
Posted Tuesday October 2, 2012
1. (25 pts) For each statement below, decide whether it is true or false. In each case attach a very brief
explanation of your answer.
(a) The function f : N N
CIS 160  Fall 2012
(instructor Val Tannen)
Homework 2 ANSWERS
Posted Friday, September 28
Problem 1 (20pts)
(a) Give an example of nite sets X, Y and functions f : X Y and g : Y X such that
g f is a bijection,
g f is dierent from the identity function,
CIS 160  Fall 2012
(instructor Val Tannen)
Homework 1 ANSWERS
Posted Tuesday, September 25
Problem 1 (20pts)
(a) Let A, B, C, D be arbitrary sets. Prove that (A C) (B D) (A B) (C D).
Answer
Let x (A C) (B D) arbitrary.
Case 1 x A C
x A and x C
x A B and
CIS 160  Fall 2012
(instructor Val Tannen)
Final Exam SOLUTIONS
Posted Friday December 14, 2012
1. (45 pts) For each statement below, decide whether it is true or false. In each case attach a very brief
explanation of your answer.
(a) Let f : N N and let
CIS 160  Fall 2012
(instructor Val Tannen)
Homework 5 ANSWERS
Posted November 13
Problem 1 (20pts) Alice is playing Solitaire Dice. The game uses two regular and fair dice,
that is, each die has 6 faces marked 1,2,3,4,5,6, each face comes up with the sam
CIS 160  Fall 2012
(instructor Val Tannen)
Homework 3 ANSWERS
Posted October 17
Problem 1 (20pts)
(a) How many ways are there to place m distinguishable objects into n distinguishable bins?
Each object must be placed in some bin but some bins may remain
CIS 160  Fall 2012
(instructor Val Tannen)
Mock Final SOLUTIONS
Posted Sunday December 9, 2012
1. (50 pts) For each statement below, decide whether it is true or false. In each case attach a very brief
explanation of your answer.
(a) Let G = (V, E) be a
CIS 160  Fall 2012
(instructor Val Tannen)
Mock Midterm 1 SOLUTIONS
Posted Saturday September 29, 2012
1. (30 pts) For each statement below, decide whether it is true or false. In each case attach a very brief
explanation of your answer.
(a) Let A, B be
CIS 160  Fall 2012
(instructor Val Tannen)
Mock Midterm 3 SOLUTIONS (CORRECTED!)
Posted Monday December 3, 2012
1. (30 pts) For each statement below, decide whether it is true or false. In each case attach a very brief
explanation of your answer.
(a) Con
CIS 160  Fall 2012
(instructor Val Tannen)
Homework 6 ANSWERS
Posted November 20
Problem 1 (25pts)
follows.
base case
Consider the set PP of pairs of natural numbers recursively dened as
(0, 0) PP
constructor 1
If (m, n) PP then (m + 1, n) PP.
constructo
CIS 160  Fall 2012
(instructor Val Tannen)
Midterm 3 SOLUTIONS
Posted Tuesday December 4, 2012
1. (30 pts) For each statement below, decide whether it is true or false. In each case attach a very brief
explanation of your answer.
(a) Consider events A, B
CIS 160  Fall 2012
(instructor Val Tannen)
Midterm 2 SOLUTIONS
Posted Thursday November 1, 2012
1. (30 pts) For each statement below, decide whether it is true or false. In each case attach a very brief
explanation of your answer.
(a) When proving proper
CIS 121  Fall 2011
Midterm 2
NAME:
LAB SESSION:
1
2
3
4
5
6
7
15
20
15
10
15
15
10
Sum
100
The depth of a node is the nmber of links on the path from it to the root. The height of the tree is
the maximm depth among its nodes.
1 + q + q 2 + q 3 + . . . +
CIS 121  Fall 2011
Review for Midterm 1
For code fragments whose running time is a constant, do not give a specic number of steps, use
symbolic constants like c1 , c2 , etc. instead, or O(1).
Use this as known:
1 + q + q 2 + q 3 + . . . + q n1 =
qn 1
.
q
CIS 121  Fall 2011
SOLUTIONS  Midterm 1
1
(15 Points)
Sort the following running times so that f(n) is left from g(n) if f(n) is O(g(n) indicating whether
any two are to each other. No proof required.
n!, (log n)2 , 7n500 + 2n , n log n, ( 2)n , log(log