- 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 IV
Q 1 - Which of the following scenarios are not prevented by enabling strict mode in Hive?
A - Scanning all the partitions
B - Generating random sample of data
Answer : B
Explanation
The other three scenarios create long running job. So STRICT mode is applied to them.
Q 2 - If a hive query produces unexpected result then its cause can be investigated by using
Answer : B
Explanation
Virtual columns give the complete path and name of data block from where the error is arising.
Q 3 - Intermediate compression in Hive is about
A - Compressing the data just before it is read by mapreduce task
B - Compressing the data just before it is output to the user
C - Compressing the data before it is stored by into the disk
D - Compressing the data shuffled between the map and reduce tasks
Answer : D
Explanation
Data compression between map and reduce task is called intermediate compression.
Q 4 - Hive.exec.compress.output controls
A - The output compression of map tasks
B - The output compression of reduce tasks
Answer : C
Explanation
This property controls the compression of the output generated by a query.
Q 5 - The disadvantage of compressing files in HDFS is
Answer : C
Explanation
When files are not splitable , querying them becomes inefficient.
Q 6 - Which of the below is not a type compression option for Sequence file
Answer : C
Explanation
There is no COLUMN compression type for a sequence file
Q 7 - Which file controls the logging of commands put in CLI?
Answer : A
Explanation
This property controls the logging in command line Interface.
Q 8 - Which file controls the logging of Mapreduce Tasks?
Answer : B
Explanation
This property controls the logging in Mapreduce tasks
Q 9 - The command to list the functions currently loaded in a Hive Session is
Answer : B
Explanation
SHOW FUNCTIONS produces list of all the functions currently available in hive session
Q 10 - A standard user-defined function (UDF) refers to any function that
A - Takes one or more columns form a row and returns a single value
B - Takes one or more columns form many rows and returns a single value
C - Take zero or more inputs and produce multiple columns or rows of output
D - Detects the type of input programmatically and provides appropriate response
Answer : A
Explanation
Examples functions are – concat, reverse etc.
Q 11 - Aggregate functions in Hive are the function which
A - Takes one or more columns form a row and returns a single value
B - Takes one or more columns form many rows and returns a single value
C - Take zero or more inputs and produce multiple columns or rows of output
D - Detects the type of input programmatically and provides appropriate response
Answer : B
Explanation
Examples functions are − count, avarege etc.
Q 12 - A Table Generating Function is a Function that
A - Takes one or more columns form a row and returns a single value
B - Takes one or more columns form many rows and returns a single value
C - Take zero or more inputs and produce multiple columns or rows of output
D - Detects the type of input programmatically and provides appropriate response
Answer : C
Explanation
Examples functions is Explode()
Q 13 - A GenericUDF is a Function that
A - Takes one or more columns form a row and returns a single value
B - Takes one or more columns form many rows and returns a single value
C - Take zero or more inputs and produce multiple columns or rows of output
D - Detects the type of input programmatically and provides appropriate response
Answer : D
Explanation
These functions are created as java programs.
Q 14 - The explode() function in hive takes an array of input and iterates through it returning each element as a separate row. This is an example of
Answer : C
Explanation
SELECT explode(array(1,2,3)) AS element FROM src;
gives 1 2 3 so it is table generating function
Q 15 - The reverse() function reverses a string passed to it in a Hive query. This is an example of
Answer : A
Explanation
reverse(‘abcd’) gives ‘dcba’. So it is a standard UDF.
Q 16 - A user creates a UDF which accepts arguments of different data types, each time it is run. It is an example of
Answer : B
Explanation
Generic functions are created as java programs and can accept variable data types.
Q 17 - To add a new user defined Function permanently to Hive, we need to
A - Create a new version of HIve
B - Add the .class Java code to FunctionRegistry
Answer : B
Explanation
Functionregistry holds the list of all permanent functions
Q 18 - The UDF can access files inside
Answer : D
Explanation
All the listed filesystem can be accessed using UDF
Q 19 - The MACRO created in Hive has the ability to
A - Run multiple functions on same set of data automatically
Answer : B
Explanation
Macros are created for the purpose of calling other functiuons
Q 20 - Calling a unix bash script inside a Hive Query is an example of
Answer : D
Explanation
In this type of streaming the code resides in the script being called and Hive is not aware of the code.
Q 21 - Hive can be accessed remotely by using programs written in C++, Ruby etc, over a single port. This is achieved by using
Answer : A
Explanation
HiveServer or Hive Thrift service is used to access Hive remotely.
Q 22 - Which of the following File Formats are supported by Hive?
Answer : D
Explanation
Hive supports all these three file formats as they are also supported by Hadoop in general
Q 23 - When one of the join tables is small enough to fit into memory, The type of join used by Hive is
Answer : B
Explanation
As one of the tables already fits into the memory each row of the big table is quickly compared with each row of small table using Map Join.
Q 24 - The Hive metadata can be easily created and edited using
Answer : A
Explanation
Hcatalog stores metadata information for many Hadoop tools like Hive and Mapreduce. It can be accessed through a web interface.
Q 25 - Hive supports row-level Inser/update and Delete using the ACID features only on which file format?
Answer : C
Explanation
Except the ORC file all other files types do not support insert or update.
Answer Sheet
Question Number | Answer Key |
---|---|
1 | B |
2 | B |
3 | D |
4 | C |
5 | C |
6 | C |
7 | A |
8 | B |
9 | B |
10 | A |
11 | B |
12 | C |
13 | D |
14 | C |
15 | A |
16 | B |
17 | B |
18 | D |
19 | B |
20 | D |
21 | A |
22 | D |
23 | B |
24 | A |
25 | C |