HDFS Questions with Answers

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

Sample questions

Question 1Easy

What does the NameNode store?

  1. The actual file data blocks, which are kept on disk for every file in the cluster
  2. Only the job history of MapReduce
  3. File system metadata such as the directory tree and block locations
  4. User passwords for the cluster

Answer: C. File system metadata such as the directory tree and block locations

Explanation

The NameNode keeps the namespace and block map in memory; DataNodes hold the data and send block reports.

Step-by-step solution

  1. Namespace in NameNode.
  2. Blocks live on DataNodes.
  3. DataNodes report to NameNode.

Why the other options are wrong

  • A. DataNodes store the blocks.
  • B. Not its function.
  • D. Authentication is handled separately.

Question 2Easy

In HDFS, which component stores the file system metadata (namespace and block locations)?

  1. NameNode
  2. DataNode
  3. ResourceManager
  4. NodeManager

Answer: A. NameNode

Explanation

The NameNode keeps the directory tree and block mapping; DataNodes store the blocks.

Step-by-step solution

  1. HDFS has a NameNode and many DataNodes.
  2. The NameNode keeps the namespace and the block locations.
  3. DataNodes store the actual blocks. The correct answer is option A, NameNode.

Why the other options are wrong

  • B. DataNodes store the blocks, not the file system metadata.
  • C. ResourceManager schedules YARN jobs; it does not hold HDFS metadata.
  • D. NodeManager runs containers on a node; it does not hold HDFS metadata.

Tip: NameNode holds metadata; DataNode holds the data blocks.

Question 3Easy

HDFS is designed mainly for which access pattern?

  1. Frequent random updates of small records for every job
  2. Low-latency transactional reads
  3. Write once, read many, large sequential reads
  4. In-place edits of files at any offset in current releases

Answer: C. Write once, read many, large sequential reads

Explanation

HDFS favours large streaming reads and append-style writes, not random in-place updates.

Step-by-step solution

  1. HDFS is built for handling big data files efficiently.
  2. It supports writing once and reading multiple times for analysis.
  3. Large sequential reads are preferred over small random updates.
  4. Write once, read many pattern reduces overhead in distributed systems.
  5. This design helps manage huge datasets across clusters smoothly.
  6. Final answer: Write once, read many, large sequential reads.

Why the other options are wrong

  • A. HDFS is not built for frequent random updates of small records; that suits a database.
  • B. Low-latency transactional reads are not HDFS's design goal; it favours large batch reads.
  • D. In-place edits at any offset are not HDFS's design; files are written once and then read.

Tip: Remember HDFS is built for big data, not frequent small changes.

Question 4Easy

A 1 MB file is stored in HDFS with 128 MB block size. How much disk space does one replica of it use?

  1. 128 MB, which is the full configured block size reserved on every DataNode disk
  2. About 1 MB
  3. 64 MB
  4. 0 MB

Answer: B. About 1 MB

Explanation

A small file takes only its actual size on disk, but it uses a NameNode metadata entry, which is why many small files hurt.

Step-by-step solution

  1. Block size is a maximum, not a reservation.
  2. 1 MB file uses 1 MB per replica.
  3. Metadata cost is still paid.

Why the other options are wrong

  • A. HDFS blocks do not pad to the full block size.
  • C. Half a block is not reserved.
  • D. The file still occupies its real size.

Question 5Medium

What happens when a DataNode stops sending heartbeats for long enough?

  1. The NameNode marks it dead and re-replicates its blocks
  2. The whole file system becomes read-only forever in current releases
  3. The client must manually re-upload the files on each node
  4. The blocks are deleted without replacement

Answer: A. The NameNode marks it dead and re-replicates its blocks

Explanation

Under-replicated blocks are copied to other DataNodes to restore the replication factor.

Step-by-step solution

  1. DataNodes send heartbeats to the NameNode to show they are alive.
  2. When heartbeats stop for long enough, the NameNode marks that node dead.
  3. Its blocks are copied to other DataNodes to restore the replication factor. The correct answer is A (The NameNode marks it dead and re-replicates its blocks).

Why the other options are wrong

  • B. The file system does not become read-only forever.
  • C. Clients do not re-upload files; replication repairs the blocks.
  • D. The blocks are re-replicated, not deleted without replacement.

Tip: A missing heartbeat leads to re-replication, not to data loss.

Question 6Medium

Why is the NameNode a concern for storing millions of tiny files?

  1. Each file and block takes NameNode memory for its metadata
  2. Tiny files cannot be replicated, so HDFS refuses to replicate them across racks
  3. DataNodes reject files below 1 MB
  4. It forces replication factor 1

Answer: A. Each file and block takes NameNode memory for its metadata

Explanation

Metadata for every file and block lives in NameNode RAM, so huge numbers of small files exhaust memory long before disk fills.

Step-by-step solution

  1. Each object has about a fixed metadata cost.
  2. Millions of objects fill RAM.
  3. Combine small files into larger ones.

Why the other options are wrong

  • B. They are replicated like others.
  • C. There is no such limit.
  • D. Replication is configured separately.

Question 7Medium

With a replication factor of 3, how much raw cluster storage does a 10 GB file consume?

  1. 10 GB
  2. 30 GB
  3. 13 GB
  4. 3.3 GB

Answer: B. 30 GB

Explanation

Every block is stored 3 times, so raw usage is 3 x 10 = 30 GB.

Step-by-step solution

  1. Replication factor of 3 means each file is stored 3 times.
  2. So 10 GB file becomes 10 * 3 = 30 GB.
  3. Raw cluster storage used is 30 GB.

Why the other options are wrong

  • A. 10 GB is only one copy; with replication factor 3 the file takes three copies.
  • C. 13 GB is not three copies of 10 GB; it is the wrong calculation of replicas.
  • D. 3.3 GB divides instead of multiplies; replication multiplies the stored size by 3.

Tip: Multiply file size by replication factor for raw storage.

Question 8Medium

The Secondary NameNode in classic Hadoop is

  1. An automatic failover standby of the NameNode, which takes over automatically the moment the NameNode crashes
  2. A backup of all DataNode data
  3. A helper that merges the edit log into the fsimage checkpoint, not a hot standby
  4. A second copy of the job tracker

Answer: C. A helper that merges the edit log into the fsimage checkpoint, not a hot standby

Explanation

It periodically combines fsimage and edits to keep the edit log small; high-availability needs a standby NameNode.

Step-by-step solution

  1. Edits accumulate.
  2. Checkpoint merges them with fsimage.
  3. Not a failover node.

Why the other options are wrong

  • A. A standby NameNode does that; the Secondary does not.
  • B. It holds metadata checkpoints only.
  • D. It has nothing to do with jobs.

Question 9Hard

With replication factor 3 and default rack-aware placement, where does HDFS put the replicas of a block?

  1. All three on the same node, which is fastest for writes but loses the block if that node fails
  2. First on the writer's node, the other two on different nodes in one other rack
  3. One in each of three different racks always
  4. All three on different nodes in the writer's rack

Answer: B. First on the writer's node, the other two on different nodes in one other rack

Explanation

The default policy puts the first copy locally, and the second and third on two nodes of a different rack, balancing write cost and rack failure.

Step-by-step solution

  1. Replica 1: local node.
  2. Replica 2: node in a remote rack.
  3. Replica 3: another node in that rack.

Why the other options are wrong

  • A. That would lose data on a single failure.
  • C. The default trades off bandwidth by using two racks.
  • D. That risks losing the data if the whole rack fails.

Question 10Hard

What is the purpose of a Secondary NameNode in classic HDFS?

  1. It serves as an automatic hot standby by default for every job
  2. It stores a second copy of all data blocks on each node by default
  3. It balances data across DataNodes
  4. It periodically merges the edit log into the fsimage checkpoint

Answer: D. It periodically merges the edit log into the fsimage checkpoint

Explanation

It performs checkpointing; it is not a failover node (that is the Standby NameNode in HA setups).

Step-by-step solution

  1. Classic HDFS keeps an edit log of changes to the namespace.
  2. The Secondary NameNode periodically merges the edit log into the fsimage checkpoint.
  3. This keeps restarts faster. The correct answer is D.

Why the other options are wrong

  • A. It is not a hot standby; the Standby NameNode in HA setups plays that role.
  • B. It does not store block copies; DataNodes store the blocks.
  • C. Balancing data across DataNodes is a separate job for the balancer.

Tip: Secondary NameNode makes checkpoints; Standby NameNode takes over on failure.

Practise all 17 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