Quiz: Quarto Websites & Collaborative Coding

Week 5 ยท Advanced Statistical Programming using R

Recap: Version Control & Remotes

Q1

What does the -u flag do in git push -u origin main?

  1. Forces the push, overwriting the remote
  2. Set origin/main as upstream. Plain git push/git pull uses set upstream.
  3. Updates Git itself by pulling the latest Git version.
  4. Pushes all files with no changes.

Answer: 2) -u links your local branch to its remote counterpart. Verify with git remote -v.

Q2

Which .gitignore entry tells Git to ignore all CSV files in your repo?

  1. *.csv
  2. csv/
  3. !csv
  4. #csv

Answer: 1) *.csv matches any file ending in .csv. csv/ ignores a folder; ! negates a prior rule; # starts a comment.

Quarto Websites

Q3

Which one command renders our .qmd files?

  1. pip render
  2. git push -u quarto render
  3. rstudio render *.qmd
  4. quarto render

Answer: 4) quarto render renders all (or some) .qmd files with one command.

Q4

In which file would you implement a custom color theme for your Quarto website?

  1. styles.css
  2. _quarto.yml
  3. about.qmd
  4. index.qmd

Answer: 1) CSS stands for Cascading Style Sheets and is used to customize the appearance of your website.

Q5

Which statements about quarto publish gh-pages are true? (Multiple Answers)

  1. Quarto renders the site locally.
  2. Sends .qmd source files directly to GitHub Pages.
  3. Creates/ updates a gh-pages branch.
  4. Moves your .qmd files from main to gh-pages branch.

Answer: 1 & 3) Quarto renders locally, then pushes rendered HTML to a gh-pages branch. Your .qmd source files stay on main and gh-pages contains the rendered output.

Branches

Q6

Which command creates a new branch eda-plots and switches to it in one step?

  1. git branch eda-plots
  2. git switch eda-plots
  3. git switch -c eda-plots
  4. git merge eda-plots

Answer: 3) -c creates eda-plots branch and git switch moves us to the created branch.

Q7

When is git worktree more appropriate than git stash?

  1. When you want to have access to multiple stashes.
  2. When you want to visualize your branches.
  3. When you need two stashes open at once to compare diffs.
  4. When you need two branches open at once to compare outputs.

Answer: 4) stash is great for short interruptions. git worktree lets you work on multiple branches in parallel.

Collaborative coding

Q8

You are greeted by this merge conflict:

<<<<<<< HEAD
result <- mean(x, na.rm = TRUE)
=======
result <- median(x, na.rm = TRUE)
>>>>>>> feature-branch

What do you do?

  1. Retry with sudo merge.
  2. Run git reset --hard to discard both versions.
  3. Pick the result <- version you want, delete marker lines.
  4. Blame your colleague.

Answer: 3) Pick/ change on of the versions, remove <<<<<<<, =======, >>>>>>>, then mark as resolved.

Q9

Why is Pull Request preferred over pushing directly to main in a group project?

  1. PRs are used for the additional text box and can be self-approved every single time.
  2. PRs allow others to review your changes before merging.
  3. PRs are the only way to push to the main branch on GitHub.
  4. PRs use AI to debug major merge conflicts.

Answer: 2) PRs add review, discussion, and isolation. main branch stays stable while work continues on other branches.

Looking Ahead: R Packages (21.05.2026)

Q10

You have written several useful R functions. What do you think are advantages of bundling them into an R package rather than a functions.R script? (multiple correct answers)

  1. Functions get automatic help pages. ?my_function works.
  2. Other people can install your code with one line: install.packages(...).
  3. Packages always run faster than scripts.
  4. Packages can declare their dependencies in one place.

Answer: 1, 2 & 4) Docs: roxygen comments for auto-generated help pages.
Distribution: install once, call library(...) to load.
Dependencies: necessary packages in DESCRIPTION installed automatically.