Step 5 : Now sort data based on product_price in order. sortedPriceProducts=nonempty_lines.map(lambdaline:(float(line.split(",")[4]),line.split(",")[2])).sortByKey()
for line in sortedPriceProducts.collect(): print(line)
Step 6 : Now sort data based on product_price in descending order. sortedPriceProducts=nonempty_lines.map(lambda line: (float(line.split(",")[4]),line.split(",")[2])).sortByKey(False)
for line in sortedPriceProducts.collect(): print(line)
Step 7 : Get highest price products name. sortedPriceProducts=nonemptyJines.map(lambda line : (float(line.split(",")[4]),line-split(,,,,,)[2]))-sortByKey(False).take(1)
print(sortedPriceProducts)
Step 8 : Now sort data based on product_price as well as product_id in descending order.
#Dont forget to cast string #Tuple as key ((price,id),name)
sortedPriceProducts=nonemptyJines.map(lambda line : ((float(line print(sortedPriceProducts)
Step 9 : Now sort data based on product_price as well as product_id in descending order, using top() function.
There is a parent organization called "ABC Group Inc", which has two child companies named Tech Inc and MPTech.
Both companies employee information is given in two separate text file as below. Please do the following activity for employee details.
Tech Inc.txt
1,Alok,Hyderabad
2,Krish,Hongkong
3,Jyoti,Mumbai
4,Atul,Banglore
5,Ishan,Gurgaon
MPTech.txt
6,John,Newyork
7,alp2004,California
8,tellme,Mumbai
9,Gagan21,Pune
10,Mukesh,Chennai
1. Which command will you use to check all the available command line options on HDFS and How will you get the Help for individual command.
2. Create a new Empty Directory named Employee using Command line. And also create an empty file named in it Techinc.txt
3. Load both companies Employee data in Employee directory (How to override existing file in HDFS).
4. Merge both the Employees data in a Single tile called MergedEmployee.txt, merged tiles should have new line character at the end of each file content.
5. Upload merged file on HDFS and change the file permission on HDFS merged file, so that owner and group member can read and write, other user can read the file.
6. Write a command to export the individual file as well as entire directory from HDFS to local file System.
Answer is in the explanation below.
Ask AI for More Explanation
— your own AI account, opens inside the app
Reference / correct answer:
See the explanation for Step by Step Solution and configuration.
Solution :
Step 1 : Check All Available command hdfs dfs
Step 2 : Get help on Individual command hdfs dfs -help get
Step 3 : Create a directory in HDFS using named Employee and create a Dummy file in it called e.g. Techinc.txt hdfs dfs -mkdir Employee
Now create an emplty file in Employee directory using Hue.
Step 4 : Create a directory on Local file System and then Create two files, with the given data in problems.
Step 5 : Now we have an existing directory with content in it, now using HDFS command line , overrid this existing Employee directory. While copying these files from local file System to HDFS. cd /home/cloudera/Desktop/ hdfs dfs -put -f Employee
Step 6 : Check All files in directory copied successfully hdfs dfs -Is Employee
Step 7 : Now merge all the files in Employee directory, hdfs dfs -getmerge -nl Employee MergedEmployee.txt
Step 8 : Check the content of the file. cat MergedEmployee.txt
Step 9 : Copy merged file in Employeed directory from local file ssytem to HDFS. hdfs dfs -put MergedEmployee.txt Employee/
Problem Scenario 52 : You have been given below code snippet.
val b = sc.parallelize(List(1,2,3,4,5,6,7,8,2,4,2,1,1,1,1,1))
Operation_xyz
Write a correct code snippet for Operation_xyz which will produce below output. scalaxollection.Map[lnt,Long] = Map(5 -> 1, 8 -> 1, 3 -> 1, 6 -> 1, 1 -> S, 2 -> 3, 4 -> 2, 7 -> 1)
Answer is in the explanation below.
Ask AI for More Explanation
— your own AI account, opens inside the app
Reference / correct answer:
See the explanation for Step by Step Solution and configuration.
Solution :
b.countByValue
countByValue
Returns a map that contains all unique values of the RDD and their respective occurrence counts. (Warning: This operation will finally aggregate the information in a single reducer.)
Listing Variants
def countByValue(): Map[T, Long]
Question 5
Problem Scenario 92 : You have been given a spark scala application, which is bundled in jar named hadoopexam.jar.
Your application class name is com.hadoopexam.MyTask
You want that while submitting your application should launch a driver on one of the cluster node.
Please complete the following command to submit the application.
spark-submit XXX -master yarn \
YYY SSPARK HOME/lib/hadoopexam.jar 10
Answer is in the explanation below.
Ask AI for More Explanation
— your own AI account, opens inside the app
Reference / correct answer:
See the explanation for Step by Step Solution and configuration
Solution
XXX: -class com.hadoopexam.MyTask
YYY : --deploy-mode cluster
Question 6
SIMULATION8
SIMULATION
Problem Scenario 58 : You have been given below code snippet.
val a = sc.parallelize(List("dog", "tiger", "lion", "cat", "spider", "eagle"), 2) val b = a.keyBy(_.length)
operation1
Write a correct code snippet for operationl which will produce desired output, shown below.
Problem Scenario 62 : You have been given below code snippet.
val a = sc.parallelize(List("dogM, "tiger", "lion", "cat", "panther", "eagle"), 2)
val b = a.map(x => (x.length, x))
operation1
Write a correct code snippet for operationl which will produce desired output, shown below. Array[(lnt, String)] = Array((3,xdogx), (5,xtigerx), (4,xlionx), (3,xcatx), (7,xpantherx), (5,xeaglex))
Answer is in the explanation below.
Ask AI for More Explanation
— your own AI account, opens inside the app
Reference / correct answer:
See the explanation for Step by Step Solution and configuration.
Solution :
b.mapValuesf'x" + _ + "x").collect
mapValues [Pair] : Takes the values of a RDD that consists of two-component tuples, and applies the provided function to transform each value. Tlien,.it.forms newtwo-componend tuples using the key and the transformed value and stores them in a new RDD.
Question 8
SIMULATION7
SIMULATION
Problem Scenario 37 : ABCTECH.com has done survey on their roducts feedback using a web based form. With the following free text field as input in web ui.
Name: String
Subscription Date: String
Rating : String
And servey data has been saved in a file called spark9/feedback.txt
Christopher|Jan 11, 2015|5
Kapil|11 Jan, 2015|5
Thomas|6/17/2014|5
John|22-08-2013|5
Mithun|2013|5
Jitendra||5
Write a spark program using regular expression which will filter all the valid dates and save in two separate file (good record and bad record)
Answer is in the explanation below.
Ask AI for More Explanation
— your own AI account, opens inside the app
Reference / correct answer:
See the explanation for Step by Step Solution and configuration.
Solution :
Step 1 : Create a file first using Hue in hdfs.
Step 2 : Write all valid regular expressions sysntex for checking whether records are having valid dates or not.
val regl =......(\d+)\s(\w{3})(,)\s(\d{4}).......r//11 Jan, 2015
val reg2 =......(\d+)(U)(\d+)(U)(\d{4})......s II 6/17/2014
val reg3 =......(\d+)(-)(\d+)(-)(\d{4})""".r//22-08-2013
val reg4 =......(\w{3})\s(\d+)(,)\s(\d{4})......s II Jan 11, 2015
Step 3 : Load the file as an RDD.
val feedbackRDD = sc.textFile("spark9/feedback.txt"}
Step 4 : As data are pipe separated , hence split the same. val feedbackSplit = feedbackRDD.map(line => line.split('|'))
Step 5 : Now get the valid records as well as , bad records.
val validRecords = feedbackSplit.filter(x => (reg1.pattern.matcher(x(1).trim).matches|reg2.pattern.matcher(x(1).trim).matches|reg3.pattern.matcher(x(1).trim).matches | reg4.pattern.matcher(x(1).trim).matches))
val badRecords = feedbackSplit.filter(x => !(reg1.pattern.matcher(x(1).trim).matches|reg2.pattern.matcher(x(1).trim).matches|reg3.pattern.matcher(x(1).trim).matches | reg4.pattern.matcher(x(1).trim).matches))
Step 6 : Now convert each Array to Strings
val valid =vatidRecords.map(e => (e(0),e(1),e(2)))
val bad =badRecords.map(e => (e(0),e(1),e(2)))
Step 7 : Save the output as a Text file and output must be written in a single tile,
case class Product(productid: Integer, code: String, name: String, quantity:lnteger, price: Float, supplierid:lnteger)
case class Suplier(supplierid: Integer, name: String, phone: String)
case class PRDSUP(productid: Integer.supplierid: Integer)
// create an RDD of Product objects
val prdRDD = products.map(_.split('\")).map(p => Product(p(0).tolnt,p(1),p(2),p(3).tolnt,p(4).toFloat,p(5).toint))
val supRDD = supplier.map(_.split(",")).map(p => Suplier(p(0).tolnt,p(1),p(2)))
val prdsupRDD = prdsup.map(_.split(",")).map(p => PRDSUP(p(0).tolnt,p(1}.tolnt}}
prdRDD.first()
prdRDD.count()
supRDD.first() supRDD.count()
prdsupRDD.first() prdsupRDD.count(}
// change RDD of Product objects to a DataFrame
val prdDF = prdRDD.toDF()
val supDF = supRDD.toDF()
val prdsupDF = prdsupRDD.toDF()
// register the DataFrame as a temp table prdDF.registerTempTablef'products")
supDF.registerTempTablef'suppliers")
prdsupDF.registerTempTablef'productssuppliers"}
//Select product, its price , its supplier name where product price is less than 0.6
val results = sqlContext.sql(......SELECT products.name, price, suppliers.name as sup_name FROM products JOIN suppliers ON products.supplierlD= suppliers.supplierlD WHERE price < 0.6......]
results. show()
Question 10
SIMULATION3
SIMULATION
Problem Scenario 83 : In Continuation of previous question, please accomplish following activities.
1. Select all the records with quantity >= 5000 and name starts with 'Pen'
2. Select all the records with quantity >= 5000, price is less than 1.24 and name starts with 'Pen'
3. Select all the records witch does not have quantity >= 5000 and name does not starts with 'Pen'
4. Select all the products which name is 'Pen Red', 'Pen Black'
5. Select all the products which has price BETWEEN 1.0 AND 2.0 AND quantity BETWEEN 1000 AND 2000.
Answer is in the explanation below.
Ask AI for More Explanation
— your own AI account, opens inside the app
Reference / correct answer:
See the explanation for Step by Step Solution and configuration.
Solution :
Step 1 : Select all the records with quantity >= 5000 and name starts with 'Pen'
val results = sqlContext.sql(......SELECT * FROM products WHERE quantity >= 5000 AND name LIKE 'Pen %.......)
results.show()
Step 2 : Select all the records with quantity >= 5000 , price is less than 1.24 and name starts with 'Pen'
val results = sqlContext.sql(......SELECT * FROM products WHERE quantity >= 5000 AND price < 1.24 AND name LIKE 'Pen %.......)
results. showQ
Step 3 : Select all the records witch does not have quantity >= 5000 and name does not starts with 'Pen'
val results = sqlContext.sql('.....SELECT * FROM products WHERE NOT (quantity >= 5000 AND name LIKE 'Pen %')......)
results. showQ
Step 4 : Select all the products wchich name is 'Pen Red', 'Pen Black'
val results = sqlContext.sql('.....SELECT' FROM products WHERE name IN ('Pen Red', 'Pen Black')......)
results. showQ
Step 5 : Select all the products which has price BETWEEN 1.0 AND 2.0 AND quantity BETWEEN 1000 AND 2000.
val results = sqlContext.sql(......SELECT * FROM products WHERE (price BETWEEN 1.0 AND 2.0) AND (quantity BETWEEN 1000 AND 2000)......)
results. show()
About the CCA175 Free Practice Test
Thinking of taking the CCA Spark and Hadoop Developer (CCA175) exam? This free Cloudera practice test is the place to start. The 10 questions come free from the full 96-question Study4Pass practice set — a quick, honest check of where you stand. The free sample is made up of 10 hands-on lab questions, each with a full explanation. The set follows the real exam’s spread of topics: Apache Hadoop, Apache Hive, Apache Pig and Apache Spark. Cloudera CCA175 is a certification exam for Apache Hadoop and related technologies.
The target audience of the Cloudera CCA175 exam is individuals who are interested in becoming certified in Apache Hadoop and Spark. The Cloudera CCA175 exam requires candidates to have a basic understanding of the following concepts: Hadoop Distributed File System (HDFS), Apache Hadoop YARN, Apache Hive, Impala, Apache Spark, Apache Flume,…
Certification: CCA Spark and Hadoop Developer (CCA175)
Vendor: Cloudera
Free on this page: 10 practice questions with answers and explanations
Full practice set: 96 questions
Work through the questions one at a time and read every explanation, even for the ones you get right — the reasoning behind an answer is what the real exam tests. If one area keeps costing you marks, you have found exactly what to revise before exam day.
Think of the result as a map, not a verdict. The questions you miss point straight at the topics that need work, and the explanations tell you why the correct option wins. Candidates who loop through that cycle — practise, review the reasoning, re-test — walk into the real exam having already seen their weak spots and fixed them.
Inside the full CCA175 practice set:
All 96 questions with answers and explanations
Timed Exam Simulation that mirrors the real exam pressure
Topic Training to drill one domain at a time
Ask AI for More Explanation on every question
Flag questions and review them before you finish
How to use this CCA175 free practice test
There is no clock and no account needed. Answer each question, check the result, and read the explanation before moving on. For anything that still feels unclear, Ask AI is built into this AI-Enabled practice test — it explains the concept behind the question so the next one like it gets easier. When the free sample feels comfortable, the full set of 96 questions adds timed Exam Simulation, topic-by-topic training, and flagged-question review — the closest thing to exam day you can get before the real thing.
What to study for each CCA175 domain
Apache Hadoop — Apache Hadoop is an open source framework for distributed storage and processing of large data sets.
Apache Hive — Apache Hive is a data warehouse system built on top of Hadoop.
Apache Pig — Apache Pig is a high-level scripting language that is used to process large data sets in Hadoop.
Apache Spark — Apache Spark is an open source cluster computing framework for large-scale data processing.
Apache Flume — Apache Flume is a distributed, reliable, and available service for efficiently collecting, aggregating, and moving large amounts
CCA175 practice test — quick questions
Is this CCA175 practice test free?
Yes. Every question on this page — all 10 of them — is free to use, and you never need to create an account to try them.
How many questions are in the full CCA175 set?
The full Study4Pass set for CCA175 has 96 practice questions. This page gives you 10 of them free so you can judge the quality and difficulty first.
Does the free test show the answers?
Yes. Check any question to reveal the correct answer and its explanation, and use Ask AI whenever you want the underlying concept explained step by step.
Is this the real CCA175 exam?
No — these are practice questions built to match the CCA175 domains and difficulty level, so you can prepare for the real exam with confidence.