6个多项选择题中有3个错误的多项选择题的概率是多少?

问题描述

BCS 2级考试有6个多项选择题,其中有4个选择,每个都有一个正确答案。如果仅对6个问题中的每一个进行随机猜测,那么准确地获得3个问题的概率是多少?

解决方法

这个问题是关于二项分布https://en.wikipedia.org/wiki/Binomial_distribution

对于任何单个问题,您只有p_wrong = 3/4,因为只有1/4正确。然后,您要问P(3错误| 6次试验)“给定6次试验3次错误的概率”。

P(3错误| 6)=(6选择3)(3/4)^ 3(1/4)^ 3

6选择3 = 6! / 3!(6-3)! = 4 5 6 /(3 2 1)= 20

于是20 *(3/4)^ 3(1/4)^ 3 = 0.1318359375

编辑您可以通过以下方式在Python中进行模拟:

import random
def sim(k,N):
  trial_count = 0
  for i in range(N):
    # simulate a 6 question test
    test_count = 0
    for j in range(6):
      # we'll say you got it right if you get a 1,else it's wrong
      c = random.randint(1,4)
      if c == 1:
        test_count += 1
    # after the test see how many they got right,if it's k
    if test_count == k:
      trial_count += 1
  # after all the trials return the probability
  return trial_count/N
# getting exactly 3 wrong on a 6 Q test is the same as exactly 3 right
print(sim(3,1_000_000)

或在APL中短一点;)

sim←{(+/⍺=+/1=?⍵ 6⍴(6×⍵)/4)÷⍵}
3 sim 1e6

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...