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 II

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

A - describe

B - show

C - describe extended

D - show extended

Answer : C

Explanation

The DESCRIBE EXTENDED command gives all the details

Q 2 - 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 : B

Explanation

It is a program to read and write files using Java Input and Output formats.

Q 5 - Users can pass configuration information to the SerDe using

A - SET SERDEPRPERTIES

B - WITH SERDEPRPERTIES

C - BY SERDEPRPERTIES

D - CONFIG SERDEPRPERTIES

Answer : B

Explanation

This feature of SrrDe is used to customize Hive for a wide range of file formats

Q 6 - If we change the partition location of a hive table using ALTER TABLE option then the data for that partition in the table

A - also moves automatically to the new location

B - has to be dropped and recreated

C - has to  be backed up into a second table and restored

D - has to be moved manually into new location

Answer : D

Explanation

Data is independent of schema in Hive.

Q 7 - If the schema of the table does not match with the  data types present in the file containing the table then HIve

A - Automatically drops the file

B - Automatically corrects the data

C - Reports Null values for mismatched data

D - Does not allow any query to run on the table

Answer : C

Explanation

Hive always tries to read the data as it is Schema on Read.

Answer : B

Explanation

It is up to the user to ensure the synchronization between schema and data

Answer : D

Explanation

Archiving merges the files into one directory.

Answer : A

Explanation

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

Answer : B

Explanation

The LOCAL clause only copies without moving the files.

Q 12 - Creating  a table an loading it with a select clause in one query applies to

A - only managed tables

B - only external tables

C - Both types of tables

D - Only tables without partitions

Answer : A

Explanation

Only a internal table can be created and loaded with data using one query.

Q 13 - While querying a hive table for a Array type column, if the array index is nonexistent then

A - NULL is returned

B - Error is reported.

C - Partial results are returned

D - "NA" is returned

Answer : A

Explanation

Hive returns NULL while in java it would have returned index out of bound error

Q 14 - While querying a hive table for a column with MAP data type, the elements in the column are referenced by

A - Index

B - Key

C - Value

D - nested Index

Answer : B

Explanation

The MAP data type is a key-value pair and not index based.

Q 15 - When the result of the STRING data type is returned by querying array data type using index, the result have

A - no quotes

B - double suotes

C - single quotes

D - No spaces

Answer : A

Explanation

The STRINGS returned form ARRAYS will not contain the quotes.

Q 16 - An element in a STRUCT column in hive is referred by

A - index

B - key

C - colon

D - dot

Answer : D

Explanation

STRUCT elements are key-value pairs and the elements are accessed by dot notation.

Q 17 - To select all columns starting with the word 'Sell' form the table GROSS_SELL the query is

A - select '$Sell*'  from GROSS_SELL

B - select 'Sell*' from GROSS_SELL

C - select 'sell.*' from GROSS_SELL

D - select  'sell[*]' from GROSS_SELL

Answer : C

Explanation

Hive supports java based regular expression for querying its metadata.

Q 18 - The performance of an aggregate query is improved by setting which of the following property as true?

A - hive.map.group

B - hive.map.aggr

C - hive.map.sort

D - hive.map.sum

Answer : B

Explanation

SET hive.map.aggr = true;

Answer : B

Explanation

The explode() function expands each element of ARRAY into a row.

Answer : C

Explanation

CONCAT function accepts any number of arguments

Q 21 - The clause used to limit the number of rows returned by a query is

A - LIMIT

B - ROWNUM

C - RESTRICT

D - MAXROW

Answer : A

Explanation

LIMIT restricts the number of rows returned by a query.

Q 22 - The property set to run hive in local mode as true so that it runs without creating a mapreduce job is

A - hive.exec.mode.local.auto

B - hive.exec.mode.local.override

C - hive.exec.mode.local.settings

D - hive.exec.mode.local.config

Answer : A

Explanation

In local mode hive will not trigger a mapreduce job.

Answer : B

Explanation

Hive supports java based regular expression for querying.

Q 24 - 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 25 - For optimizing join of three tables, the largest sized tables should be placed as

A - the first table in the join clause

B - second table in the join clause

C - third table in the join clause

D - Does not matter

Answer : C

Explanation

Hive reads the tables from left to right. Small tables should be read first and if possible cached into the memory.

Answer Sheet

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