Quiz 2 Info
Quiz 2 Information
Quiz 2 will be held on Thursday, July 18th.
The quiz will be held in HAR 210 at 9:00-9: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 open-response ones. However, these questions will not be multiple-choice. 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.
The quiz will focus on the material that we have discussed in class from the beginning of the summer session through Monday, July 15th (including Monday, July 15th). 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 problem-solving concepts that those case studies were used to illustrate.
In addition, you should be familiar with concepts that were introduced in the pre-class videos, in-class 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 trial-and-error 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
quiz2tag) or to email the course account (
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 to
n(inclusive) that divide
nevenly. For example,
8, 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 function
most_divisors(lst)that takes in a list of integers
lstand 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 return
12. Use a list comprehension and a list-of-lists approach.
Write a function
longest_string(lst)that takes in a list of strings
lstas input and returns the longest string from that list. For example,
longest_string(['short', 'longer', 'sesquipedalian'])should return
'sesquipedalian'. Use a list comprehension.
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 2-bit greater-than function. Your function should take 4 bits of input,
y0, and produce a true output if and only if the two-bit number
x0is greater than the two-bit number