Using Java, Your friend claimed that it is not too difficult to pass an all MCQ based test by guesswork. Being a budding

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Using Java, Your friend claimed that it is not too difficult to pass an all MCQ based test by guesswork. Being a budding

Post by answerhappygod »

Using Java, Your friend claimed that it is not too difficult topass an all MCQ based test by guesswork. Beinga budding programmer (with a background in probability andstatistics J), you decided to writea Java program to put this claim to test. You know that if yourepresent the outcome of the testusing a random variable X, then X follows a binomial distributionwith parameters, k n and p.Here k is the number of successes in n trials and p is theprobability of success in a single trial. Inthis case, n represents the number of questions on the test, krepresents the minimum number ofquestions that you need to pass the test and p is the probabilityof getting a single question right.For a 10-question test, n = 10, k = 6 and p = ΒΌ. (You need 6/10correct answers to pass the testand assuming four choices per question, the probability of gettinga correct answer by guessworkonly is ΒΌ). Test your program n = 10.Binomial Distribution:If a random variable X follows the binomial distribution withparameters n ∈ N and p ∈ [0,1], wewrite X ~ B(n, p). The probability of getting exactly k successesin n independent Bernoulli trialsis given by the probability mass function:𝑓(π‘˜,𝑛,𝑝) = Pr(π‘˜;𝑛,𝑝) = Pr(𝑋 = π‘˜) = .π‘›π‘˜/ 𝑃!(1 βˆ’ 𝑝)"#!for k = 0, 1, 2, ..., n, where:.π‘›π‘˜/ = 𝑛!π‘˜!(𝑛 βˆ’ π‘˜)!is the binomial coefficient, hence the name of the distribution.The formula can be understood asfollows: k successes occur with probability pk and n βˆ’ k failuresoccur with probability (1 βˆ’ p)n βˆ’ k.However, the k successes can occur anywhere among the n trials, andthere are 5"!6 differentways of distributing k successes in a sequence of n trials.Use the following method to compute factorial:
static int factorial(int n){int fact = n;for (int i = n-1; i > 1; i--) {fact *= i;}return fact;}Test your program for 10 questions only.probabilityToPass10Questions = probabilityToPass6Questions +probabilityToPass7Questions +probabilityToPass8Questions + probabilityToPass9Questions +probabilityToPass10QuestionsYou could write a loop for the above or compute each probabilityseparately.No sample I/O provided
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply