Are you a candidate looking to sharpen your skills? Try our practice tests or view sample interview questions & Get hired by the best. Click Here×

Spark Test Assessment

Topics Covered

  • Spark Core
  • Spark SQL
  • Spark Streaming

Useful for hiring

  • Big Data Software Engineer - Spark
  • Software Developer - Spark

Start hiring job-fit candidates using this assessment

GET A DEMO

"Interview Mocha's assessments eliminated reliance on resumes and reduced our time to hire by half. Now we spend time only on relevant candidates and take data-driven hiring decisions."

George Nichkov, Gett,
Global Analytics Team Lead
Question

You can cache the data from SchemaRDD by:

Note: There can be multiple correct answers to this question.

Answer
    • hiveCtx.cacheTable("tableName")

    • Hive SQL Statment CACHE TABLE tableName

    • regular cache method on RDDs

    • None of the mentioned

Question

Assume that we have input data below:

1;bat man;23
112;spider man;23
112;spider man;27
112;spider man;29
12;superman ;23

What is the output if we run this code?

public static void main(String[] args) {
    SparkConf conf = new SparkConf().setAppName("org.sparkexample.sampleCode").setMaster("local");
    JavaSparkContext sc = new JavaSparkContext(conf);
    JavaRDD lines = sc.textFile("C:\\Users\\Hoang Ngo\\workspace\\HelloSpark-Java\\sampledata");
    JavaPairRDD lineLengths = lines.map(s -> s.split(";", -1))
    .filter(s->!s[0].equals("1"))
    .mapToPair(s-> new Tuple2(s[0], s[0]+";"+s[1]+";"+s[2]));
    JavaPairRDD counts = lineLengths.reduceByKey((a, b) -> a+b);
    System.out.println(counts.collect());
}

Answer
    • []

    • [(112,112;spider man;23112;spider man;27112;spider man;29)]

    • Run time error

    • [(112,112;spider man;23112;spider man;27112;spider man;29), (12,12;superman ;23)]

Question

We have Spark Streaming window function as below:

lines.countByWindow(Second(30), Seconds(10)).print()

If we use following prompt for streaming:
prompt>nc -lk 9999
10 (0th second)
20 (10 seconds later) 
30 (20 seconds later) 
40 (30 seconds later) 

What will be the output?

Answer
    • Output:
      1
      2
      3
      3

    • Output:
      2
      3
      3
      4

    • Output:
      1
      2
      3

    • Output:
      1
      2
      3
      4

Good News! You can customize this test as per your requirement

  • Choose and add questions from Interview Mocha question libraries

  • Add your own set of questions

  • Customize test settings like duration, number of questions, passing score, web proctoring and much more

  • Mail us at support@interviewmocha.com to create a custom test

Looking for a tailor-made test, to suit your assessment needs?

Get in touch

Global companies using Mocha assessments

  • altran
  • credit suisse
  • sephora
  • nielsen
  • capgemini
  • akamai

How Mocha assessments are brewed

Speed up your IT recruitment with Interview Mocha

  • 500+ IT skill tests
  • 20+ coding languages
  • 50+ domain knowledge tests
  • 100+ digital 2.0 skill tests
  • Customer focus aptitude tests
  • Enterprise ready features & more...
GET A DEMO

Why hiring managers and recruiters across the globe love Interview Mocha

Take your first step to hire job fit candidates

GET A DEMO