Hive Questions with Answers

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

Sample questions

Question 1Easy

Bucketing in Hive

  1. Splits by date directories, creating one directory per distinct date value
  2. Distributes rows into a fixed number of files by a hash of a column
  3. Deletes duplicate rows
  4. Encrypts the table

Answer: B. Distributes rows into a fixed number of files by a hash of a column

Explanation

Bucketing helps with joins and sampling because rows with the same key land in the same bucket.

Step-by-step solution

  1. Hash the bucketing column.
  2. Mod by number of buckets.
  3. Same key, same bucket.

Why the other options are wrong

  • A. That is partitioning.
  • C. Not its function.
  • D. Not its purpose.

Question 2Easy

What is the Hive metastore?

  1. A database holding table schemas and partition metadata
  2. A copy of all table data, kept inside the metastore database itself
  3. A job scheduler
  4. A replication monitor

Answer: A. A database holding table schemas and partition metadata

Explanation

The metastore records table definitions and locations so engines like Spark can reuse them.

Step-by-step solution

  1. Data in storage.
  2. Schemas in the metastore.
  3. Engines look up schemas there.

Why the other options are wrong

  • B. Data stays in the storage layer.
  • C. YARN schedules resources.
  • D. Not its role.

Question 3Easy

Apache Hive provides which main capability on top of Hadoop?

  1. A replacement for HDFS storage on each node
  2. SQL-like querying (HiveQL) over data stored in HDFS
  3. A real-time message queue
  4. A cluster resource manager by default

Answer: B. SQL-like querying (HiveQL) over data stored in HDFS

Explanation

Hive translates HiveQL into jobs on an execution engine.

Step-by-step solution

  1. Hive is a data warehouse layer built on Hadoop.
  2. It lets users write HiveQL, a SQL-like language.
  3. HiveQL queries run over data stored in HDFS and are turned into jobs.
  4. So the main capability is SQL-like querying over HDFS data (option B).

Why the other options are wrong

  • A. HDFS is the storage layer; Hive does not replace it.
  • C. Hive is not a message queue.
  • D. Cluster resource management is done by YARN, not by Hive.

Tip: Hive gives SQL on top of Hadoop data, aimed at batch analysis.

Question 4Easy

Apache Hive lets users

  1. Store data on tape only in magnetic backups, with no support for any query language
  2. Replace HDFS
  3. Run only real-time transactions
  4. Query data in distributed storage using a SQL-like language called HiveQL

Answer: D. Query data in distributed storage using a SQL-like language called HiveQL

Explanation

Hive translates HiveQL queries into jobs on an execution engine.

Step-by-step solution

  1. Write HiveQL.
  2. Compiled to distributed jobs.
  3. Results from big data.

Why the other options are wrong

  • A. Not its purpose.
  • B. It runs on top of HDFS or similar storage.
  • C. It is built for analytics batch queries.

Question 5Medium

What happens to the data when you drop a Hive EXTERNAL table?

  1. The data files are deleted too for every job
  2. The table is moved to trash in current releases
  3. Replication is set to 1
  4. Only the metadata is removed; the data files remain

Answer: D. Only the metadata is removed; the data files remain

Explanation

For managed tables Hive deletes the data; external tables leave it.

Step-by-step solution

  1. An EXTERNAL table is one where Hive does not own the data files.
  2. Dropping the table removes only its metadata from the metastore.
  3. The data files are left where they are.
  4. So only the metadata is removed and the files remain (option D).

Why the other options are wrong

  • A. Data files are deleted when a managed table is dropped, not an external one.
  • B. Dropping an external table does not move the data to trash; it stays in place.
  • C. Dropping a table does not change the replication factor.

Tip: Managed table drop deletes the data; external table drop keeps it.

Question 6Medium

The difference between a Hive managed (internal) table and an external table is that dropping

  1. An external table deletes its data too, and a managed table keeps its data in the metastore database
  2. Both always delete the data
  3. A managed table deletes its data too, while an external table drops only the metadata
  4. Neither changes anything

Answer: C. A managed table deletes its data too, while an external table drops only the metadata

Explanation

Use external tables when data is shared with other tools and must survive the table drop.

Step-by-step solution

  1. Managed: Hive owns the data.
  2. External: data belongs elsewhere.
  3. Drop external = metadata only.

Why the other options are wrong

  • A. The reverse of the real behaviour.
  • B. Not for external tables.
  • D. DROP changes the metastore at least.

Question 7Medium

Partitioning a Hive table by date mainly helps by

  1. Compressing all data to zero bytes, so every query becomes instant
  2. Removing the need for a schema
  3. Increasing replication
  4. Letting queries read only the matching partition directories (partition pruning)

Answer: D. Letting queries read only the matching partition directories (partition pruning)

Explanation

Each partition value maps to a directory, so a WHERE on the partition column skips others.

Step-by-step solution

  1. Partition column becomes a directory.
  2. WHERE on it prunes directories.
  3. Less data scanned.

Why the other options are wrong

  • A. Not what happens.
  • B. The schema still exists.
  • C. Unrelated.

Question 8Medium

To expose files already sitting in an HDFS directory as a Hive table without moving them, you use

  1. DROP TABLE on the directory path
  2. CREATE EXTERNAL TABLE ... LOCATION
  3. TRUNCATE on a managed table
  4. ALTER TABLE ... RENAME to the directory name

Answer: B. CREATE EXTERNAL TABLE ... LOCATION

Explanation

An external table points to data in place, so data stays after dropping.

Step-by-step solution

  1. Data already in HDFS.
  2. External table with LOCATION.
  3. Metadata only.

Why the other options are wrong

  • A. It removes a table, it does not map files.
  • C. It removes all rows from a managed table.
  • D. It only renames an existing table.

Question 9Hard

Which choice for a partition column is a bad design in Hive?

  1. A high-cardinality column such as user_id with millions of unique values
  2. Date, which has a small number of distinct values and suits partitioning
  3. Country
  4. Month

Answer: A. A high-cardinality column such as user_id with millions of unique values

Explanation

Millions of tiny partitions overload the metastore and NameNode; use bucketing for high-cardinality columns.

Step-by-step solution

  1. Partition = directory.
  2. Millions of directories are costly.
  3. Bucket instead.

Why the other options are wrong

  • B. A moderate number of values suits partitioning.
  • C. Low cardinality is acceptable.
  • D. Few values per year.

Question 10Hard

Hive is generally NOT suited to which workload?

  1. Batch analytics on large datasets on each node
  2. Ad-hoc SQL over big files by default
  3. Low-latency, row-level OLTP transactions
  4. ETL summarisation

Answer: C. Low-latency, row-level OLTP transactions

Explanation

Hive is built for analytical batch queries, not high-frequency transactional lookups.

Step-by-step solution

  1. Hive is built for batch analytical queries over large datasets.
  2. Each query has a high start-up cost and is not built for row-level updates.
  3. Low-latency, row-level transactions (OLTP) need a database built for that.
  4. So Hive is generally not suited to low-latency row-level OLTP (option C).

Why the other options are wrong

  • A. Batch analytics on large datasets is Hive's main use.
  • B. Ad-hoc SQL over big files is a typical Hive use.
  • D. ETL summarisation of large data is a typical Hive use.

Tip: Hive suits big analytical scans; use a transactional database for many small updates.

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