MapReduce Questions with Answers

18 practice questions on MapReduce (Big Data (Hadoop & Spark)) with answers and step-by-step solutions. Try 10 samples below, then practise all 18 free in the AptiNest app.

Sample questions

Question 1Easy

In MapReduce, the output of the map phase is

  1. The final sorted result file produced after the reduce phase, ready for the user
  2. A list of DataNode addresses
  3. A set of intermediate key-value pairs
  4. A compressed block replica

Answer: C. A set of intermediate key-value pairs

Explanation

Mappers emit intermediate key-value pairs that are shuffled by key to reducers.

Step-by-step solution

  1. Mapper reads a record.
  2. Emits (key, value) pairs.
  3. Shuffle groups by key.

Why the other options are wrong

  • A. Reduce produces the final output.
  • B. Not part of MapReduce data flow.
  • D. Not related.

Question 2Easy

A combiner in MapReduce is used to

  1. Do local partial aggregation on map output to cut network traffic
  2. Replace the reducer entirely, so no key-value pairs are needed from the mappers at all
  3. Split input files
  4. Encrypt intermediate data

Answer: A. Do local partial aggregation on map output to cut network traffic

Explanation

A combiner works like a mini-reducer on each mapper's output, reducing the data shuffled; it must be safe to apply zero or more times.

Step-by-step solution

  1. Mapper output is large.
  2. Combine locally by key.
  3. Less data crosses the network.

Why the other options are wrong

  • B. It is an optimisation and may not run at all.
  • C. Input splitting is separate.
  • D. Not its purpose.

Question 3Easy

Setting the number of reducers to zero in a MapReduce job gives a

  1. Failure at job submission because every MapReduce job must contain at least one reduce task
  2. A job that sorts everything globally
  3. A job with one default reducer
  4. Map-only job whose map output is written directly to the output

Answer: D. Map-only job whose map output is written directly to the output

Explanation

Map-only jobs suit filtering and transformations, with no shuffle or sort.

Step-by-step solution

  1. No reducers: no shuffle.
  2. Mapper output is the final output.
  3. Good for filters.

Why the other options are wrong

  • A. Map-only jobs are valid.
  • B. No reduce means no global sort.
  • C. Zero reducers means none run.

Question 4Easy

Which MapReduce step groups all values by key before the reduce function runs?

  1. Combine on input split
  2. Shuffle and sort
  3. Job commit
  4. Block report

Answer: B. Shuffle and sort

Explanation

Shuffle moves map output to reducers and sorts it so each reducer sees keys with their value lists.

Step-by-step solution

  1. MapReduce splits data into chunks for processing.
  2. Shuffle transfers map outputs to reducers.
  3. Sort groups values by key for reduce function.
  4. Reducers process grouped values and produce final output.
  5. Final answer: Shuffle and sort.

Why the other options are wrong

  • A. Combine on input split is an optional local aggregation, not the grouping of all values by key.
  • C. Job commit finalises output after the job ends; it does not group values before reduce.
  • D. Block reports tell the NameNode which blocks DataNodes hold; they do not group values.

Tip: Remember shuffle and sort group values by key before reducing.

Question 5Medium

MapReduce typically moves computation to data rather than data to computation. This idea is called:

  1. Data sharding
  2. Data locality
  3. Speculative execution
  4. Lazy loading

Answer: B. Data locality

Explanation

Scheduling tasks on nodes that hold the block avoids network transfer.

Step-by-step solution

  1. MapReduce moves computation to data location.
  2. This reduces need for moving large data across networks.
  3. Scheduling tasks where data resides is called data locality.
  4. Data locality minimizes network transfer and improves performance.
  5. The correct answer is Data locality.

Why the other options are wrong

  • A. Data sharding splits data into parts; it is not the idea of moving computation to the data.
  • C. Speculative execution runs backup copies of slow tasks, not computation placed where the data sits.
  • D. Lazy loading delays loading a resource; it is a different idea from moving computation to data.

Tip: Remember: data locality means computation moves to data, not the other way around.

Question 6Medium

What decides which reducer receives a given key in MapReduce?

  1. The combiner, which runs on each mapper's node
  2. The input format, which reads splits from storage
  3. The NameNode, which tracks the block locations
  4. The partitioner, by default a hash of the key modulo the number of reducers

Answer: D. The partitioner, by default a hash of the key modulo the number of reducers

Explanation

The default HashPartitioner uses (hash(key) mod numReducers).

Step-by-step solution

  1. Hash the key.
  2. Modulo number of reducers.
  3. Result picks the reducer.

Why the other options are wrong

  • A. The combiner only aggregates locally.
  • B. It reads and splits input, not intermediate keys.
  • C. It does not route keys.

Question 7Medium

Data skew in MapReduce means

  1. A few keys have far more values, so one reducer gets overloaded
  2. Mappers finish at identical times so every key is spread perfectly evenly across all of the reducers
  3. Input files are compressed
  4. The cluster has too many racks

Answer: A. A few keys have far more values, so one reducer gets overloaded

Explanation

A hot key sends most pairs to one reducer, which becomes the straggler; salting keys or custom partitioners help.

Step-by-step solution

  1. Hash partition by key.
  2. Hot key lands on one reducer.
  3. That reducer slows the whole job.

Why the other options are wrong

  • B. That is the opposite of skew.
  • C. Compression is unrelated.
  • D. Not the definition.

Question 8Medium

Which phase groups all values that share the same key and sends them to the same reducer?

  1. Map
  2. Combine at the client
  3. Input split
  4. Shuffle and sort

Answer: D. Shuffle and sort

Explanation

The framework partitions map output by key, transfers it and sorts it so each reducer sees its keys' values together.

Step-by-step solution

  1. Partition by key hash.
  2. Copy to reducer nodes.
  3. Sort and group by key.

Why the other options are wrong

  • A. Map emits pairs but does not group them.
  • B. Not a standard phase.
  • C. Splitting divides input, not intermediate pairs.

Question 9Hard

A word count over 1 million words runs on 10 mappers with a combiner. If each mapper sees the same 50,000 distinct words, at most how many pairs cross the network?

  1. 50,000
  2. 1,000,000
  3. 500,000
  4. 5,000,000

Answer: C. 500,000

Explanation

Each mapper emits at most one pair per distinct word it saw: 50,000 x 10 = 500,000.

Step-by-step solution

  1. Per mapper: at most 50,000 pairs.
  2. 10 mappers.
  3. 50,000 x 10 = 500,000.

Why the other options are wrong

  • A. Counts the pairs of one mapper only.
  • B. That is the count without a combiner.
  • D. Overcounts by a factor of 10.

Question 10Hard

Which operation is NOT safe to use directly as a combiner?

  1. Summing values
  2. Taking the maximum on each node
  3. Counting occurrences in current releases
  4. Computing the average of values

Answer: D. Computing the average of values

Explanation

Average is not associative over partial averages (avg of avgs is wrong); sum, max and count are.

Step-by-step solution

  1. A combiner runs on partial results before the shuffle, so its output must combine again to the same final answer.
  2. Sum, max and count can be applied again to partial results and stay correct.
  3. An average of partial averages is wrong unless every group has the same size.
  4. So the unsafe operation is computing the average of values (option D).

Why the other options are wrong

  • A. Summing partial sums gives the overall sum, so summing is safe as a combiner.
  • B. The maximum of partial maximums is the overall maximum, so it is safe.
  • C. Adding partial counts gives the total count, so counting is safe.

Tip: Test a combiner: if applying it to partial results gives the same final answer, it is safe. Averages fail this test.

Practise all 18 questions free

The full question bank with timed practice, progress tracking and Vidya, your AI tutor. Free, no ads.

Open this topic in the app →

Related topics

See all Big Data (Hadoop & Spark) topics · All topics