- Hive Tutorial
- Hive - Home
- Hive - Introduction
- Hive - Installation
- Hive - Data Types
- Hive - Create Database
- Hive - Drop Database
- Hive - Create Table
- Hive - Alter Table
- Hive - Drop Table
- Hive - Partitioning
- Hive - Built-In Operators
- Hive - Built-In Functions
- Hive - Views And Indexes
- HiveQL
- HiveQL - Select Where
- HiveQL - Select Order By
- HiveQL - Select Group By
- HiveQL - Select Joins
- Hive Useful Resources
- Hive - Questions and Answers
- Hive - Quick Guide
- Hive - Useful Resources
Hive Mock Test
This section presents you various set of Mock Tests related to Hive. You can download these sample mock tests at your local machine and solve offline at your convenience. Every mock test is supplied with a mock test key to let you verify the final score and grade yourself.
Hive Mock Test II
Q 1 - To see the partitions keys present in a Hive table the command used is
Answer : C
Explanation
The DESCRIBE EXTENDED command gives all the details
Q 2 - If the directory for a partition does not exist, and a query is executed for this partition then
B - mapreduce job is not triggered
Answer : D
Explanation
The map reduce job is triggered but no result will be returned.
Q 3 - In Hive SerDe stands for
Answer : B
Explanation
It is a program to read and write files using Java Input and Output formats.
Q 4 - SerDe
A - parses records to columns while reading and columns to records when writing
B - parses records to columns while writing and columns to records when reading
C - creates partitions from columns using each of the records
Answer : A
Explanation
Converting records to columns is serializing and the reverse is Deerializing
Q 5 - Users can pass configuration information to the SerDe using
Answer : B
Explanation
This feature of SrrDe is used to customize Hive for a wide range of file formats
Q 6 - If we change the partition location of a hive table using ALTER TABLE option then the data for that partition in the table
A - also moves automatically to the new location
B - has to be dropped and recreated
Answer : D
Explanation
Data is independent of schema in Hive.
Q 7 - If the schema of the table does not match with the data types present in the file containing the table then HIve
A - Automatically drops the file
B - Automatically corrects the data
Answer : C
Explanation
Hive always tries to read the data as it is Schema on Read.
Q 8 - The position of a specific column in a Hive table
A - can be anywhere in the table creation clause
B - must match the position of the corresponding data in the data file
C - Must match the position only for date time data type in the data file
Answer : B
Explanation
It is up to the user to ensure the synchronization between schema and data
Q 9 - When a partition is archived in Hive it
A - Reduces space through compression
Answer : D
Explanation
Archiving merges the files into one directory.
Q 10 - Partitioned can be prevented from being
Answer : A
Explanation
using the ALTER TABLE…….. ENABLE NO_DROP & ENABLE OFFLINE clause.
Q 11 - While loading data into managed tables, If the LOCAL clause is mentioned, it
A - Moves the data from local filesystem to the target files system
B - Copies the data from local filesystem to target final file system
Answer : B
Explanation
The LOCAL clause only copies without moving the files.
Q 12 - Creating a table an loading it with a select clause in one query applies to
Answer : A
Explanation
Only a internal table can be created and loaded with data using one query.
Q 13 - While querying a hive table for a Array type column, if the array index is nonexistent then
Answer : A
Explanation
Hive returns NULL while in java it would have returned index out of bound error
Q 14 - While querying a hive table for a column with MAP data type, the elements in the column are referenced by
Answer : B
Explanation
The MAP data type is a key-value pair and not index based.
Q 15 - When the result of the STRING data type is returned by querying array data type using index, the result have
Answer : A
Explanation
The STRINGS returned form ARRAYS will not contain the quotes.
Answer : D
Explanation
STRUCT elements are key-value pairs and the elements are accessed by dot notation.
Q 17 - To select all columns starting with the word 'Sell' form the table GROSS_SELL the query is
A - select '$Sell*' from GROSS_SELL
B - select 'Sell*' from GROSS_SELL
Answer : C
Explanation
Hive supports java based regular expression for querying its metadata.
Q 18 - The performance of an aggregate query is improved by setting which of the following property as true?
Answer : B
Explanation
SET hive.map.aggr = true;
Q 19 - Consider the query SELECT explode(city_locality) from ALL_LOCALITIES , where city_locality is a ARRAY dat atype. This will return
A - all th array elements as one row for each input array
B - zero or more rows, for each element for each input array
C - Each of the array element as one column for each input array
D - zero ormore columns for each element for each input array
Answer : B
Explanation
The explode() function expands each element of ARRAY into a row.
Q 20 - The CONCAT string function in Hive can concatenate
Answer : C
Explanation
CONCAT function accepts any number of arguments
Q 21 - The clause used to limit the number of rows returned by a query is
Answer : A
Explanation
LIMIT restricts the number of rows returned by a query.
Q 22 - The property set to run hive in local mode as true so that it runs without creating a mapreduce job is
B - hive.exec.mode.local.override
Answer : A
Explanation
In local mode hive will not trigger a mapreduce job.
Q 23 - The below expression in the where clause
RLIKE '.*(Chicago|Ontario).*';
gives the result which match
A - words containing both Chicago and Ontario
B - words containing either Chicago or Ontario
Answer : B
Explanation
Hive supports java based regular expression for querying.
Q 24 - When a Hive query joins 3 tables, How many mapreduce jobs will be started?
Answer : B
Explanation
Hive cerates one mapreduce job for the first pair of tables and second pair of tables with one table common between both the pairs.
Q 25 - For optimizing join of three tables, the largest sized tables should be placed as
A - the first table in the join clause
B - second table in the join clause
Answer : C
Explanation
Hive reads the tables from left to right. Small tables should be read first and if possible cached into the memory.
Answer Sheet
Question Number | Answer Key |
---|---|
1 | C |
2 | D |
3 | B |
4 | A |
5 | B |
6 | D |
7 | C |
8 | B |
9 | D |
10 | A |
11 | B |
12 | A |
13 | A |
14 | B |
15 | A |
16 | D |
17 | C |
18 | B |
19 | B |
20 | C |
21 | A |
22 | A |
23 | B |
24 | B |
25 | C |