Midterm Exam Guide
DANL 101 · Fall 2026
- Date: Monday, October 19, during your scheduled course meeting.
- Format: A closed-book exam conducted on paper, except for the permitted reference sheet described below. Bring a pencil.
- Electronics: No electronic devices are allowed during the exam.
- Question types: multiple-choice questions (MCQ), fill-in-the-blanks, and short answer.
- Planned coverage: Lectures 1–6 and the related classwork and homework, through Data Types, Databases, and Keys, including
left_join().
The goal is to understand concepts, read and complete short R expressions, and explain what results mean. Practice applying ideas to a small, unfamiliar example—not just recognizing code from the slides.
Reference sheet guidelines
- You may bring one handwritten reference sheet on 8.5 × 11-inch regular notebook or printer paper.
- You may use both sides of that one sheet, providing two pages total: front and back.
- The reference sheet must be handwritten, not typed.
- You must submit the reference sheet with your exam.
When preparing your sheet, prioritize definitions you tend to confuse, useful formulas, and short R code patterns. Organize it so you can find information quickly, and make sure you understand the notes you include.
Exam structure
The exam will contain approximately 50% coding questions and 50% discussion-based questions.
- Coding questions: Read, complete, or write short R expressions and pipelines, and explain their results.
- Discussion-based questions: Explain concepts, interpret data or results, and apply ideas to an analytical decision.
Prepare for both kinds of content using the three question formats: multiple choice, fill-in-the-blanks, and short answer.
What to review
1. Data analytics thinking and tools
Review Lecture 1 and Lecture 2.
Be able to:
- Connect a decision to an analytical question, relevant data, a useful comparison, and a possible action.
- Explain the iterative workflow: Ask → Collect → Clean → Explore → Visualize → Communicate → Decide.
- Distinguish descriptive, diagnostic, predictive, and prescriptive questions.
- Interpret a simple decision tree or dashboard without treating a prediction as a certainty or proof of causation.
- Explain how a key performance indicator (KPI) connects a goal to a measure and a response.
- Identify a limitation of a metric: for example, raw NYC311 complaint counts do not automatically measure population-adjusted need or agency performance.
- Distinguish the roles of Excel, R/Python, SQL, RStudio/Posit Cloud, and Git/GitHub. Focus on what each tool does, not memorizing historical job-posting numbers.
2. R fundamentals
Review Lecture 3.
Be able to:
- Create objects with
<-; distinguish assignment from comparison with==. - Recognize numeric, integer, character, logical, and factor values. Explain the difference between a vector and a data frame.
- Use
c(), sequences such as1:5,class(), andlength(); work out the results of simple vectorized calculations and comparisons. - Recognize that a vector has a common type: combining text and numbers can convert its values to character.
- Identify a function name, parameter names, and supplied argument values. Explain named arguments, positional arguments, and default values.
- Use basic functions such as
abs(),sqrt(),round(),log10(),log(), andexp(); recognize the inverse relationship between a logarithm and its corresponding exponential. - Distinguish installing a package from loading it; explain namespaced access such as
dplyr::filter().
Important distinction: In round(3.14159, digits = 2), x and digits are parameter names; 3.14159 and 2 are argument values. Leaving out the name x = is different from leaving out the value.
3. Descriptive statistics and vector filtering
Review Lecture 4.
Be able to:
- Calculate and interpret the mean, weighted mean, median, and statistical mode; choose a sensible measure of a typical value.
- Calculate and interpret the range width, sample variance, sample standard deviation, quartiles, and interquartile range (IQR).
- Use
n - 1when calculating sample variance; explain why variance has squared units and standard deviation has the original unit. - Explain why two datasets can have the same mean but different spread, and why the median and IQR are less sensitive to extreme values than the mean and range.
- Read a boxplot’s median, quartiles, whiskers, and possible outliers. Know IQR = Q3 − Q1 and the usual 1.5 × IQR outlier fences.
- Determine which values
x[2],x[c(1, 3)], andx[x > 10]retain. R counts positions from 1, and logical indexing keeps values markedTRUE.
Watch for: range(x) returns the minimum and maximum; max(x) - min(x) gives the range width. Base R’s mode() is not the statistical mode.
4. Reading, inspecting, and transforming data
Review Lecture 5.
Be able to:
- Read a CSV using
read_csv()with a quoted local pathname or web address. Distinguish absolute paths from relative paths and explain the role of the working directory. - Identify an observation, variable, and value; explain what one row represents and the basic principles of tidy data.
- Inspect a data frame with
dim(),nrow(),ncol(),names(),summary(), andskim(); extract a column as a vector with$. - Read a pipeline from left to right, using
|>or%>%, and assign its result when you want to save it. - Combine comparisons using
&(AND),|(OR), and!(NOT). Separate conditions infilter()with a comma to require both. - Handle missing values using
is.na(),!is.na(), andna.rm = TRUE. Removing missing values for a calculation does not change the original vector.
Know which operation each verb performs:
| Function | What it does |
|---|---|
filter() |
Keeps rows whose conditions are TRUE |
arrange() |
Sorts rows; desc() reverses the direction |
distinct() |
Keeps unique rows or combinations of specified values |
select() |
Keeps or removes columns |
rename() |
Changes a column name: new_name = old_name |
For a short pipeline, explain which rows remain, their order, and which columns appear in the result. Remember that extra variables in arrange() break ties in the preceding variable.
5. Data types, databases, and keys
Review Lecture 6.
Be able to:
- Distinguish structured, semi-structured, and unstructured data.
- Classify variables as nominal, ordinal, interval, or ratio using their meaning, not just their appearance.
- Distinguish measurement scales from R storage types. Numeric IDs can be category labels; coding an ordered rating as numbers does not prove equal gaps.
- Explain the difference between a database, the software that manages it, a CSV file, and a data frame. Describe a table’s schema and what one row represents.
- Identify the matching key between two tables. A join matches key values, not row positions.
- Read or complete
main_table |> left_join(lookup_table, by = "key")and explain the result: left-table records are retained; unmatched added values areNA; unused right-table records do not create new left records. - Explain why repeated matching keys in the right table can multiply rows, and why checking the key and row count matters.
Measurement examples: a preferred shopping channel is nominal; ordered satisfaction categories are ordinal; temperature in °F is interval; minutes spent studying is ratio.
What the question formats involve
| Format | How to prepare |
|---|---|
| Multiple choice | Distinguish related concepts, choose the appropriate function or comparison, and interpret a short example. |
| Fill-in-the-blanks | Supply a term, function, operator, argument, or missing part of a short R expression. Check names, quotes, and parentheses. |
| Short answer | Give a direct answer and a brief explanation. Interpret output in context; include relevant code or calculation steps when the question asks for them. |
Practice the formats
These are illustrative study questions, not the actual exam or a promise of its question distribution. Try each before opening its answer.
Multiple choice: interpreting a variable
Which variable supports a meaningful statement that one observation is twice as much as another?
A. Student ID number
B. Satisfaction category: dissatisfied, neutral, satisfied
C. Temperature in degrees Fahrenheit
D. Minutes spent studying
D. Minutes spent studying. Duration is a ratio variable: zero minutes means no study time, and 40 minutes is twice as long as 20 minutes. An ID is a label, satisfaction categories do not guarantee equal gaps, and Fahrenheit’s zero does not mean no temperature.
Fill-in-the-blanks: missing values
Complete the argument name so R calculates the mean using the observed scores. What result will it return?
scores <- c(65, NA, 85)
mean(scores, ____ = TRUE)The missing argument name is na.rm.
mean(scores, na.rm = TRUE) # 75The mean of 65 and 85 is 75. The missing value is omitted for this calculation; scores still contains NA.
Fill-in-the-blanks: a transformation pipeline
Complete the pipeline to keep students with a score of at least 80, sort from highest to lowest score, and keep only the two listed columns. What rows remain, and in what order?
library(dplyr)
students <- data.frame(
student = c("Jordan", "Maya", "Leo", "Noor"),
score = c(70, 90, 80, 65)
)
results <- students |>
____(score >= 80) |>
arrange(____(score)) |>
select(student, score)Use filter and desc, respectively.
results <- students |>
filter(score >= 80) |>
arrange(desc(score)) |>
select(student, score)The result has Maya (90) followed by Leo (80), with the columns student and score. filter() changes which rows remain; arrange() changes their order; select() specifies columns.
Short answer: choosing a measure of center
A café records the wait times for five customers: 2, 3, 4, 5, and 26 minutes. Calculate the mean and median wait times. Which measure better represents a typical customer’s wait in this sample? Explain how the 26-minute wait affects your choice.
The mean is 8 minutes: (2 + 3 + 4 + 5 + 26) / 5 = 8. The median is 4 minutes, the middle value in the sorted list.
The median better represents a typical customer’s wait in this sample. Four customers waited between 2 and 5 minutes, while the 26-minute wait pulls the mean upward. The median is less affected by that unusually long wait.
Short answer: reading a left join
Consider these small fictional tables:
order_id |
customer_id |
|---|---|
| 1 | A |
| 2 | A |
| 3 | C |
customer_id |
city |
|---|---|
| A | Geneseo |
| B | Rochester |
The first table is orders; the second is customers.
orders |> left_join(customers, by = "customer_id")How many rows are returned? Which city is attached to each order? Does customer B create an additional order row? Explain briefly.
The result contains three rows, retaining all three orders. Orders 1 and 2 receive Geneseo because both match customer A. Order 3 receives NA for city because C has no match. Customer B does not create an additional order row: the left join keeps the orders, not unused customer records. Here the right table has one row per customer ID, so no order is multiplied by repeated matches.
How to study
- Review actively. For each topic above, explain one example in your own words before checking the slides.
- Redo the relevant work. Use Classworks 1–9 and Homeworks 1–2. Cover the examples and answers, complete the task, then compare your reasoning.
- Work out the result, then check. Work out what a short R expression or pipeline will return before running it. Compare the actual output with your expected result and explain any differences.
- Practice all three formats. Recognizing an answer is not the same as filling in code or explaining a result. Practice without relying on auto-completion or copied answers.
- Prepare your reference sheet. Follow the one-sheet guidelines above. Follow the syllabus’s academic-integrity policy; your exam responses must be your own work.
You are ready when you can choose an appropriate method, complete a short expression, and explain what its result means—not just name the function.
