Chapter 2 · Section 4 practice
Feature Pipelines and Research Applications
These questions review the examples in the companion slides. Choose an answer, then check the explanation.
Question 1
Why can ordinary steps and a short chain give the same table?
- They perform the same operations on the same input in the same order
- A chain always removes missing values
- Chaining changes the formula
- A chain ignores the row index
Question 2
Which write updates the selected cells of the original table?
df.loc[mask]["flag"] = Truedf[mask]["flag"] = Truedf.copy()["flag"] = Truedf.loc[mask, "flag"] = True
Question 3
Why use groupby("ticker")["ret"].shift(1)?
- To average all dates
- To remove every missing row
- To keep each stock’s previous return within that stock
- To copy the last stock’s return into the next stock
Question 4
The first row is January. A three-month window on returns shifted by one first becomes complete in which month?
- March
- April
- January
- February
Question 5
What should happen to the missing initial historical-window values?
- Retain them as missing and report feature coverage
- Replace them by zero return
- Borrow the next stock’s history
- Duplicate the first valid value backwards
Question 6
Two same-date sector momentum values are 0.10 and 0.30. What is the first demeaned value?
- 0.10
- 0.20
- 0.40
- -0.10
Question 7
A sector has only one observed momentum value. Why is its sample z-score missing?
- Its price must be missing
- All singleton groups are data errors
- The sample standard deviation is undefined with one observation
- The stock must have zero risk
Question 8
What does a momentum percentile rank describe?
- Its portfolio weight
- A stock’s relative ordering within the same-date comparison
- Its probability of a positive future return
- Its predicted return in percent