Selected Past Exam Questions for Final

DANL 101 · Fall 2026

Author

Byeong-Hak Choe

Published

December 1, 2026

NoteAbout these questions

The Final Exam is cumulative: material from before and after the midterm can appear. These 37 selected past exam questions provide practice with data and R fundamentals, transformation, visualization, relationships, communication, and AI. Wording and data displays have been adjusted where needed to fit Fall 2026 course material.

This is an untimed question bank, not a prediction of the final’s questions or topic weights. For more practice with earlier topics, see the selected past midterm questions. Answer each question before opening its solution. Assume dplyr, ggplot2, and forcats are loaded when their functions are used. All information needed to answer the questions appears below; no data download is required.

Data tools and structure

Question 1 — Multiple choice: business intelligence

Which statement best describes the role of business intelligence (BI)?

A. It replaces managers’ judgment by automatically making every decision.
B. It uses reports and dashboards to help people understand outcomes and investigate what happened.
C. It is only a place to store raw data for later retrieval.
D. It is another name for training a machine-learning model.

B. BI helps people monitor measures, explore patterns, and make informed decisions. It does not by itself remove the need for human judgment.

Question 2 — Multiple choice: evidence in sports analytics

What was a central contribution of Moneyball to sports management?

A. It replaced coaches and scouts with automated decisions.
B. It changed the official rules of baseball.
C. It popularized the use of statistical evidence to question familiar player measures and identify undervalued players.
D. It showed that player statistics are never useful without a very large payroll.

C. The example illustrates using data to test assumptions and inform roster decisions. Statistical evidence can complement human expertise; it does not remove the need for judgment.

Question 3 — Multiple choice: spreadsheets and databases

Why are Excel and Google Sheets not full database management systems (DBMSs)?

A. They cannot store numbers.
B. They offer useful tables, but lack many database capabilities for managing large, related datasets and controlled multiuser updates.
C. They cannot create charts.
D. They cannot open CSV files.

B. A spreadsheet can store and analyze tabular data, but a DBMS is designed to manage database tables, relationships, queries, and updates reliably.

Question 4 — Multiple choice: a key variable

In a customers table with one row per customer, what is the best role for a unique customer_id?

A. It measures the customer’s spending.
B. It identifies each customer row and can match that customer to rows in a related orders table.
C. It forces the orders table to have only one order per customer.
D. It sorts customers by name automatically.

B. The ID identifies a customer in the customer table and can be used to match related records. The same customer ID may appear in several order rows.

Question 5 — Fill in the blank: database language

____________________ is the language commonly used to request and work with tables in a relational database. DANL 101 uses R to analyze data after importing it into a data frame.

SQL (Structured Query Language). SQL is used to query database tables; R is the programming language used for hands-on analysis in this course.

R fundamentals and data transformation

Question 6 — Multiple choice: factor levels

Consider this R object:

major <- factor(c("ECON", "DANL", "ECON", "MGMT", "DANL"))

What does levels(major) return?

A. c("ECON", "DANL", "ECON", "MGMT", "DANL")
B. c("DANL", "ECON", "MGMT")
C. 5
D. 3

B. The factor has three distinct levels, alphabetically ordered by default. levels() returns their labels; nlevels(major) would return 3.

Question 7 — Multiple choice: extracting a column

The data frame df has variables height and name. Which expression returns the values in height as a vector?

A. df:height
B. df$height
C. df::height
D. Both B and C

B. df$height. The $ operator extracts a named column from a data frame. :: is used with package namespaces.

Question 8 — Multiple choice: an R development environment

Which tool is a desktop integrated development environment (IDE) primarily used for writing and running R code?

A. Posit Cloud
B. Google Colab
C. Git
D. RStudio

D. RStudio. RStudio is an IDE that can be installed on a computer. Posit Cloud provides an RStudio working environment through a web browser.

For Questions 9–11, use the NYC dog-license data frame nyc_dogs. It has 197,473 observations and five variables. The first ten observations are shown below; NA marks a missing value.

name gender birth_year breed borough
paige F 2014 pit bull Manhattan
yogi M 2010 boxer Bronx
ali M 2014 basenji Manhattan
queen F 2013 akita Manhattan
lola F 2009 maltese Manhattan
ian M 2006 NA Manhattan
buddy M 2008 NA Manhattan
chewbacca F 2012 labrador Manhattan
heidi-bo F 2007 dachshund smooth coat Brooklyn
massimo M 2009 bull dog, french Brooklyn

Variable descriptions: name is the dog’s name; gender is F, M, or missing; birth_year is the dog’s birth year; breed is its recorded breed or missing; borough is the New York City borough. For the full data frame, the 25th percentile of birth_year is 2010, the median is 2014, and the 75th percentile is 2017. Do not calculate these quartiles from only the ten displayed rows.

Question 9 — Short answer: interpreting a median

The median birth_year in the full nyc_dogs data frame is 2014. Explain what that says about the recorded birth years. Do not use only the ten displayed rows.

At least half the recorded dog-license rows have birth_year 2014 or earlier, and at least half have birth_year 2014 or later. This describes the center of the observed birth years in the full data frame; it does not mean that every dog was born in 2014.

Question 10 — Multiple choice: counts by two variables

Which code counts dogs for every combination of borough and birth_year?

A. nyc_dogs |> count(borough)
B. nyc_dogs |> count(birth_year)
C. nyc_dogs |> count(borough, birth_year)
D. nyc_dogs |> count(birth_year, borough)
E. Both C and D

E. Both C and D group by the same two variables and give one count per combination. They differ in column order and, possibly, row order.

Question 11 — Multiple choice: top breeds

Which pipeline finds the seven most frequently recorded nonmissing breeds in the full nyc_dogs data frame? head(7) keeps the first seven result rows.

A. nyc_dogs |> filter(!is.na(breed)) |> count(breed) |> arrange(desc(n)) |> head(7)
B. nyc_dogs |> filter(is.na(breed)) |> count(breed) |> arrange(desc(n)) |> head(7)
C. nyc_dogs |> filter(!is.na(breed)) |> count(breed) |> arrange(n) |> head(7)
D. nyc_dogs |> filter(!is.na(breed)) |> select(breed) |> arrange(desc(n)) |> head(7)

A. Remove missing breeds, count dogs by breed into n, sort n from largest to smallest, then retain seven rows. C selects the least frequent breeds; D never creates n.

Distributions and graphics

Question 12 — Fill in the blanks: point transparency

In ggplot2, setting alpha to __________ makes a point fully transparent; setting it to __________ makes the point fully opaque.

0; 1. Values between 0 and 1 make points partly transparent, which can help reveal where many points overlap.

Question 13 — Multiple choice: the basic grammar of a plot

Which component is not required to make a basic ggplot2 graphic?

A. Data
B. Aesthetic mappings
C. A geometric object, such as points or bars
D. Facets

D. Facets. A basic plot needs data, mappings, and a way to draw marks. Facets are optional panels used to compare groups.

Question 14 — True or false: chart types

Categorical distributions are commonly displayed with histograms, whereas numerical distributions are commonly displayed with bar charts.

A. True
B. False

B. False. Histograms bin numerical values; bar charts count or summarize categories.

Question 15 — Multiple choice: a left-skewed distribution

For the familiar single-peaked, left-skewed curve shown in lecture, which order from smallest to largest is shown for the mean, median, and mode?

A. Median < mode < mean
B. Mean < median < mode
C. Mode < mean < median
D. Mean = median = mode

B. In the lecture’s left-skewed example, the long tail toward smaller values pulls the mean farthest left, while the mode remains at the peak. This is the ordering for that familiar curve, not a rule guaranteed for every possible left-skewed distribution.

Question 16 — Multiple choice: two numerical variables

Which chart is most suitable for examining how two numerical variables move together?

A. Bar chart
B. Histogram
C. Scatterplot
D. Pie chart

C. Scatterplot. Each point uses one observation’s two values for its horizontal and vertical positions.

For Questions 17–18, top7_breeds is the following result of counting the most frequently recorded, nonmissing breeds in the full nyc_dogs data frame:

breed n
yorkshire terrier 12,804
shih tzu 12,790
chihuahua 11,099
labrador 11,017
pit bull 10,023
maltese 7,750
german shepherd 5,063

n is already a count of dogs in each breed.

Questions 17–18 ask you to complete the ggplot2 code for this target chart:

Horizontal bar chart of the seven most common recorded dog breeds, sorted by license count. Yorkshire terrier and shih tzu have the longest bars; German shepherd has the shortest.

Target chart for Questions 17–18.

Question 17 — Multiple choice: bars from existing counts

Which function should fill the blank to plot horizontal bars whose lengths come from n?

ggplot(top7_breeds, aes(x = n, y = breed)) +
  ________()

A. geom_bar
B. geom_col
C. geom_histogram
D. geom_point

B. geom_col. It uses the values already stored in n. The default geom_bar() would count the seven rows of the summary table instead.

Question 18 — Multiple choice: ordering the bars

Which mapping orders the breed labels by their counts in a horizontal geom_col() chart?

A. aes(x = n, y = fct_reorder(breed, n))
B. aes(x = breed, y = fct_reorder(n, breed))
C. aes(x = n, y = fct_reorder(n, breed))
D. aes(x = breed, y = n)

A. fct_reorder(breed, n) reorders the categories using their associated counts. Mapping breed to y gives horizontal bars when paired with x = n and geom_col().

For Questions 19–20, consider health_cust, a four-state extract of a data frame with one row per customer. It includes California, New Jersey, New York, and Pennsylvania. state_of_res gives the state, health_ins is TRUE if the customer has health insurance, and is_employed is TRUE, FALSE, or NA when employment status is unknown. The target chart excludes unknown employment status:

Two panels for employed FALSE and TRUE. Each panel has horizontal 100-percent stacked bars for California, New Jersey, New York, and Pennsylvania, divided into customers with and without health insurance.

Target chart for Questions 19–20.

Question 19 — Multiple choice: within-state proportions

Which layer makes a bar chart of the proportion with and without health insurance within each state, rather than a chart of raw counts?

ggplot(health_cust |> filter(!is.na(is_employed)),
       aes(y = state_of_res, fill = health_ins)) +
  ________

A. geom_bar(position = "stack")
B. geom_bar(position = "fill")
C. geom_col(position = "fill")
D. geom_histogram()

B. geom_bar() counts rows; position = "fill" rescales each state’s stacked bar to a total of 1. geom_col() expects a precomputed numeric value, which this mapping does not supply.

Question 20 — Fill in the blank: separate panels

Complete the code so employed and non-employed customers appear in separate panels:

ggplot(health_cust |> filter(!is.na(is_employed)),
       aes(y = state_of_res, fill = health_ins)) +
  geom_bar(position = "fill") +
  __________(~is_employed)

facet_wrap. facet_wrap(~is_employed) makes a separate panel for each observed employment status.

Question 21 — Short answer: accessible visual design

Give three ways to make a visualization easier to read for someone with a color-vision difference.

For example: use a palette whose colors remain distinguishable, label groups directly or in a clear legend, and add noncolor cues such as different point shapes or line types. Check that the colors and labels have enough contrast. Any three concrete methods earn credit in this practice question.

Question 22 — Short answer: turning analysis into a data story

A project team has summarized a dataset and prepared a chart for a campus audience. Name two additional choices that would help turn the analysis into a useful data story, and briefly state why each choice matters.

For example, the team could select the finding that matters to this audience and explain its practical context, so viewers know why it matters. It could also add a concise narrative or annotation that states what the chart shows and what decision the evidence could inform. A useful story connects sound analysis, visual design, and a clear message; it should not claim more than the data support.

Machine learning and AI

Question 30 — Short answer: two learning tasks

Compare supervised and unsupervised learning. Give one business example of each and state which one needs known outcome labels in its training data.

Supervised learning uses inputs paired with known outcomes; for example, past customer information paired with whether each customer bought a product can train a purchase classifier. Unsupervised learning finds patterns without supplied outcome labels; for example, clustering customers by visit frequency and spending. The analyst still has to interpret the clusters.

Question 31 — Multiple choice: deep learning

Which statement best distinguishes deep learning within the broader field of machine learning?

A. Deep learning is a name for writing explicit rules for every possible input.
B. Deep learning uses neural networks with many layers to learn patterns in data.
C. Deep learning is the practice of giving a trained model a more detailed prompt.
D. Other machine-learning methods cannot make predictions.

B. Deep learning is a machine-learning approach based on many-layered neural networks. Decision trees and regression are other machine-learning methods; prompting a trained model is a different activity.

Question 32 — Multiple choice: pre-training

What is the main purpose of pre-training a large language model?

A. To have people rank two answers by preference for a specific prompt
B. To learn broad language patterns from large collections of text before the model receives the present user’s task
C. To guarantee every generated statement is correct
D. To remove the need for later instructions and evaluation

B. Pre-training learns broad patterns, often through predicting pieces of text. Later training and instructions can shape how the model responds, but neither guarantees accuracy.

Question 33 — Multiple choice: fine-tuning

After broad pre-training, a language model is shown examples of desired responses to prompts and is further trained to respond in that style. What is this step called?

A. Tokenization
B. Fine-tuning
C. Database normalization
D. Unsupervised clustering

B. Fine-tuning. Examples of desired responses help shape how a pretrained model answers. This is distinct from the broad pattern learning in pre-training and from using people’s comparisons of responses in RLHF.

Question 34 — Multiple choice: human feedback

Which description best fits reinforcement learning from human feedback (RLHF)?

A. People compare or score model responses, and those preferences guide further training.
B. The model learns entirely on its own without human input.
C. The model reads only images to learn visual patterns.
D. Users change a spreadsheet formula after an AI answer.

A. Human comparisons provide preference information that can guide training. This can shape behavior but does not guarantee that every answer is factual or appropriate.

Question 35 — Multiple choice: tokens

Which statement about tokens in a large language model is most accurate?

A. A token is always exactly one English word.
B. A token is always a single character.
C. Tokens exist only in the model’s output.
D. A token is a piece of text that may be a character, word, or part of a word.

D. A model processes text in tokens. Both the supplied context and generated response use them.

Question 36 — Multiple choice: human oversight

Which is not one of the four rules for working with AI discussed in class?

A. Always invite AI to the table.
B. Be the human in the loop.
C. Automate every decision and remove human responsibility.
D. Treat AI like a person—but tell it what kind of person it is.
E. Assume this is the worst AI you will ever use.

C. The rules call for human responsibility and judgment. In the current course discussion, a role can guide an AI response’s tone or perspective, but an expert label does not create expertise.

Question 37 — Multiple choice: AI-assisted coding

Which workflow best describes responsible use of an AI assistant to help write data-analysis code?

A. Copy the generated code into a report without running it.
B. Ask AI for code, run it on the intended data, inspect the result, and correct errors or unsupported claims.
C. Assume that plausible code must use the intended variables.
D. Let AI choose and publish the final finding without checking the analysis.

B. Generated code is a proposal to check. The analyst remains responsible for the variables, computation, result, and final claim.

Back to top