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.

Questions and Answers

Hive Mock Test I

Answer : A

Explanation

As indexes are defined on a table, the removal of table partition also removes the respective index.

Answer : B

Explanation

Hive is suited for effectively organizing and querying the store data and not inserting/updating data which is required for OLTP.

Q 3 - The results of a hive query can be stored as

A - local file

B - hdfs file

C - both

D - can not be stored

Answer : C

Explanation

Using the command INSERT OVERWRITE DITECTORY ….. data can be exported to both local and hdfs file system.

Q 4 - Which of the following is not a complex  data type in Hive?

A - Matrix

B - Array

C - Map

D - STRUCT

Answer : A

Explanation

There is no Matrix data type in Hive.

Answer : C

Explanation

Client machines can use programing languages like Java, Ruby etc to access Hive remotely using Hive Thrift service.

Q 6 - The default delimiter in hive to separate the element in STRUCT is

A - '\001'

B - '\oo2'

C - '\oo3'

D - '\oo4'

Answer : B

Explanation

The four default delimiters are − \n for record separator,

001\ for field separator

002\ for element separator in ARRAY or STRUCT

003\ for element separator in MAP

Answer : A

Explanation

The schema only refers to the data stored and data is not validated against schema when inserted or loaded.

Answer : D

Explanation

Instead of returning error, Hive returns null values for mismatch between schema and actual data.

Q 9 - The query "SHOW DATABASE LIKE 'h.*' ; gives the output with database name

A - containing h in their name

B - starting with h

C - ending with h

D - containing 'h.'

Answer : B

Explanation

Hive support regular expressions which are derived from regex capabilities of Java language.

Q 10 - Each database created in hive is stored as

A - a directory

B - a file

C - a hdfs block

D - a jar file

Answer : A

Explanation

Each database becomes a directory and each table becomes a file in that directory

Answer : A

Explanation

Each database becomes a directory and each table becomes a file in that directory

Answer : B

Explanation

Hive does not recursively delete the directory. So tables must be dropped first.

Q 13 - If the database contains some tables then it can be forced to drop without dropping the tables by using the keyword

A - RESTRICT

B - OVERWRITE

C - F DROP

D - CASCADE

Answer : D

Explanation

CASCADE clause drops the table first before dropping the database

Q 14 - Using the ALTER DATABASE command in an database you can change the

A - database name

B - database creation time

C - dbproperties

D - directory where the database is stored

Answer : C

Explanation

only dbproperties are changed through this command

Answer : A

Explanation

Copying data is done by OS commands and not Hive

Answer : D

Explanation

As they are managed by Hive metadata, other applications cannot access it.

Answer : D

Explanation

As it is hive managed table both the data and schema definition are dropped.

Answer : A

Explanation

As the data is stored externally Hive only drops the schema.

Answer : B

Explanation

These are the 2 properties which are by default added by Hive

Q 21 - To see the data types details of only a column (not the table) we should use the command

A - DESCRIBE

B - DESCRIBE EXTENDED

C - DESCRIBE FORMATTED

D - DESCRIBE COLUMN

Answer : A

Answer : B

Explanation

Partitions of a table creates more subdirectories under it.

Answer : B

Explanation

Partitioning creates subdirectories and only those subdirectories are read to fetch the query result, improving the performance.

Q 25 - To see the partitions present in a Hive table the command used is

A - Describe

B - show

C - describe extended

D - show extended

Answer : B

Explanation

SHOW PARTTIONS table_name

Answer Sheet

Question Number Answer Key
1 A
2 B
3 C
4 A
5 C
6 B
7 A
8 D
9 B
10 A
11 A
12 B
13 D
14 C
15 A
16 D
17 D
18 A
19 D
20 B
21 A
22 B
23 A
24 B
25 B
hive_questions_answers.htm
Advertisements