Hive Mock Test


Advertisements

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 III

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.

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.

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

A - SHOW TABLES

B - SHOW VIEWS

C - DESCRIBE VIEWS

D - VIEW VIEWS

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

A - DROP TABLE

B - DROP VIEW

C - DELETE VIEW

D - REMOVE VIEW

Answer : B

Explanation

DROP view drops the view.

Answer : A

Explanation

A table can be created form 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?

A - Primary Keys

B - Foreign Keys

C - Unique Keys

D - None

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

A - Describe Index

B - Show Index

C - View Index

D - Find Index

Answer : B

Explanation

Similar to show tables, Indexes can be queried by SHOW Index.

Answer : D

Explanation

AN index can be dropped only after dropping the table on which index is created.

Answer : A

Explanation

As external table data is managed by other applications hive does not create index on them.

Answer : D

Explanation

It is about creating index on an empty table.

Answer : C

Explanation

Hive does not manage the Index like RDBMS. SO it has to be built manually.

Answer : A

Explanation

Hive is case insensitive

Q 16 - What is the disadvantage of using too many partitions in Hive tables?

A - It slows down the namenode

B - Storage space is wasted

C - Join quires become slow

D - All of these

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

B - The row is skipped

C - The import halts with error

D - The Columns are ignored.

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?

A - Query A

B - Query B

C - Both

D - None

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

A - Execute

B - Planner

C - Explain

D - Optimizer

Answer : C

Explanation

EXPLAIN is used to analyze the query execution plan.

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

C - hive.optimize.enable.limit

D - hive.enable.limit.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

C - hive.limit.optimize.file.restrict

D - hive.limit.optimize.limit.most

Answer : B

Explanation

This property decides the number files to be looked into for the sample result.

Answer : C

Explanation

Streaming a table of small size makes the query faster.

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

C - hive.exec.mode.local.first

D - hive.exec.mode.local.auto

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
hive_questions_answers.htm
Advertisements