Hive Online Quiz


Advertisements

Following quiz provides Multiple Choice Questions (MCQs) related to Hive. You will have to read all the given answers and click over the correct answer. If you are not sure about the answer then you can check the answer using Show Answer button. You can use Next Quiz button to check new set of questions in the quiz.

Questions and Answers

Q 1 - 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.

Answer : A

Explanation

Copying data is done by OS commands and not Hive

Q 3 - If the directory for a partition does not exist, and a query is executed for this partition then

A - error is thrown

B - mapreduce job is not triggered

C - Result from a random partition is returned.

D - No result are returned

Answer : D

Explanation

The map reduce job is triggered but no result will be returned.

Answer : A

Explanation

using the ALTER TABLE…….. ENABLE NO_DROP & ENABLE OFFLINE clause.

Q 5 - When a Hive query joins 3 tables, How many mapreduce jobs will be started?

A - 1

B - 2

C - 3

D - 0

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 6 - 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.

Q 7 - 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 8 - 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.

Q 9 - The reverse() function reverses a string passed to it in a Hive query. This is an example of

A - Standard UDF

B - Aggregate UDF

C - Table Generating UDF

D - None

Answer : A

Explanation

reverse(‘abcd’) gives ‘dcba’. So it is a standard UDF.

Q 10 - Which of the following File Formats are supported by Hive?

A - Text Files

B - Sequnce FIles

C - RC Files

D - All of the above

Answer : D

Explanation

Hive supports all these three file formats as they are also supported by Hadoop in general

hive_questions_answers.htm
Advertisements