Quiz 1 Information
Quiz details
-
Quiz 1 will be held on Wednedsay 5/27, beginning promptly at 9:30am.
-
The quiz will be on paper, and you will be expected to write/explain some code that is similar to work you did in the problem set.
-
Expect 2 short questions.
You will have 20 minutes for the quiz including.
-
This quiz is closed notes/closed books, and without any use of reference materials. No computers, phones, AI glasses, or other electronic devices are permitted.
-
There are some sample/pratice questions at the bottom of this page.
Material covered
The quiz will focus on the material that we have covered in module 1 and problem set 1. You must be familiar with concepts and syntax that were introduced in the pre-class videos, in-class discussion, or on the problem sets even if they were not covered in the videos or readings, specifically including:
-
Data and variables: integers, floating point numbers, strings, and lists
-
Arithmetic operations on numeric data
-
Sequence operations (concatenation, indexing and slicing) on strings and lists.
-
Writing functions that take parameters and return results
Preparing for the quiz
-
One way to prepare is to review the videos and readings and class notes and make a summary of the key points in your own words. “Summarizing” 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. Options include:
-
Redoing the problems from the problem sets.
The quiz problems will tend to be short rather than long or complicated). -
Additional practice problems (below)
-
-
When working on practice problems, try to write and test your answers in Spyder (or another IDE). This will be give you an experience that is similar to the one that you have during the quiz. Do not use any outside references, as these will not be available during the quiz.
-
Feel free to post questions about the material covered on the quiz on Piazza (using the
quiz1tag).
Additional practice problems
-
Given the string
s = 'Marathon', evaluate the following expressions:s[0]s[0:1]s[1:]s[-1]s[3: :-1]s[2: :2]
-
Given the list
myList = [3, 2, -1, [4, 7], 5], evaluate the following expressions:myList[0]myList[0:1]myList[-1]myList[3]myList[:2]myList[2: :2]
-
Write a function
to_celsius(degrees_f)which returns the temperature in Celsius, given the temperature in degrees Fahrenheit. The temperature in Celsius is the amount in Farenheit - 32, times 5/9. For example, the function callto_celsius(50)would return the value10, because 50 degrees F is 10 degrees C. -
Write a function
make_password(word, num, symbol)which takes 3 parameters: aword, anumber, and asymbol, and returns a string which is the password. The password must contain the first 4 characters ofword, the numbernum, thesymbol, and then the rest of the word.For example the function call
make_password('beatles', 1962, '!')would return the string'beat1962!les'.