## Quiz 12: Policies and Information

### Location, Date, and Time

Conflicts: There will be no conflict quiz as students are able to choose the time and date of their quiz.

### Quiz Content

All quizzes are cumulative. Previous material can reappear on a later quiz.

11.1: Functionals

Provided with: Apply Functions Cheatsheet

Ubiquitousness of Functions:

• Why are functions considered to be the lingua franca of programming languages?
• How does John Chambers’ explanation of R address functions?

Environments:

• Why do we have environments?
• How does scoping affect the ability to see problems in code?

Overview of Functionals:

• Why is R considered a functional programming language?
• What are functionals?
• How are functionals related to loops?
• Why does a functional emphasize an action over objects?
• How are Ellipsis or dot-dot-dot ( … ) useful with functionals?
• How is the split-apply-combine paradigm related to functionals?

Functionals in Practice:

• When should functionals be used?
• Why should functionals be used over copying and pasting code?
• How is lapply() different from sapply()?
• What happens when apply() is used with two margins on a 2D data structure? If we wanted the correct result, what kind of dimension would we need?

An Odyssey in purrr:

• How are the functions in purrr similar to Base R’s?
• Why do we want a type stable function?

11.2: Regular Expressions

Provided with: String Manipulation Cheatsheet

Background:

• What are regular expressions?
• Why are regular expressions useful?

Using Regex:

• Literals and Meta Characters
• What is the difference between a literal character and a meta character?
• How can meta characters be used inside patterns like a traditional literal?
• Character Classes
• How many symbols does a character class detect by default? Why is this the case?
• Explain the regex pattern: [^n]
• Are the following two regexes equivalent: [:alpha:] vs. [[:alpha:]]?
• Compare and contrast the str_*() and str_*_all() functions in stringr?
• Quantifers:
• What are the primarily differences between ?, *, and +?
• How could we obtain exactly p pattern matches simultaneously?
• When might we not want to use greedy regex?
• Should regex be used to work on all structures of data?
• Groups and Backreferences:
• How do groups relate to backreferences?
• Why are backreferences useful for extracting and replacing values?
• Anchors
• What are the two meanings of ^ as it relates to being at the start of the string vs. inside the character class?

### Materials Needed

• Preferably, a rested mind and non-broken hands that can type.

### Policies

• All answers must be reasonably simplified.
• Decimals answers must contain two significant digits.
• Grading will be done as follows:

If you have a technical issue while answering questions or need assistance with opening or starting the quiz, please alert the proctor.

Do not leave the CBTF without filing an issue with the proctor if something goes wrong.

### DRES

Have a testing accommodation? Please see how the CBTF handles Letters of Accommodation.

The short version: Please bring a copy of the Letter of Accommodation to the CBTF Proctors prior to the test taking place.

In short, don’t cheat. Keep your eyes on your own quiz. Do not discuss the quiz with your friends after you have taken it. Any violation will be punished as harshly as possible.

The best way to study for a STAT 385 quiz is by writing and reading code. Try to take an idea in STAT 385 and apply it to your own work.

With this being said, there are three other resources that may assist your studies:

• Topic Outline (Above)
• Lecture Code
• Homework

Again, the best way to study is to do programming in some fashion. Whether that be writing code or explaining how code works to someone else.

Consider using resources such as:

1. RStudio Cloud Primers for interactive practice.
2. Exercise problems listed in a given section of the readings.

Do not spend time memorizing lecture slides. You will not see any verbatim questions.

Do not try pulling an all-nighter. You can schedule your quiz anytime between a time window. To program efficiently, you need sleep despite the quote:

“Programmers are an organism that turns caffeine into code.”

#### What kind of question types are on the quiz?

There are generally four types of problems:

• True / False
• Multiple Selection (e.g. select ALL correct answers from a list)
• Fill in the blank
• Writing Code

#### How many problems are on the quiz?

Only one question with 15012391 subquestions. In all seriousness, do not fixate on a number. There will be a reasonable amount of questions for the time period.

#### How long will it take to do the quiz?

Depending on your background, the quiz may take:

• Prior R in-depth experience: 25 minutes
• Some R experience: 35 minutes
• No R experience: 50 minutes

Avoid fixating on time. Life will come and go more quickly than you realize. Focus more on the content.

#### When will the quiz be returned?

As all problems are automatically graded, we should be able to post the quiz results after the examination window closes.

No.

#### We got our grades back, now will the quiz be curved?

No. Curving is only done sparingly at the end of the semester. Individual assignments are not modified.