Statistics Technology & Digital Applications 4 — Questions and Answers
Question 1: Which Python pandas method removes rows with any missing values from a DataFrame named df?
- df.fillna(0)
- df.dropna() (Correct answer)
- df.isna()
- df.replace(NaN, 0)
Correct answer: df.dropna()
df.dropna() returns a new DataFrame with rows containing any NaN values removed by default.
Question 2: In R, the function lm(y ~ x, data=df) fits a linear model. Which function extracts the model's R-squared value from the result object?
- coef()
- residuals()
- summary()$r.squared (Correct answer)
- predict()
Correct answer: summary()$r.squared
summary() on an lm object returns a list, and the $r.squared element specifically extracts the coefficient of determination.
Question 3: A data analyst exports a statistical report to a CSV file. Which delimiter character defines a CSV (Comma-Separated Values) file?
- Tab character
- Semicolon
- Comma (Correct answer)
- Pipe symbol
Correct answer: Comma
CSV files use commas as the field delimiter by default, though regional variants sometimes use semicolons.
Question 4: In Google Sheets, which function calculates the p-value for a two-tailed t-test between two data ranges A1:A30 and B1:B30?
- =CORREL(A1:A30,B1:B30)
- =TTEST(A1:A30,B1:B30,2,2) (Correct answer)
- =CHISQ.TEST(A1:A30,B1:B30)
- =ANOVA(A1:A30,B1:B30)
Correct answer: =TTEST(A1:A30,B1:B30,2,2)
TTEST() with tails=2 and type=2 (two-tailed, two-sample equal variance) returns the p-value for comparing two independent groups.
Question 5: A machine learning pipeline uses scikit-learn's train_test_split(). Setting random_state=42 ensures what?
- 42% of data goes to training
- The split is always stratified
- The same split is reproduced every run (Correct answer)
- 42 cross-validation folds are used
Correct answer: The same split is reproduced every run
random_state seeds the random number generator so the same training/test split is produced each time the code is run.
Question 6: Which data visualization principle is violated when a bar chart's y-axis does not start at zero?
- Data-ink ratio
- Truncated axis bias (Correct answer)
- Overplotting
- Simpson's paradox
Correct answer: Truncated axis bias
A truncated y-axis exaggerates differences between bars, creating a misleading visual impression of the relative magnitudes.
Question 7: In a relational database, a statistician joins two tables to merge survey responses with demographic data. Which JOIN type returns only rows with matching keys in both tables?
- LEFT JOIN
- RIGHT JOIN
- FULL OUTER JOIN
- INNER JOIN (Correct answer)
Correct answer: INNER JOIN
INNER JOIN returns only the intersection — rows where the join key exists in both tables, discarding non-matching rows from either side.
Which Python pandas method removes rows with any missing values from a DataFrame named df?