Quiz 1 Information
Quiz details
-
Quiz 1 will be held on Thursday 5/22, at a time that you will schedule with your facilitator (links below).
-
You will have 15 minutes for the quiz including writing and testing your code, and submission to Gradescope.
-
Expect 2 short questions. Each will ask you to write a function to solve a problem.
-
This quiz is closed notes/closed books, and without any use of reference materials.
-
There are some sample/pratice questions at the bottom of this page.
Quiz Logistics
-
The quiz will be a live proctored quiz conducted over Zoom.
-
You will meet your facilitator over Zoom and initiate a screen share of your entire desktop. If you have multiple monitors, you must disconnect any secondary monitor before the quiz.
-
Your camera must remain on during the quiz.
-
The facilitators will record all Zoom quiz sessions.
-
-
Use this Calendly link to schedule a time to take the quiz with your facilitator:
-
You should take the quiz by yourself in a quiet room, without assistance from others and without using resources of any kind.
-
You may not communicate with anyone during the quiz. You must not discuss the quiz with classmates until the entire quiz window is closed. Any discussion creates an unfair advantage to students who take the quiz a later time.
-
Aside from the machine on which you are reading the quiz, you must turn off and put away all other electronic devices including your phone, tablets, headphones, etc.
-
You will use Spyder (or another IDE) to write and test your code. Before you begin, you should create an empty file named
quiz1.py
, and close all other Spyder windows (including the console if there is any previous activity). You may run test code and use the console at that time. -
Other than Zoom and Spyder, all other applications should be closed.
-
You may not use ChatGPT or any other AI tools to write solutions for this quiz.
-
Anyone using ChatGPT or other AI tools will receive an automatic grade of F in the course, without exception or the right to appeal.
-
The instructor reserves the right to conduct a separate one-on-one oral examination with any student to verify the student’s understanding of the material.
-
Material covered
The quiz will focus on the material that we have discussed in class during Week 1, i.e., modules 1 and 2. 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
-
Simple decision (if/elif/else) statements
-
Printing outputs to the console.
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
quiz1
tag).
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!es'
. -
Write a function
is_factor(x, n)
and returns the booleanTrue
ifx
is a factor ofn
(i.e., a divisor without remainder), andFalse
otherwise.For example, the function call
is_factor(3, 12)
would returnTrue
, and the function callis_factor(3, 11)
would returnFalse
. -
Write the function
calc_pay(rate, hours)
that returns the amount of pay earned, calculated as follows: the first 40 hours paid at regular rate; hours above 40 paid at 1.5 times the rate.Examples:
calc_pay(25, 20) # 25 hours, $20/hour (all regular pay) 500
calc_pay(45, 20) # 45 hours, $20/hour (5 hours are overtime) 950.0