GamifiedGamified challengesPracticeRaceLeaderboardPricing

Learn data structures by watching them move, then doing it yourself. Press M anytime to toggle sound.

A product of Amypo Technologies, Coimbatore.

Learn

  • Fundamentals & OOPs
  • Data structures and algorithms
  • Aptitude
  • Learning path
  • How it works
  • About dotprep

Practice

  • Practice arena
  • Daily challenge
  • Gamified challenges
  • Race mode
  • Leaderboard

Interview prep

  • Java interview
  • Coding questions
  • Company questions
  • System design
  • Jobs & careers

You

  • Dashboard
  • Settings
  • Pricing
  • Create account

© 2026 dotprep

Content last updated 27 November 2026

GamifiedGamified challengesPracticeRaceLeaderboardPricing
AptitudeQuantitative aptitude · Numbers and Counting

Probability

Probability as favourable over total: coins, dice, cards and bags, the complement, addition and multiplication rules, and simple conditional probability.

5 min read 45 questions
Practice questions
½

On this page

1/9
  1. 011. What probability measures
  2. 022. The standard sample spaces
  3. 033. Two dice: use the grid
  4. 044. The three rules
  5. 055. Drawing from a bag: with and without replacement
  6. 066. Conditional probability
  7. 077. Shortcuts and traps
  8. 088. Revision sheet
  9. 09Practice
Back to top

1. What probability measures

Probability puts a number on how likely something is: 0 means impossible, 1 means certain. When every outcome of an experiment is equally likely,

P(event) = number of favourable outcomes ÷ total number of outcomes.

So a probability question is two counting questions, one divided by the other. That is why it sits beside permutations and combinations, and why tests like it: the arithmetic is light, but you must count the right things. Give answers as fractions in lowest terms.

One roll of a die: 6 equally likely outcomes. P(more than 4) = 2/6 = 1/3

The list of all possible outcomes is the sample space. Before anything else, decide what one outcome is and how many there are.

2. The standard sample spaces

ExperimentTotal outcomesRemember
n coins (or one coin n times)2ⁿ3 coins: 8 outcomes, HHH … TTT
one die6primes are 2, 3, 5; 1 is not prime
two dice36ordered pairs: (2, 5) and (5, 2) are different
one card524 suits × 13 ranks; 26 red, 26 black
r balls drawn together from nnCrorder does not matter
A standard pack: 52 cards, 4 suits of 13♠ Spades (black)A2345678910JQK♥ Hearts (red)A2345678910JQK♦ Diamonds (red)A2345678910JQK♣ Clubs (black)A2345678910JQKTinted: face cards (J, Q, K). A = ace.
Hearts and diamonds are red; spades and clubs are black. There are 12 face cards and 4 aces

Worked example. P(king or heart) from one card: 4 kings + 13 hearts − 1 (the king of hearts, counted twice) = 16 cards, so 16/52 = 4/13.

3. Two dice: use the grid

Almost every two-dice question is answered by counting cells in the 6 × 6 grid. The totals are not equally likely: 7 can be made in six ways, 2 in only one.

Total shown by two diceSecond die →Firstdie ↓123456723456783456789456789105678910116789101112123456
The six tinted cells give a total of 7, so P(total 7) = 6/36 = 1/6

The number of ways to get a total s is s − 1 for s up to 7, and 13 − s after that: 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1 for totals 2 to 12.

4. The three rules

RuleFormulaUse it when
ComplementP(not A) = 1 − P(A)the opposite is easier to count, especially "at least one"
Addition (OR)P(A or B) = P(A) + P(B) − P(A and B)either event will do; drop the last term if they cannot happen together
Multiplication (AND)P(A and B) = P(A) × P(B after A)both must happen; for independent events this is P(A) × P(B)

Two events are mutually exclusive if they cannot both happen (a card cannot be both a king and a queen). Two events are independent if one happening does not change the chance of the other (two separate coin tosses). These are different ideas; do not mix them up.

At least one. P(at least one six in 3 rolls) = 1 − P(no six) = 1 − (5/6)³ = 1 − 125/216 = 91/216. Adding 1/6 three times gives 1/2, which is wrong because it counts rolls with two or three sixes more than once.

Independent people. If A solves a problem with probability 1/2 and B with probability 1/3, the problem stays unsolved with probability 1/2 × 2/3 = 1/3, so it is solved with probability 2/3.

5. Drawing from a bag: with and without replacement

The phrase to look for is whether the first ball is put back. With replacement the bag is the same for every draw, so the draws are independent. Without replacement the bag shrinks, and the second fraction changes.

RRRBBR = red, B = blue
A bag with 3 red and 2 blue balls

Two balls from this bag, both red. Without replacement: 3/5 × 2/4 = 3/10 (or 3C2 ÷ 5C2 = 3/10). With replacement: 3/5 × 3/5 = 9/25.

Two draws without replacement3/5R2/4R3/5 × 2/4 = 6/202/4B3/5 × 2/4 = 6/202/5B3/4R2/5 × 3/4 = 6/201/4B2/5 × 1/4 = 2/20
Multiply along a path; add the paths you want. The four ends total 20/20

One of each colour uses two paths of the tree (red then blue, blue then red): 6/20 + 6/20 = 3/5. Forgetting the second order is the most common mistake in this topic. Counting unordered pairs avoids it: (3 × 2) ÷ 5C2 = 6/10.

6. Conditional probability

"Given that B has happened" means the sample space has shrunk to B. Count inside B only:

P(A given B) = (outcomes in both A and B) ÷ (outcomes in B) = P(A and B) ÷ P(B).

Worked example. Two dice total 8. What is the chance both show the same number? The total is 8 in 5 outcomes: (2, 6), (3, 5), (4, 4), (5, 3), (6, 2). Only (4, 4) is a double, so the answer is 1/5, not 1/36.

Two-stage experiments. If a bag is chosen first and then a ball, multiply along each route and add. Bag A has 2 red out of 5, bag B has 3 red out of 4, and a bag is picked at random: P(red) = 1/2 × 2/5 + 1/2 × 3/4 = 1/5 + 3/8 = 23/40. To reverse the question (given red, was it bag A?) divide that route by the total: (1/5) ÷ (23/40) = 8/23.

With a two-way table, "given" tells you which row or column to use as the new total.

7. Shortcuts and traps

  • "At least one": always 1 − P(none).
  • Outcomes must be equally likely. The totals 2 to 12 of two dice are not; "0, 1, 2 or 3 heads" are not.
  • Order. If you multiply step by step, count every order that gives the event. If you use combinations, use them for both the top and the bottom of the fraction.
  • With or without replacement changes the second fraction. Read the sentence twice.
  • OR with overlap: subtract what is counted twice (king of hearts; multiples of both 3 and 5).
  • Two bags of different sizes cannot be pooled. Work bag by bag.
  • Reversed condition. P(placed given ECE) and P(ECE given placed) have the same top but different bottoms.
  • Sanity check: an answer above 1 or below 0 means events were added that should not have been.

8. Revision sheet

NeedFormula
Basicfavourable ÷ total (equally likely outcomes)
Not A1 − P(A)
A or BP(A) + P(B) − P(A and B)
A and B, independentP(A) × P(B)
A and B, in generalP(A) × P(B given A)
At least one in n independent tries1 − (chance of failure)ⁿ
Exactly k heads in n tossesnCk ÷ 2ⁿ
Ways to total s with two dices − 1 (s ≤ 7), 13 − s (s ≥ 7), out of 36
r balls drawn togethercount groups with nCr on top and bottom
A given BP(A and B) ÷ P(B)

Method for any question: define one outcome, count them all, count the favourable ones, divide, simplify.

Practice

45 questions in 3 sets. Every answer comes with its explanation, and each question you get right earns XP.

  • Easy · 15
  • Medium · 15
  • Hard · 15
Start practising
PreviousPermutations and CombinationsNextNumber Series
Log inStart free