Category Archives: random thoughts

On the number of correct answers required in a multiple-choice test

I have been preparing a multiple choice test for our Racket course. The test will consist of 30 questions, each of which has 4 options and only one of them is the correct answer. Students will need to answer to at least 15 questions to pass the test.

Where are these numbers coming from? Why 15 out of 30 and not 12 (40%)? Why 4 options and not 2, with a true/false option only? More importantly: how many questions will be answered correctly by someone selecting random answers?

Let’s suppose that a student is answering randomly. What is the probability that the student answers all questions in the wrong way? This is not difficult to compute: in our case this is (\frac{3}{4})^{30} = 0.0001785. What about one right and 29 wrong? This is \frac{1}{4} multiplied by (\frac{3}{4})^{29}, but you should also remember that there are 30 different ways to get a question right (it could be the first or the second or … or the thirtieth). So, overall, the probability of getting 1 question right and 29 wrong is  30 \cdot \frac{1}{4} \cdot (\frac{3}{4})^{29}. This is nearly ten times more likely than getting all the questions wrong.

In general, what is the probability of getting n questions right and 30-n wrong? This is \frac{1}{4}^n \cdot \frac{3}{4}^{(30-n)}, but we should also multiply this number by the possible combinations of n elements out of 30, that is:

    \[ P(n) = (\frac{1}{4})^n \cdot (\frac{3}{4}))^{(30-n)} \cdot \binom{30}{n} \]

The following is a plot of this function:

prob_correctAs you can see this function has a peak for n=6; the average is \sum n \cdot P(n) = 7.5. So, on average, a “random answerer” would get 7.5 questions right. What is the probability of passing the test by answering randomly? We need a cumulative function for this. Let’s plot the probability of passing a test where it is required to answer n questions correctly out of 30 (this is the line in red; the blue line is P(n) as defined above):


The probability is obviously 1 if no correct answers are required, and then it decreases reaching 0.001 for n=15. Going back to the original question: the probability that a student answering randomly passes the test is 0.1%.

[Thanks to Lorenzo Gheri for his input on this :-)]

Gender and STEM subjects


A display in a primary school in London, taken 18/11/2013.

(I know that discussions about gender can be polarizing and I’ve never thought of writing about this topic. However, as I have a daughter, I wanted to share with you some of my opinions. In addition, I have asked two friends of mine to comment on this. Kelly is a Senior Lecturer in Computer Science and Monica is an English teacher in an Italian high school; their comments are below).

My daughter is nearly 4 year old, she attends what is considered an excellent nursery and three weeks ago she was upset with me. She was very upset, because I was reading her a story in which Peppa plays the role of a dentist and George (Peppa’s brother) is the nurse. “NO DAD!! PEPPA CANNOT BE THE DENTIST, SHE IS A GIRL! George is the dentist, Peppa is the nurse!”.

I obviously asked her why she thought so, and she said “because nurses are girls, and doctors are men!” (sic). Not only that, but she also told me that only boys are allowed to play Spider-man.

Since then, I started paying attention to kids’ attitude towards gender and I started realising that already at the age of three most kids have a clear difference between male and female and they clearly associate different roles to different genders: princesses are pink and they wait (for a prince, or at home, or locked in a tower), knights fight, Bob the builder fixes things and nurses help doctors in hospitals. At the nursery, boys play football and girls play in the kitchen corner. At my daughter’s nursery all teachers are female. My wife is probably the only mother with a full-time job. The most strange thing for me is that when kids  discriminate based on gender (I have heard “you are not allowed to play with dolls because you are a boy” and “you cannot be a fireman because you are a girl“) the adults’ reaction is very mild and sometimes there is no reaction at all (I’m not talking about the nursery, but about social life in general). In contrast, discrimination on other grounds is taken very very seriously.

After dropping my daughter to her nursery I usually cycle to work and there I am faced with a completely different situation. I have been working in Computer Science departments in the UK since 2000, and I have never witnesses a single episode of discrimination based on gender. I have been to many job interviews for positions at all levels and the gender has never played a role. But I am a man and I may have a very biased point of view: maybe Kelly Androutsopoulos and Monica have different opinions, see below…

A number of opportunities and programmes are available for girls and women to enter STEM subjects. But according to the report available at, less than 20% of the graduates in Computer Science in 2010 are women (down from 30% in 1991). Are computer scientists creating an increasingly hostile environment for women? I don’t think so (but again, I prefer Kelly and Monica to have a word on this!). Let me point you to another trend: shows that 80% of graduates in Psychology are women (up form 70% in 1991). My impression is that the problem starts in the very early years of a child, exactly when my daughter is told that certain things are only for girls and others are only for boys. In his book “Thinking, Fast and Slow” Daniel Kahneman describes a set of cognitive biases that include the “confirmation bias“, one aspect of which is “preference for early information”: “information is weighted more strongly when it appears early in a series“.


“presenting to our kids the world as if they can do anything”

My opinion is that, if we want to increase the number of women graduates in Computer Science, we must educate children from a very early age that gender does not make a difference. It is important that girls are shown other women in STEM as role models; at the same time, however, I think we should increase the number of men that are primary school teachers, men that are nurses, etc. I am not the first person to say this: Karen Kelsky states that “Women tend to speak and behave in patterns, usually unconsciously and derived from their socialization from childhood”. However, I think the best summary is the one by zanytomato:

What if we just put our energy into presenting to our kids the world as if they can do anything, without any mention of their gender, etc. explicitly, or otherwise?  And then kept working hard toward ensuring opportunities exist for all kids?

And now, this is Kelly’s point of view:

  1. I definitely think that the male representation at the nursery level is low – at our one there is only one man, who is responsible in the office (admin rather than childcare) – but the kids love him. It would be good to have some male role models at this early age. At his nursery, my son has learned to play with dolls and looks after them (which is great) – but it would be nice for them all (girls and boys) to pretend to build rockets or fix cars.
  2. “Are computer scientists creating an increasingly hostile environment for women?” No, its not hostile (and definitely not increasingly hostile). When I was an undergraduate, I knew that there were a few women studying (around 25/100) but it did not particularly bother me. I guess because there was always some women to talk to. This was the usual case more or less in all subjects at Imperial College except for Biology/Medicine. At Middlesex, with the small class sizes I often only have 1 female student, and that might be difficult for them. Also, there are other minorities, e.g. the number of African students is very small at Imperial/UCL/Oxbridge. Sometimes it can be intimidating with guys trying to outsmart each other if you are not too confident – but these are things you face later, not that it determines whether you study it or not. Although it probably happens at school too.  I guess the image of a “geek” might not be appealing, hence why they choose maths rather than computing. Also, computing and engineering suggests a practical element to it, and maybe women are shy of it from lack of experience or familiarity from earlier education (school/nursery). e.g. if kids got to play with the arduino boards like your daughter, they would not feel intimidated when they had to program or see use one in the future.
  3. The media also has a lot to contribute towards this. Nowadays there are a few TV programs and films that have put computing in a positive light and hopefully will work towards encouraging more women. E.g.I overheard a student telling a lecturer that she studied Forensics because she watched CSI – (they have women in key roles (although the boss is a guy)). Its kind of saying that “geeks” are cool.   
  4. I definitely agree with your final point. There is so much as parents we can do to create opportunities for our kids, and we do rely on nursery/school etc on hopefully doing the same too. I know that Sue was trying to lobby to introduce programming at schools from an early age. We are also limited but what we know – e.g. I am not so good at sport and I thus don’t encourage my son so much as I probably should. so I am sure other parents might not encourage IT skills on their kids too. I think I am digressing ….but you right, gender should not come into it.

This is Monica’s point of view:

I’ll try to express my opinion about this topic. I am the mother of 5-year-old Cecilia and 3-year-old Federico, both attending the same nursery school. I have often thought about gender differences and children’s approach to them and watching my kids I have to confirm that it is more an adult’s problem than a toddler’s one. Federico is often into dolls cuddling ( even breastfeeding!) and has communicated to mum and Dad that he will marry his best male friend from nursery; Cecilia adores playing with her brother’s wooden corkscrews and hammers and has recently built a very nice ( though quite original and not quite safe from an engineering point of view) plane! Nursery schools here in Italy encourage children to roleplay “the housework”, but changing traditional role divisions. It’s part of their teaching routine and it works well, I must say. Things are changing and for the better, it seems. Unfortunately, not only families should help to open up their kids’ horizons, but media and culture should, as well. And in Italy they often coincide, unfortunately. Lots of people still share the stereotyped idea about men and women’s different roles ( earning/deciding/leading versus cleaning/cooking/educating), which unfortunately Italy is still keeping as a model, especially in Southern and Country cultures. Scientific and Technical professions, which are in a way “creative” and contribute to female emancipation don’t always appeal to women because not necessarily they meet the needs of family care. We are sometimes hypocritical if we think all jobs can be done by women. Society here doesn’t accept this as it would discard the old and comforting model the Italian, patriarcal society has been following for centuries. Therefore, children are born with a free and open mind and are eager to dream about a wide range of possibilities, but it is our society that it isn’t ready for this yet. Our laws have changed in that direction, too (higher percentage of women in general leading positions and research programmes, possibility of career for new mothers while their husbands stay at home to look after babies,…) but usually those kinds of “technical” women are seen as social nerds or even worse. According to the average Italian man ( also supported in his views by the tv programmes and political choices of the last twenty years), intelligent women are unattractive and even dangerous. I am always trying to “row contrarywise” with my children, but I am seriously concerned about what they will find in the future.

And these are a few interesting links: