Difference between revisions of "CSC111 Midterm Exam Preparation 2015"

From dftwiki3
Jump to: navigation, search
Line 159: Line 159:
 
<br />
 
<br />
 
What does ''immutable'' mean?  What does this term apply to?
 
What does ''immutable'' mean?  What does this term apply to?
 +
<br />
 +
=Question 17=
 +
<br />
 +
Assume that we have lines containing several words, including a phone number.  All the lines contain a phone number.
 +
The area code of the phone number is made of 3 digits, and is always included in parentheses.  There are never spaces between the parentheses and the digits.  Here is one example of a line containing such a number.
 +
<br />
 +
::<source lang="text">
 +
Smith College, Massachusetts, Hampshire County, +1 (413) 585 2700.
 +
</source>
 +
<br />
 +
Write the python code necessary to extract the area code and store it in a variable called <tt>areaCode</tt>.  The contents of the variable will be just 3 digits.  For the string shown above, the variable <tt>areaCode</tt> will contain "413".
 
<br />
 
<br />
 
</onlydft>
 
</onlydft>

Revision as of 21:16, 28 February 2015

--D. Thiebaut (talk) 18:08, 28 February 2015 (EST)


Midterm Exam Prep

The midterm is an in-class exam given under the rules of the honor code. It lasts 70 minutes. It will be closed books, closed notes, closed computers. The questions below will give you a taste for the type of questions you will find in the exam.



...