Quiz 2 Info
Quiz 2 Information
Quiz details

Quiz 2 will be held on Thursday, July 19th.

The quiz will be held in HAR 212 at 9:009:30AM:

We will still meet for class the day of the quiz.

You must bring your BU ID to the quiz, so that we can check it when you turn in your quiz.

You will have the 30 minutes for the quiz.

You may not use any electronic devices during the quiz.

Once you leave the quiz room, you may not return, so please use the restroom ahead of time.

The quiz will include questions similar to the ones posed in class – both the clicker questions and the openresponse ones. However, these questions will not be multiplechoice. You will need to determine and write the answer without a list of options to choose from.

In addition, there will be questions that ask you to write a function or a short program, similar to the problems from the homework.
Material covered
The quiz will focus on the material that we have discussed in class from the beginning of the summer session through Monday, July 17th. This corresponds to the following readings:
* Chapter 3: sections 3.2, 3.3, and 3.6.1 (including the box on list comprehensions) * Chapter 4: sections 4.1 and 4.2, and 4.3 (up to and including 4.3.4)
Note: You are not responsible for details from the case studies in the readings (e.g., the information about how RSA encryption works). However, you are responsible for the programming and problemsolving concepts that those case studies were used to illustrate.
In addition, you should be familiar with concepts that were introduced in the preclass videos, inclass discussion, or on the homeworks that were not covered in the readings.
Preparing for the quiz

One way to prepare is to review the readings and lecture notes and make a summary of the key points in your own words. “Boiling down” the material in this way is a great way to ensure that you really understand the key concepts.

We also encourage you to do practice problems (see below).
When working on practice problems, try to come up with your answers on paper, rather than through a trialanderror approach on IDLE or in another programming environment. This will be give you an experience that is similar to the one that you have during the quiz.

Feel free to post questions on Piazza (using the
quiz2
tag) or to email the course account (cs111staff@cs.bu.edu
).
Additional practice problems

Evaluate the following:
[3 for x in range(6)]
[2*y + 1 for y in [1, 3, 5, 7]]
[x for x in range(3, 10) if x % 2 == 0]
[len(w) for w in ['Go', 'Terriers']]
[[w, len(w)] for w in ['Python', 'is', 'amazing!']]

(Recall this function from quiz 1 preparations.) Write a function
num_divisors(n)
that returns the number of integers from 1 ton
(inclusive) that dividen
evenly. For example,num_divisors(42)
should return8
, because 1, 2, 3, 6, 7, 14, 21, and 42 are all divisors of 42. Use a list comprehension. 
Use the above
num_divisors(n)
function in order to write a functionmost_divisors(lst)
that takes in a list of integerslst
and returns the integer from that list with the most divisors. For instance,most_divisors([2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14])
should return12
. Use a list comprehension and a listoflists approach. 
Write a function
longest_string(lst)
that takes in a list of stringslst
as input and returns the longest string from that list. For example,longest_string(['short', 'longer', 'sesquipedalian'])
should return'sesquipedalian'
. 
Add the following two binary numbers:
1 1 0 1 1 0 1 1 1 

Multiply the following two binary numbers:
1 0 1 1 1 1 1 0 1 

Write the complete truth table for the boolean function XYZ + XYZ.

Given the following truth table, perform the minterm expansion for the function
f
. Donâ€™t simplify!x y f(x,y)  0 0 1 0 1 0 1 0 1 1 1 0

Design the circuit for the function from the previous problem.

Design a truth table, minterm formula, and circuit that will implement a 2bit greaterthan function. Your function should take 4 bits of input,
x_{1}
,x_{0}
,y_{1}
andy_{0}
, and produce a true output if and only if the twobit numberx_{1}
x_{0}
is greater than the twobit numbery_{1}
y_{0}
.