Question 1

Evaluate the following limit.

\[\lim_{x \to \frac{\pi}{2}} \frac{\cos(x)}{\cot(x)}\]

# install.packages(c("pracma","Ryacas"))
library(pracma)
library(Ryacas)
## Warning: package 'Ryacas' was built under R version 4.5.2
## 
## Attaching package: 'Ryacas'
## The following object is masked from 'package:stats':
## 
##     integrate
## The following objects are masked from 'package:base':
## 
##     %*%, det, diag, diag<-, lower.tri, upper.tri
x <- ysym("x")
f <- (cos(x) / (cos(x) / sin(x)))
result <- lim(f,x,pi / 2)
result
## y: 1

Question 2

Which one of the following is NOT a factor of 210?

A. 6

B. 14

C. 15

D. 16

# install.packages("tidyverse")
library(tidyverse)
## Warning: package 'lubridate' was built under R version 4.5.2
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.4     ✔ readr     2.1.5
## ✔ forcats   1.0.1     ✔ stringr   1.5.2
## ✔ ggplot2   4.0.0     ✔ tibble    3.3.0
## ✔ lubridate 1.9.4     ✔ tidyr     1.3.1
## ✔ purrr     1.1.0     
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ purrr::cross()    masks pracma::cross()
## ✖ dplyr::filter()   masks stats::filter()
## ✖ dplyr::lag()      masks stats::lag()
## ✖ purrr::simplify() masks Ryacas::simplify()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
q2_data <- data.frame(Choice = LETTERS[1:4],
                      Number = c(6,14,15,16))
correct_answer <- q2_data %>%
  mutate(Factor.of.210 = 210 %% Number == 0) %>%
  filter(Factor.of.210 == FALSE) %>%
  pull(Choice)
cat("The correct answer is:",correct_answer,"\n")
## The correct answer is: D

Question 3

A code consists of six letters chosen from the 26 letters of the alphabet. What is the chance that any two of the letters are the same?

our_letters <- LETTERS # LETTERS: built-in R constant of all capital letters
counter <- 0
N <- 1e5 # 100,000 trials
for (i in 1:N) {
  letters_picks <- sample(x = our_letters,size = 6,replace = T)
  if (length(unique(letters_picks)) < 6) {
    counter <- counter + 1
  }
}
probability <- counter / N
cat("The probability is:",probability,"\n")
## The probability is: 0.46277