Unit 4: Introduction to Apache Hive - Practice Quiz
1 Which software framework is commonly required for installing and running Apache Hive?
2 Which environment variable usually points to the Apache Hive installation directory?
3 Which file is commonly used to configure Apache Hive settings?
4 Which Hive data type is used to store whole numbers?
5 Which Hive data type is used to store text?
6 Which of the following is a complex data type in Hive?
7 What does Hive bucketing primarily do?
8 Which clause is used to define bucket columns in a Hive table?
9 Which phrase specifies the number of buckets in a Hive table definition?
10 What is the main purpose of partitioning a Hive table?
11 Which clause is used to define partition columns in Hive?
12 What is partition pruning in Hive?
13 Which HiveQL statement creates a new table?
14 Which HiveQL statement retrieves data from a table?
15 Which HiveQL statement adds query results to an existing table?
16 Which HiveQL statement removes both a table definition and its managed data?
17 Which operator tests whether two values are equal in HiveQL?
18 Which logical operator requires both conditions to be true?
19 Which arithmetic operator is used for addition in HiveQL?
20
In a HiveQL LIKE pattern, which symbol represents any sequence of characters?
21 After installing Hive with an external MySQL metastore, Hive fails because the metastore tables do not exist. Which command should be run before starting Hive?
22 A team uses Hive's default embedded Derby metastore. Why might two developers be unable to run separate Hive sessions simultaneously from the same installation directory?
23 Hive is installed successfully, but creating a managed table fails because Hive cannot write to its warehouse directory in HDFS. Which action most directly addresses the problem?
24
A table stores a variable-length list of product identifiers for each order. Which Hive data type is most appropriate for the product_ids column?
25
A customer column must contain name, email, and age as named fields within a single value. Which declaration best represents this requirement?
26 A financial table must store monetary amounts with exactly two fractional digits and up to ten total digits. Which Hive type is the best choice?
27
A table is declared with CLUSTERED BY (customer_id) INTO 16 BUCKETS. How is a row normally assigned to a bucket?
customer_id modulo 16
28
Two large tables are bucketed on customer_id using compatible bucket counts and bucketing rules. Which workload is most likely to benefit?
customer_id
29 A bucketed table contains 32 buckets. An analyst needs a repeatable sample based on the bucketing column. Which clause is designed for this purpose?
30 A table is declared as bucketed into eight buckets, but data files are copied directly into its directory without applying the bucketing logic. What is the main consequence?
31
A sales table is partitioned by sale_date. Which query is most likely to benefit from partition pruning?
32
Data for a new static partition must be loaded into a table partitioned by year and month. Which statement correctly targets March 2025?
33
A table is partitioned by the exact event_timestamp, producing thousands of tiny partitions each day. Which redesign is generally more practical?
34 Partition directories already exist in HDFS, but their metadata was not added to the Hive metastore. Which command can discover and register them?
35 A query must return each department and its average salary, but only for departments whose average exceeds 60000. Which clause should contain the aggregate condition?
36
A query needs a globally ordered result by total_sales across all output rows. Which HiveQL clause should be used?
37 A developer wants to replace the existing data in a target table with the result of a query. Which HiveQL form is appropriate?
38 Which condition selects employees whose salary is between 40000 and 60000, including both boundary values?
39
A query must find rows where middle_name has no value. Which predicate correctly handles Hive's null semantics?
40
A tags column has type ARRAY<STRING>. Which expression accesses the first tag in the array?
41 A development team starts HiveServer2 with the default embedded Derby metastore. The first session works, but a second concurrent Hive process fails to access metadata. What is the most appropriate production fix?
42
HiveServer2 must use a remote metastore available at thrift://meta1:9083. Which client-side setting establishes this connection?
hive.metastore.warehouse.dir to thrift://meta1:9083 and restart HDFS
hive.server2.thrift.bind.host to meta1:9083
javax.jdo.option.ConnectionURL to thrift://meta1:9083
hive.metastore.uris to thrift://meta1:9083
43 After upgrading Hive binaries, startup reports that the PostgreSQL metastore schema version is older than the Hive software version. Assuming the database is backed up, which action directly addresses the mismatch?
schematool -dbType postgres -upgradeSchema
schematool -dbType postgres -initSchema
hdfs namenode -format before restarting the metastore service
44
HiveServer2 can connect to the metastore, but queries fail with permission errors while creating managed tables under /user/hive/warehouse. Which installation issue is most directly implicated?
45
A value stored as DECIMAL(5,2) is rounded from 999.995 to two fractional digits. What is the smallest decimal type that can represent the rounded result without overflow?
DECIMAL(7,3), because rounding always requires one additional integer and fractional digit
DECIMAL(6,3)
DECIMAL(5,2)
DECIMAL(6,2)
46
Two columns contain CHAR(5) value ab and VARCHAR(5) value ab , respectively. Which statement correctly describes Hive's trailing-space semantics?
BINARY during equality tests
CHAR comparisons ignore trailing spaces, while VARCHAR trailing spaces remain significant
VARCHAR comparisons ignore trailing spaces, while CHAR trailing spaces remain significant
47
Given a ARRAY<INT> and m MAP<STRING,INT>, what does Hive return for a[0] and m['missing'] when a = array(7,8) and the map has no missing key?
NULL and NULL
8 and 0
7 and an exception, because absent map keys cannot be evaluated in a projection
7 and NULL
48
For a column declared UNIONTYPE<INT,STRING,DOUBLE>, which expression constructs the string alternative containing high?
create_union('STRING', 'high'), using the member type name instead of a numeric tag
create_union(2, 'high')
create_union(1, 'high')
create_union(0, 'high')
49
A table is declared CLUSTERED BY (customer_id) INTO 32 BUCKETS, but existing files were copied into its directory without being written by a bucketing-aware Hive operation. Which conclusion is valid?
customer_id, allowing pruning to replace bucket validation
50
Table L has 8 buckets on id, and table R has 24 buckets on id. Ignoring other optimizer constraints, which property supports a bucket map join on L.id = R.id?
51
Assume an integer bucket key uses bucket number (hash(key) & 0x7fffffff) % 4, with hash(key) = key. Into which bucket is key -3 placed?
52
A table is partitioned by (dt STRING, region STRING). For INSERT ... PARTITION (dt, region) with both partitions dynamic, how must the source projection be arranged?
region and dt values must be the first columns in reverse partition-key order
dt and region values must be the final columns in that partition-key order
53
With hive.exec.dynamic.partition.mode=strict, which insertion into a table partitioned by (dt, country) is permitted?
PARTITION (dt, country) with DISTRIBUTE BY dt, country added to make every partition dynamic
PARTITION (dt, country) with both values selected dynamically
PARTITION (dt='2025-01-01', country) with country selected dynamically
PARTITION (dt, country) with both values generated by deterministic functions
54
A table is partitioned by string column dt in ISO format. A query filters with year(to_date(dt)) = 2025, but the optimizer cannot infer a direct partition constraint from that function. Which rewrite most directly enables partition pruning for 2025?
date_format(to_date(dt), 'yyyy') = '2025', which normalizes every partition value before scanning
dt >= '2025-01-01' AND dt < '2026-01-01'
cast(substr(dt,1,4) AS INT) = 2025
year(to_date(dt)) BETWEEN 2025 AND 2025
55 A source table feeds three aggregate tables with different filters. Which HiveQL structure is designed to express the work while sharing a single source scan?
INSERT statements enclosed in one transaction
UNION ALL query whose branches each overwrite a different target table
FROM clause and three INSERT branches
MERGE statement that updates all target tables through one matched source condition
56
A query must retain every row from customers, including customers with no qualifying order. Which placement of o.status = 'PAID' preserves that requirement?
WHERE clause after the LEFT OUTER JOIN
HAVING clause without grouping the order rows
ON clause of the LEFT OUTER JOIN
ON and WHERE so Hive can eliminate duplicate null-extended rows
57
A partitioned table contains data for many dates. What is the effect of INSERT OVERWRITE TABLE sales PARTITION (dt='2025-03-01') SELECT ...?
58
For nullable columns a and b, which predicate evaluates to TRUE when both values are NULL and to FALSE when exactly one is NULL?
a IS NULL OR b IS NULL
coalesce(a, b) IS NULL, combined with ordinary equality for every non-null case
a <=> b
a = b
59
For a non-null value x = 1, a subquery used by x NOT IN (...) returns the set {2, NULL}. Under SQL three-valued logic, what is the predicate's result?
TRUE, because 1 differs from 2
FALSE, because every set containing NULL matches all values
UNKNOWN, so a WHERE clause filters the row out
NULL, but a WHERE clause automatically converts it to TRUE for non-null x
60
Given Boolean values a = TRUE, b = FALSE, and c = FALSE, what is the result of a OR b AND c under Hive operator precedence?
TRUE, because AND is evaluated before OR
NULL, because mixed logical operators require explicit parentheses
FALSE, because Hive evaluates all Boolean operators strictly from left to right regardless of precedence
FALSE, because OR is evaluated before AND
Did this save you a night before the exam?
LPU Notes is free, and it stays free. 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.
Nothing here is ever locked, and nothing unlocks. Chip in only if it was worth it. What it pays for →