Notice: Due to an ongoing migration of our storage and publishing system, material requested since last month will not be uploaded for the time being, and new requests are paused. All existing notes remain available.
Which of the following is a mandatory prerequisite software framework for running Apache Hive?
Not quite. Try another option.
Answer: Apache Hadoop
Hive is a data warehouse software that runs on top of Apache Hadoop to query and analyze big data stored in HDFS.
Question 2 of 60 · Hive installation · Easy
What is the default embedded database used by Hive for its Metastore in local mode?
Not quite. Try another option.
Answer: Apache Derby
Apache Derby is the default embedded relational database used by Hive to store metadata.
Question 3 of 60 · Hive installation · Easy
Which environment variable is typically set to point to the base directory of the Hive installation?
Not quite. Try another option.
Answer: HIVE_HOME
The HIVE_HOME environment variable is used in system configurations to define the root directory where Hive is installed.
Question 4 of 60 · Hive data types · Easy
Which of the following Hive data types is used to store text or character sequences?
Not quite. Try another option.
Answer: STRING
The STRING data type in Hive is used to store sequences of characters (text).
Question 5 of 60 · Hive data types · Easy
Which complex data type in Hive is used to store an unordered collection of key-value pairs?
Not quite. Try another option.
Answer: MAP
The MAP data type stores key-value pairs where the keys must be primitives and the values can be of any data type.
Question 6 of 60 · Hive data types · Easy
Which complex data type represents an ordered collection of elements of the exact same data type?
Not quite. Try another option.
Answer: ARRAY
An ARRAY is a collection of elements that are all of the same data type, and they are indexed by integers.
Question 7 of 60 · Hive data types · Easy
Which primitive data type in Hive is used to represent true or false values?
Not quite. Try another option.
Answer: BOOLEAN
The BOOLEAN data type is used specifically to store logical true or false values.
Question 8 of 60 · Hive bucketing · Easy
Which clause is used in a HiveQL CREATE TABLE statement to implement bucketing?
Not quite. Try another option.
Answer: CLUSTERED BY
The CLUSTERED BY clause is used to divide data into buckets based on the hash of specific columns.
Question 9 of 60 · Hive bucketing · Easy
How does Hive determine which bucket a particular record should be stored in?
Not quite. Try another option.
Answer: Using a hash function on the bucketing column
Hive calculates the hash of the column defined in the CLUSTERED BY clause to determine the correct bucket for a row.
Question 10 of 60 · Hive bucketing · Easy
What is one of the primary performance benefits of using bucketing in Hive?
Not quite. Try another option.
Answer: It improves map-side joins and sampling efficiency
Bucketing helps efficiently execute map-side joins and makes data sampling much faster by creating evenly distributed files.
Question 11 of 60 · Hive partitioning · Easy
How is partitioned data physically organized in the Hadoop Distributed File System (HDFS)?
Not quite. Try another option.
Answer: As separate sub-directories under the main table directory
Partitioning logically divides a table and physically creates sub-directories for each unique partition value in HDFS.
Question 12 of 60 · Hive partitioning · Easy
Which keyword is used to create partitioned tables in Hive?
Not quite. Try another option.
Answer: PARTITIONED BY
The PARTITIONED BY clause defines the columns by which the table data will be partitioned.
Question 13 of 60 · Hive partitioning · Easy
What is the main advantage of using partitioning in Hive?
Not quite. Try another option.
Answer: It allows faster query execution by scanning only relevant partitions (Data Pruning)
Partitioning restricts the amount of data scanned during queries (partition pruning), significantly improving query performance.
Question 14 of 60 · Hiveql operations · Easy
Which HiveQL command is used to display a list of all existing databases?
Not quite. Try another option.
Answer: SHOW DATABASES
The SHOW DATABASES command returns a list of all databases available in the Hive metastore.
Question 15 of 60 · Hiveql operations · Easy
Which command is used to permanently remove a table and its metadata from Hive?
Not quite. Try another option.
Answer: DROP TABLE
The DROP TABLE command deletes the table, its metadata from the metastore, and (if it is a managed table) its underlying data.
Question 16 of 60 · Hiveql operations · Easy
Which command allows a user to import data from a local file system into a Hive table?
Not quite. Try another option.
Answer: LOAD DATA LOCAL INPATH
The LOAD DATA LOCAL INPATH command copies or moves files from the local file system into the HDFS directory corresponding to a Hive table.
Question 17 of 60 · Hiveql operations · Easy
How do you define a new table structure in HiveQL?
Not quite. Try another option.
Answer: CREATE TABLE
The CREATE TABLE statement is the standard HiveQL syntax to define a new table structure.
Question 18 of 60 · Hive operators · Easy
Which relational operator in Hive is used to check if two values are equal?
Not quite. Try another option.
Answer: =
In HiveQL, the single equals sign = is used as the standard relational operator to check for equality.
Question 19 of 60 · Hive operators · Easy
Which logical operator is used to ensure both conditions in a WHERE clause evaluate to true?
Not quite. Try another option.
Answer: AND
The AND logical operator evaluates to true only if both operands (conditions) are true.
Question 20 of 60 · Hive operators · Easy
Which Hive operator is specifically used to check if a column value is missing or undefined?
Not quite. Try another option.
Answer: IS NULL
The IS NULL operator is used to test whether a given value is null (missing or undefined) in Hive.
Question 21 of 60 · Hive installation · Medium
Which of the following is a mandatory prerequisite running service for Apache Hive to function properly, as it handles the underlying distributed storage?
Not quite. Try another option.
Answer: Hadoop Distributed File System (HDFS)
Hive is a data warehouse infrastructure built on top of Hadoop. It requires HDFS to be running for underlying data storage, and typically MapReduce, Tez, or Spark for execution.
Question 22 of 60 · Hive installation · Medium
When configuring a remote metastore for Apache Hive, which configuration file is primarily modified to set the JDBC connection parameters for the external RDBMS?
Not quite. Try another option.
Answer: hive-site.xml
The hive-site.xml file overrides default configurations and is used to specify properties like javax.jdo.option.ConnectionURL to connect Hive to an external metastore database such as MySQL or PostgreSQL.
Question 23 of 60 · Hive data types · Medium
A developer wants to store a user's address containing fields like street (string), city (string), and zip code (integer). Which complex Hive data type is most appropriate to group these different types together?
Not quite. Try another option.
Answer: STRUCT
STRUCT is used to group a collection of elements of different data types under a single field name, behaving much like an object in JSON or a struct in C.
Question 24 of 60 · Hive data types · Medium
How does Hive handle a cast operation when a STRING containing non-numeric alphabetic characters is explicitly cast to an INT?
Not quite. Try another option.
Answer: It returns NULL.
In Hive, if a casting operation fails (such as converting a non-numeric string to an integer), the system silently returns NULL rather than failing the entire query with an exception.
Question 25 of 60 · Hive data types · Medium
Which of the following Hive data types allows a column to store a value that can be exactly one of several explicitly specified data types?
Not quite. Try another option.
Answer: UNIONTYPE
UNIONTYPE is a complex data type in Hive that can hold a value belonging to exactly one of the types defined in its declaration, similar to a union in C.
Question 26 of 60 · Hive data types · Medium
What is the default precision of the TIMESTAMP data type in Apache Hive?
Not quite. Try another option.
Answer: Nanosecond precision
Hive's TIMESTAMP data type stores timestamps without time zone mapping and supports precision up to nanoseconds ( seconds).
Question 27 of 60 · Hive partitioning · Medium
Which Hive configuration property must be enabled (set to true) to allow the automatic creation of partitions based on the values of the loaded data?
Not quite. Try another option.
Answer: hive.exec.dynamic.partition
To use dynamic partitioning, where Hive evaluates the final columns of a query to determine partition folders automatically, the property hive.exec.dynamic.partition must be set to true.
Question 28 of 60 · Hive partitioning · Medium
If a table is partitioned by country and then by state, how will the nested directory structure be physically represented in HDFS for a record from California, USA?
Not quite. Try another option.
Answer: /table_path/country=USA/state=California/
Hive creates nested directories in HDFS structured as partition_column=value, strictly following the order of the partition columns defined during table creation.
Question 29 of 60 · Hive partitioning · Medium
What happens if a user executes an INSERT statement into a table with dynamic partitioning enabled, but the hive.exec.dynamic.partition.mode is set to strict?
Not quite. Try another option.
Answer: The query requires the user to specify at least one static partition column.
In strict mode, Hive requires at least the first partition column to be static. This acts as a safeguard against unintentionally creating a massive number of partitions.
Question 30 of 60 · Hive partitioning · Medium
Which of the following accurately describes a major operational drawback of excessive partitioning (over-partitioning) on a high-cardinality column in Hive?
Not quite. Try another option.
Answer: It creates a large number of small files, leading to high memory overhead on the Hadoop NameNode.
Excessive partitioning produces thousands of tiny directories and files. The Hadoop NameNode keeps all file metadata in memory, so too many small files can cause severe NameNode memory exhaustion.
Question 31 of 60 · Hive bucketing · Medium
How does Hive determine the correct bucket for a specific row when a table is defined with the CLUSTERED BY (col_name) INTO N BUCKETS clause?
Not quite. Try another option.
Answer: By using the mathematical formula: hash_function(col_name) % N
Hive hashes the value of the bucketing column and calculates the modulus with the total number of buckets (). The result dictates which bucket file the row belongs to.
Question 32 of 60 · Hive bucketing · Medium
Why is bucketing preferred over partitioning when distributing data based on a column with highly unique values, such as a user_id?
Not quite. Try another option.
Answer: Bucketing strictly ensures a fixed number of files, mitigating the small-file problem.
Partitioning by a highly distinct column like user_id would create millions of tiny directories, crashing the NameNode. Bucketing avoids this by securely hashing those unique values into a predefined, fixed number of files.
Question 33 of 60 · Hive bucketing · Medium
Historically, which configuration property had to be set to true to ensure standard INSERT operations populated the appropriate number of buckets correctly in Hive?
Not quite. Try another option.
Answer: hive.enforce.bucketing
In older versions of Hive (prior to Hive 2.0 where it's enabled by default), hive.enforce.bucketing=true was required so Hive would automatically set the number of reduce tasks to equal the number of requested buckets.
Question 34 of 60 · Hive bucketing · Medium
If two tables are physically bucketed and sorted by the same key, and share a proportional number of buckets, which advanced Hive query execution strategy becomes possible?
Not quite. Try another option.
Answer: Sort-Merge Bucket (SMB) Join
Sort-Merge Bucket joins are a major performance optimization in Hive. When two tables are bucketed and sorted on the join key with compatible bucket counts, Hive can merge the tables efficiently without a heavy shuffle phase.
Question 35 of 60 · Hiveql operations · Medium
What is the physical outcome of executing DROP TABLE my_data; if my_data was defined as an EXTERNAL table?
Not quite. Try another option.
Answer: The metadata in the metastore is removed, but the underlying data remains intact in HDFS.
For an EXTERNAL table, Hive only has control over the metadata. Dropping the table removes its definition from the Hive metastore, but the actual data files are left unmodified in HDFS.
Question 36 of 60 · Hiveql operations · Medium
Which specific HiveQL clause allows a user to write queries that read only a random or bucket-based subset of a table for exploratory data analysis?
Not quite. Try another option.
Answer: TABLESAMPLE
The TABLESAMPLE clause is used to query a subset of data (based on buckets, block size, or rows), heavily reducing the amount of data processed compared to a full table scan.
Question 37 of 60 · Hiveql operations · Medium
How does an INSERT OVERWRITE operation differ mechanically from a standard INSERT INTO operation in HiveQL?
Not quite. Try another option.
Answer: INSERT OVERWRITE clears the existing data in the target table or partition before writing the new data.
INSERT OVERWRITE effectively replaces the current dataset by truncating the targeted table or partition folder and placing the new query results in it. INSERT INTO simply appends.
Question 38 of 60 · Hiveql operations · Medium
In HiveQL, what is the core purpose of using a LATERAL VIEW in conjunction with a UDTF (User-Defined Table-Generating Function) like explode()?
Not quite. Try another option.
Answer: It allows expanding a complex data structure (like an array) into multiple rows and joining them back to the original source row.
LATERAL VIEW applies an array-generating function like explode() to a row and virtually joins those newly generated rows with the other columns of the original row.
Question 39 of 60 · Hive operators · Medium
Which of the following operators is known as the null-safe equality operator in HiveQL, capable of returning true if both operands happen to be NULL?
Not quite. Try another option.
Answer: <=>
The <=> operator is null-safe. While standard equality (=) returns NULL when comparing two NULL values, <=> evaluates to true when both sides are NULL.
Question 40 of 60 · Hive operators · Medium
When evaluating a WHERE clause in HiveQL, what exact functionality does the RLIKE operator provide?
Not quite. Try another option.
Answer: It checks if a specified string correctly matches a Java regular expression pattern.
RLIKE (which functions identically to REGEXP in Hive) allows users to filter strings by testing them against standard Java regular expression patterns.
Question 41 of 60 · Hive installation · Hard
When configuring a Hive installation for a highly concurrent production environment, which metastore configuration approach eliminates the single point of failure and allows multiple HiveServer2 instances to scale efficiently?
Not quite. Try another option.
Answer: Remote Metastore Server with an external RDBMS
In a Remote Metastore setup, the metastore service runs in its own JVM, independent of the HiveServer2 processes. This allows multiple HiveServer2 instances to connect to a highly available cluster of Metastore servers backed by a robust RDBMS, eliminating single points of failure and scaling effectively.
Question 42 of 60 · Hive installation · Hard
Which set of properties must be correctly configured in hive-site.xml to successfully enable HiveServer2 High Availability (HA) using Apache ZooKeeper?
Not quite. Try another option.
Answer: hive.server2.support.dynamic.service.discovery and hive.zookeeper.quorum
To enable HiveServer2 HA, dynamic service discovery must be turned on (hive.server2.support.dynamic.service.discovery=true), and the ZooKeeper ensemble must be specified (hive.zookeeper.quorum) so clients can query ZooKeeper to find an active HiveServer2 instance.
Question 43 of 60 · Hive data types · Hard
Consider a Hive table containing a column events of type ARRAY<STRUCT<id:INT, type:STRING>>. Which of the following syntaxes correctly retrieves the type of the second element in the array?
Not quite. Try another option.
Answer: events[1].type
Hive arrays are 0-indexed. Therefore, the second element is accessed via index 1. To access a field within a struct that is inside an array, the syntax is array_column[index].struct_field.
Question 44 of 60 · Hive data types · Hard
In Hive, what is the behavior when a calculation involves a DECIMAL(p1, s1) and a DECIMAL(p2, s2) using multiplication, and the resulting precision exceeds the maximum allowed precision of 38?
Not quite. Try another option.
Answer: Hive truncates the scale to accommodate the integral part, potentially resulting in loss of fractional precision.
When the calculated precision of a decimal operation exceeds the maximum precision (38), Hive reduces the scale to ensure the integral part of the number can be represented, avoiding overflow at the cost of fractional precision.
Question 45 of 60 · Hive data types · Hard
Which of the following implicitly casts properly without losing precision or failing in a standard Hive aggregate function like SUM()?
Not quite. Try another option.
Answer: INT to DOUBLE
Hive allows implicit conversions from narrower numeric types to wider numeric types (e.g., INT to DOUBLE). STRING to BIGINT or FLOAT to INT can cause precision loss or NULLs if the conversion fails.
Question 46 of 60 · Hive partitioning · Hard
A user executes an INSERT OVERWRITE statement with dynamic partitioning enabled. The configuration hive.exec.dynamic.partition.mode is set to strict. What condition MUST be met for the query to execute successfully?
Not quite. Try another option.
Answer: At least one partition column must be statically specified.
In strict mode, Hive requires at least one static partition column to prevent users from accidentally dropping or overwriting all partitions in a table due to a malformed dynamic partition query.
Question 47 of 60 · Hive partitioning · Hard
When working with highly scaled tables stored on an object store (like AWS S3), why might a data engineer prefer using ALTER TABLE ADD PARTITION instead of MSCK REPAIR TABLE to register new data directories?
Not quite. Try another option.
Answer: MSCK REPAIR TABLE recursively scans the entire table's file system tree, which is an extremely slow metadata operation on object stores.
MSCK REPAIR TABLE scans the entire storage prefix to find directories that match the partition schema. On object stores like S3, listing directories is slow and expensive, making explicit ALTER TABLE ADD PARTITION commands much more efficient for large tables.
Question 48 of 60 · Hive partitioning · Hard
Assume a Hive table is partitioned by country (STRING) and year (INT). If data is inserted for country='US' and year=2023, what is the exact default directory structure created in HDFS?
Not quite. Try another option.
Answer: .../table_name/country=US/year=2023/
Hive creates partition directories using the format partition_column=value. The hierarchical order matches the order in which the partitions were defined in the PARTITIONED BY clause.
Question 49 of 60 · Hive bucketing · Hard
How does Hive determine the exact bucket number for a given row based on its bucketing column col and the total number of buckets B?
Not quite. Try another option.
Answer: (hash(col) & 0x7FFFFFFF) % B
Hive computes the Java integer hash code of the column, applies a bitwise AND with 0x7FFFFFFF to ensure a positive integer (removing the sign bit), and then applies the modulo operator (%) with the number of buckets B.
Question 50 of 60 · Hive bucketing · Hard
To perform a Sort-Merge-Bucket (SMB) Join optimally without shuffling data, what must be true about the two participating tables?
Not quite. Try another option.
Answer: They must be bucketed by the join key, sorted by the join key, and have the exact same number of buckets (or multiples of each other).
For an SMB join to work map-side without a shuffle/reduce phase, both tables must be bucketed and sorted on the join key, and the number of buckets in one table must be a multiple (or equal to) the number of buckets in the other.
Question 51 of 60 · Hive bucketing · Hard
Consider a table sales bucketed into 32 buckets by customer_id. A user executes: SELECT * FROM sales TABLESAMPLE(BUCKET 3 OUT OF 8 ON customer_id);. How many buckets are actually scanned by this query?
Not quite. Try another option.
Answer: 4 buckets
Because 32 is a multiple of 8, Hive can optimize the sample. It scans buckets . The formula is: buckets matching (bucket_number - 1) % 8 == (3 - 1). Thus, exactly 4 buckets are scanned.
Question 52 of 60 · Hiveql operations · Hard
When using LATERAL VIEW explode(array_col) tbl AS val, what happens to rows in the base table where array_col is empty or NULL?
Not quite. Try another option.
Answer: They are completely dropped from the result set.
Standard explode() acts like an inner join, dropping rows that have an empty or NULL array. To retain the base row with a NULL exploded value, LATERAL VIEW OUTER explode() must be used.
Question 53 of 60 · Hiveql operations · Hard
Which of the following table property combinations is strictly REQUIRED to create an ACID transactional table in Hive 3.x?
Not quite. Try another option.
Answer: stored as orc and tblproperties('transactional'='true')
Hive ACID transactions require the underlying storage format to support record-level updates and deletes efficiently, which is strictly limited to ORC format. The table property transactional=true must also be set.
Question 54 of 60 · Hiveql operations · Hard
What is the primary operational difference between ORDER BY and SORT BY in HiveQL?
Not quite. Try another option.
Answer: ORDER BY guarantees total global ordering using a single reducer, while SORT BY guarantees partial ordering within each reducer.
ORDER BY forces all data through a single reducer to guarantee global total order, which can cause severe bottlenecks. SORT BY sorts data within each individual reducer, yielding partially sorted output files.
Question 55 of 60 · Hiveql operations · Hard
In a HiveQL query, what is the effect of using CLUSTER BY col_name?
Not quite. Try another option.
Answer: It is a shortcut that is functionally equivalent to DISTRIBUTE BY col_name SORT BY col_name ASC.
CLUSTER BY col is syntactic sugar in HiveQL for DISTRIBUTE BY col SORT BY col. It ensures that rows with the same key go to the same reducer, and within that reducer, the rows are sorted by that key in ascending order.
Question 56 of 60 · Hive operators · Hard
Which Hive operator should be used to safely compare two columns for equality where both columns might contain NULL values, ensuring it returns TRUE if both are NULL?
Not quite. Try another option.
Answer: <=>
The <=> operator is the null-safe equal operator in Hive. If both operands are NULL, it returns TRUE. If one is NULL and the other is not, it returns FALSE. Standard = would return NULL in these cases.
Question 57 of 60 · Hive operators · Hard
Evaluate the following Hive logical operation: SELECT NULL AND FALSE;. What is the result returned by Hive?
Not quite. Try another option.
Answer: FALSE
In three-valued logic, AND requires both operands to be TRUE to return TRUE. If one operand is definitively FALSE, the entire expression evaluates to FALSE regardless of the other operand, even if it is NULL.
Question 58 of 60 · Hive operators · Hard
If a user applies the bitwise NOT operator ~ on a TINYINT column containing the value 1, what is the resulting integer value?
Not quite. Try another option.
Answer: -2
The bitwise NOT operator ~ inverts all bits. For an 8-bit signed integer (TINYINT), 1 is 00000001. Inverting it gives 11111110, which is the two's complement representation of -2.
Question 59 of 60 · Hive operators · Hard
Which of the following correctly describes the behavior of the RLIKE operator in Hive?
Not quite. Try another option.
Answer: It evaluates regular expressions and returns TRUE if any substring of the string matches the pattern.
RLIKE (and REGEXP) in Hive acts like Java's Matcher.find(), returning TRUE if the regex pattern matches any part of the input string. To enforce a full string match, anchor characters (^ and $) must be used.
Question 60 of 60 · Hiveql operations · Hard
In a complex HiveQL query utilizing window functions, how does the frame specification ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING handle the first row of a partition?
Not quite. Try another option.
Answer: It ignores the preceding bound, aggregating only the CURRENT ROW and the 1 FOLLOWING row.
For the first row in a partition, there is no preceding row. The windowing framework automatically adjusts the frame to include only the existing rows, meaning the frame effectively operates on the current row and the next row.
That's unit 4
Answer a few questions and your score shows up here.
Nearly through. Did unit 4 of INT312 save you a night before the exam?
LPU Notes is free. A student pays for the servers.
Did unit 4 of INT312 save you a night before the exam?
Then you can help keep it free for the next batch. Ads cover part of the server bill;
the rest comes out of a student's own pocket: the domain, the storage, and keeping
the site up through the weeks everyone needs it at once.
The payment button didn't load. An ad blocker or a filtered network is the usual reason.
to try again.