Free CCA175 Exam Braindumps (page: 6)

Page 6 of 25

Problem Scenario 85 : In Continuation of previous question, please accomplish following activities.

1. Select all the columns from product table with output header as below. productID AS ID
code AS Code name AS Description price AS 'Unit Price'
2. Select code and name both separated by ' -' and header name should be Product
Description'.
3. Select all distinct prices.
4. Select distinct price and name combination.
5. Select all price data sorted by both code and productID combination.
6. count number of products.
7. Count number of products for each code.

  1. See the explanation for Step by Step Solution and configuration.

Answer(s): A

Explanation:

Solution :
Step 1: Select all the columns from product table with output header as below. productID AS ID code AS Code name AS Description price AS "Unit Price' val results = sqlContext.sql(......SELECT productID AS ID, code AS Code, name AS Description, price AS Unit Price' FROM products ORDER BY ID""" results.show()
Step 2: Select code and name both separated by ' -' and header name should be "Product Description.
val results = sqlContext.sql(......SELECT CONCAT(code, ' -', name) AS Product Description, price FROM products""" )
results.showQ
Step 3: Select all distinct prices.
val results = sqlContext.sql(......SELECT DISTINCT price AS Distinct Price" FROM products......)
results.show()
Step 4: Select distinct price and name combination. val results = sqlContext.sql(......SELECT DISTINCT price, name FROM products""" ) results. showQ
Step 5: Select all price data sorted by both code and productID combination. val results = sqlContext.sql('.....SELECT' FROM products ORDER BY code, productID'.....) results.show()
Step 6: count number of products.
val results = sqlContext.sql(......SELECT COUNT(') AS 'Count' FROM products......) results.show()
Step 7: Count number of products for each code.
val results = sqlContext.sql(......SELECT code, COUNT('} FROM products GROUP BY code......)
results. showQ
val results = sqlContext.sql(......SELECT code, COUNT('} AS count FROM products GROUP BY code ORDER BY count DESC......)
results. showQ



Problem Scenario 18 : You have been given following mysql database details as well as other info.
user=retail_dba
password=cloudera
database=retail_db
jdbc URL = jdbc:mysql://quickstart:3306/retail_db
Now accomplish following activities.

1. Create mysql table as below.
mysql --user=retail_dba -password=cloudera
use retail_db
CREATE TABLE IF NOT EXISTS departments_hive02(id int, department_name
varchar(45), avg_salary int);
show tables;
2. Now export data from hive table departments_hive01 in departments_hive02. While
exporting, please note following. wherever there is a empty string it should be loaded as a
null value in mysql.
wherever there is -999 value for int field, it should be created as null value.

  1. See the explanation for Step by Step Solution and configuration.

Answer(s): A

Explanation:

Solution :
Step 1: Create table in mysql db as well.
mysql ~user=retail_dba -password=cloudera
use retail_db
CREATE TABLE IF NOT EXISTS departments_hive02(id int, department_name varchar(45), avg_salary int);
show tables;
Step 2: Now export data from hive table to mysql table as per the requirement. sqoop export --connect jdbc:mysql://quickstart:3306/retail_db \ -username retaildba \
-password cloudera \
--table departments_hive02 \
-export-dir /user/hive/warehouse/departments_hive01 \ -input-fields-terminated-by '\001' \
--input-Iines-terminated-by '\n' \
--num-mappers 1 \
-batch \
-Input-null-string "" \
-input-null-non-string -999
Step 3: Now validate the data, select * from departments_hive02;



CORRECT TEXT
Problem Scenario 10 : You have been given following mysql database details as well as other info.
user=retail_dba
password=cloudera
database=retail_db
jdbc URL = jdbc:mysql://quickstart:3306/retail_db
Please accomplish following.

1. Create a database named hadoopexam and then create a table named departments in
it, with following fields. department_id int,
department_name string
For e.g. location should be
hdfs://quickstart.cloudera:8020/user/hive/warehouse/hadoopexam.db/departments
2. Please import data in existing table created above from retaidb.departments into hive
table hadoopexam.departments.
3. Please import data in a non-existing table, means while importing create hive table
named hadoopexam.departments_new

  1. See the explanation for Step by Step Solution and configuration.

Answer(s): A

Explanation:

Solution:
Step 1: Go to hive interface and create database.
hive
create database hadoopexam;

Step 2: Use the database created in above step and then create table in it. use hadoopexam; show tables;
Step 3: Create table in it.
create table departments (department_id int, department_name string); show tables;
desc departments;
desc formatted departments;
Step 4: Please check following directory must not exist else it will give error, hdfs dfs -Is /user/cloudera/departments
If directory already exists, make sure it is not useful and than delete the same. This is the staging directory where Sqoop store the intermediate data before pushing in hive table.
hadoop fs -rm -R departments
Step 5: Now import data in existing table
sqoop import \
-connect jdbc:mysql://quickstart:3306/retail_db \
~username=retail_dba \
-password=cloudera \
--table departments \
-hive-home /user/hive/warehouse \
-hive-import \
-hive-overwrite \
-hive-table hadoopexam.departments
Step 6: Check whether data has been loaded or not.
hive;
use hadoopexam;
show tables;
select" from departments;
desc formatted departments;
Step 7: Import data in non-existing tables in hive and create table while importing.
sqoop import \
-connect jdbc:mysql://quickstart:3306/retail_db \
--username=retail_dba \
~password=cloudera \
-table departments \
-hive-home /user/hive/warehouse \
-hive-import \
-hive-overwrite \
-hive-table hadoopexam.departments_new \
-create-hive-table
Step 8: Check-whether data has been loaded or not.
hive;
use hadoopexam;
show tables;
select" from departments_new;
desc formatted departments_new;



Problem Scenario 64 : You have been given below code snippet.
val a = sc.parallelize(List("dog", "salmon", "salmon", "rat", "elephant"), 3)
val b = a.keyBy(_.length)
val c = sc.parallelize(Ust("dog", "cat", "gnu", "salmon", "rabbit", "turkey", "wolf", "bear", "bee"), 3)
val d = c.keyBy(_.length)
operation1
Write a correct code snippet for operationl which will produce desired output, shown below.
Array[(lnt, (Option[String], String))] = Array((6, (Some(salmon), salmon)), (6, (Some(salmon), rabbit}}, (6, (Some(salmon), turkey)), (6, (Some(salmon), salmon)), (6, (Some(salmon), rabbit)), (6, (Some(salmon), turkey)), (3, (Some(dog), dog)), (3, (Some(dog), cat)), (3, (Some(dog), gnu)), (3, (Some(dog), bee)), (3, (Some(rat), (3, (Some(rat), cat)), (3, (Some(rat), gnu)), (3, (Some(rat), bee)), (4, (None, wo!f)), (4, (None, bear)))

  1. See the explanation for Step by Step Solution and configuration.

Answer(s): A

Explanation:

Solution : b.rightOuterJqin(d).collect
rightOuterJoin [Pair] : Performs an right outer join using two key-value RDDs. Please note that the keys must be generally comparable to make this work correctly.



Page 6 of 25



Post your Comments and Discuss Cloudera CCA175 exam with other Community members:

Imran commented on December 27, 2024
This is nice stuff
Anonymous
upvote

Akki1990 commented on December 27, 2024
This is really good way to revise all topics , Thank you so much !
Anonymous
upvote

Saf commented on December 27, 2024
Very Useful
Anonymous
upvote

Hekka commented on December 27, 2024
Good set of questions
Anonymous
upvote

Amber commented on December 27, 2024
Passed the exam today. It is going to be a great new year.
UNITED STATES
upvote

Microsoftee commented on December 27, 2024
Thank you so much. Nice material.
Anonymous
upvote

sandy commented on December 27, 2024
good content
Anonymous
upvote

anonymous a commented on December 27, 2024
helpful stuff
Anonymous
upvote

Ravi commented on December 27, 2024
So far so good
INDIA
upvote

Poo commented on December 27, 2024
Useful data
Anonymous
upvote

Cosy commented on December 26, 2024
I am loving it here
Anonymous
upvote

Tanuja Bhusal commented on December 26, 2024
Good Questions
Anonymous
upvote

anonymous commented on December 26, 2024
Just going through the questions for my understanding of Power Bi
UNITED STATES
upvote

laks commented on December 26, 2024
so far seems good
UNITED STATES
upvote

Mooni commented on December 26, 2024
It's really good
SAUDI ARABIA
upvote

Phoebe commented on December 26, 2024
Good questions
FRANCE
upvote

rz commented on December 26, 2024
It's very helpful for exam
TAIWAN PROVINCE OF CHINA
upvote

Nitesh Kumar Singh commented on December 26, 2024
Nice to attend
Anonymous
upvote

Pankaj Kumar commented on December 26, 2024
Its good to have all the relevant questions here.. Thanks for help!
UNITED STATES
upvote

ian commented on December 26, 2024
yes, is this still valid?
UNITED STATES
upvote

Onkar commented on December 26, 2024
Questions looks promising.
Anonymous
upvote

JcD commented on December 25, 2024
Great learning
Anonymous
upvote

Sam commented on December 25, 2024
Are these real questions? They seem too easy to be true
UNITED STATES
upvote

Netra commented on December 25, 2024
Very useful
UNITED STATES
upvote

Prg commented on December 25, 2024
good set of questions
Anonymous
upvote

n commented on December 25, 2024
Question are
Anonymous
upvote

Ni commented on December 25, 2024
useful questions
Anonymous
upvote

ry commented on December 24, 2024
very helpful
Anonymous
upvote

Jatin Gohil commented on December 24, 2024
Good contents. The exams questions are real
Anonymous
upvote

Anonymous commented on December 24, 2024
very useful
CHILE
upvote

Mohamedk commented on December 24, 2024
It's very nice
Anonymous
upvote

Amer commented on December 24, 2024
Thanks alot
EGYPT
upvote

shankar commented on December 24, 2024
good set of questions
CHINA
upvote

VARSHA commented on December 24, 2024
GOOD QUSTIOENS.. LIKED IT
Anonymous
upvote