- 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 III
Q 1 - In case of one large table and 2 small tables, for an optimized query performance
A - The largest one should be cached to memory and small ones should be streamed
B - The small Ones should be cached and large one should be streamed
Answer : B
Explanation
When the small one is cached, each row from the larger table can be efficiently compared with each row of the small table.
Q 2 - The DISTRIBUTED BY clause in hive
A - comes Before the sort by clause
B - comes after the sort by clause
Answer : A
Explanation
Sorting as the last clause will be efficient as that is also the last step in the reduce job producing the output.
Q 3 - The DISTRIBUTED by clause is used to ensure that
A - similar values go to the same reducer
B - similar values go to same mapper
C - similar values are distributed evenly across all the reducers
D - similar values are distributed evenly across all the mapers
Answer : A
Explanation
The DISTRIBUTED BY clause send a range of values to the same reducer.
Q 4 - A view in Hive can be seen by using
Answer : A
Explanation
There is no separate clause for viewing views. It is shown using show tables.
Q 5 - A View in Hive can be dropped by using
Answer : B
Explanation
DROP view drops the view.
Q 6 - The name of a view in Hive
A - can be same as the name of another table in the same database
B - cannot be same as the name of another table in the same database
Answer : B
Explanation
Views and tables are treated similarly in the hive metadata
Q 7 - The query
Create table TABLE_NAME LIKE VIEW_NAME
A - creates a table which is copy of the view
Answer : A
Explanation
A table can be created form a view
Q 8 - what can be altered about a view
Answer : C
Explanation
TBLPROPERTIES stores some documentation about the table like created date time etc.
Q 9 - Which kind of keys(CONSTRAINTS)Â Hive can have?
Answer : D
Explanation
Hive is schema on read and unlike RDBMS it does not have a way to enforce the existence of keys.
Q 10 - The Index in Hive can be seen by
Answer : B
Explanation
Similar to show tables, Indexes can be queried by SHOW Index.
Q 11 - If an Index is dropped then
A - The underlying table is also dropped
B - The underlying table is not dropped
Answer : D
Explanation
AN index can be dropped only after dropping the table on which index is created.
Q 12 - Indexes can be created
Answer : A
Explanation
As external table data is managed by other applications hive does not create index on them.
Q 13 - The clause " WITH DEFERRED REBUILD" while creating an index
A - creates index on a table which is yet to be created
B - creates index on a table which has no data
Answer : D
Explanation
It is about creating index on an empty table.
Q 14 - If the data on the table on which an index is defined changes then,
B - The index rebuilds automatically
Answer : C
Explanation
Hive does not manage the Index like RDBMS. SO it has to be built manually.
Q 15 - The identifiers in HiveQL are
Answer : A
Explanation
Hive is case insensitive
Q 16 - What is the disadvantage of using too many partitions in Hive tables?
Answer : D
Explanation
Too many partitions create too many files and too much metadata to be stored by namenode.
Q 17 - When importing data to using SerDe, if a row is found to have more columns than expected then
A - The extra columns are replaced with NULL
Answer : D
Explanation
Hive is schema on Read and It does not throw error for mismatch between schema and actual data.
Q 18 - Consider the below two sets of queries.
Query A: hive> INSERT OVERWRITE TABLE sales SELECT * FROM history WHERE action = 'purchased'; hive> INSERT OVERWRITE TABLE credits SELECT * FROM history WHERE action = 'returned'; and Query B: hive> FROM history INSERT OVERWRITE sales SELECT * WHERE action = 'purchased' INSERT OVERWRITE credits SELECT * WHERE action = 'returned'
Which of them will make a single pass through?
Answer : B
Explanation
in Query B, the query is executed only once.
Q 19 - Which of the following feature is used to analyze the query execution plan
Answer : C
Explanation
EXPLAIN is used to analyze the query execution plan.
Q 20 - The LIMIT clause applied to a select query
A - Executes the entire query before the LIMIT clause
B - Hive fetches one row at a time until it gets the required limit.
C - Creates a temporary file and stores the query result their
Answer : A
Explanation
The query is run on complete data set and then the results are restricted using LIMIT clause.
Q 21 - The default limit to the number of rows returned by a query can be done using which of the following parameter?
A - hive.limit.optimize.enable
B - hive.limit.enable.optimize
Answer : A
Explanation
This parameter is configured to change the default value of the number of rows returned
Q 22 - The Property that decides what is the maximum number of files that can be sampled during the use of the LIMIT clause is
A - hive.limit.optimize.file.max
B - hive.limit.optimize.limit.file
Answer : B
Explanation
This property decides the number files to be looked into for the sample result.
Q 23 - Which of the following hint is used to optimize the join queries
A - /* joinlast(table_name) */
B - /* joinfirst(table_name) */
Answer : C
Explanation
Streaming a table of small size makes the query faster.
Q 24 - Setting the local mode execution to true causes
A - All tasks are executed on data available closet to the namenode
B - All tasks are executed only on a single machine
C - All the data files are cached on a datanode before query execution
Answer : B
Explanation
Local mode avoid creating mapreduce job while running the job in a single machine.
Q 25 - Hive can automatically decide to run local mode by setting which of the following parameters in hive-site.xml?
A - hive.exec.mode.local.enable
B - hive.exec.mode.cluster.disable
Answer : D
Explanation
This parameter is used to set local mode.
Answer Sheet
Question Number | Answer Key |
---|---|
1 | B |
2 | A |
3 | A |
4 | A |
5 | B |
6 | B |
7 | A |
8 | C |
9 | D |
10 | B |
11 | D |
12 | A |
13 | D |
14 | C |
15 | A |
16 | D |
17 | D |
18 | B |
19 | C |
20 | A |
21 | A |
22 | B |
23 | C |
24 | B |
25 | D |
To Continue Learning Please Login
Login with Google