rm(list = ls())

Question1

n <- 20
p <- 0.5
prob <- sum(dbinom(9:12, size=n, prob=p))
prob
## [1] 0.6166897

The probability of 9 to 12 buyers prefer red is 0.6167

Question 2

n<- 13
x<- 0.8
pi<- .2
binom<-dbinom(0:n, n, pi)
sum(binom[5:6])
## [1] 0.2226404

The probability of less than 6 but more than 3 bulbs from the sample are defective is 0.2226

Question 3

pnorm(3,mean=4.2,lower.tail=TRUE)
## [1] 0.1150697

The probability of number of special orders sent out will be no more than 3 is 0.1151

Question 4

n<- 17
x<- 3
pi<- 6/17
binom<-dbinom(0:n, n, pi)
round(sum(binom[0:2]),4)
## [1] 0.0063

The probability of less than 2 of the tested bottles were contaminated is 0.0063

Question 5

n<- 6
x<- 6
pi<- 6/25
binom<-dbinom(0:n, n, pi)
sum(binom[2:7])
## [1] 0.8073001

The probability of more than 1 employee was over 50 is 0.8073.

Question 6

sqrtvar = sqrt(90000)
upp<-pnorm(1040,mean=800,sd=sqrtvar, lower.tail=FALSE)
low<-pnorm(1460,mean=800,sd=sqrtvar, lower.tail=FALSE)
round(sum(upp)-sum(low),4)
## [1] 0.198

The probability of the weight of a randomly selected steer is between 1040 and 1460 lbs is 0.1980.

Question 7

mean = 106
x<-103:111
upp<-pnorm(103,mean=106,sd=4, lower.tail=FALSE)
low<-pnorm(111,mean=106,sd=4, lower.tail=FALSE)
sum(upp)-sum(low)
## [1] 0.6677229

The probability of the diameter of a selected bearing is between 103 and 111 millimeters is 0.6677

Question 8

mean <- 3.34
sd <- 0.07
z1 <- qnorm(0.03, mean=0, sd=1)
z2 <- qnorm(0.97, mean=0, sd=1)
lower_bound <- mean + z1 * sd
upper_bound <- mean + z2 * sd
round(lower_bound, 2)
## [1] 3.21
round(upper_bound, 2)
## [1] 3.47

The nails are considered too long at or more than 3.47 cm, and too short at or less than 3.21 cm.

Question 9

qnorm(.91,mean=75.8,sd=8.1, lower.tail=TRUE)
## [1] 86.66012

The minimum score to get an A is 87.

Question 10

n<- 155
x<- 96
pi<- .61
dbinom(96, n, pi)
## [1] 0.06402352

The probability is 0.0640