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×

Big Data Pig Assessment Test

Topics Covered

  • Pig Commands
  • Optimization in Pig
  • Pig Scripts

Useful for hiring

  • Big Data Developer - Pig
  • Big Data Developer

Start hiring job-fit candidates using this assessment

GET A DEMO

"Finding quality talent is a challenge more so when you consider the sheer number of resumes we get each year. To top this, the time we spent on our recruitment process was humongous. Interview Mocha helped us to cut down on our candidate filtration time by 40%, making it our preferred assessment tool."

Pedro Furtado, Altran,
Capacity Manager
Question

Assume we use datafu lib in pig:

DEFINE EmptyBagToNullFields datafu.pig.bags.EmptyBagToNullFields();
data = FOREACH (COGROUP input1 BY key, input2 BY key, input3 BY key) GENERATE
    FLATTEN(input1),
      FLATTEN(EmptyBagToNullFields(input2)),
      FLATTEN(EmptyBagToNullFields(input3));

 Which script will define macro similar to above script?

Answer
    • DEFINE myFunction(relation1, key1, relation2, key2, relation3, key3) returns result 
      {
          A = GROUP $relation1 BY $key1, $relation2 BY $key2, $relation3 BY $key3;
          $result = FOREACH A GENERATE
              FLATTEN($relation1),
              FLATTEN(EmptyBagToNullFields($relation2)),
              FLATTEN(EmptyBagToNullFields($relation3));
      }

    • DEFINE myFunction(relation1, key1, relation2, key2, relation3, key3) returns result 
      {
          A = JOIN $relation1 BY $key1, $relation2 BY $key2, $relation3 BY $key3;
          $result = FOREACH A GENERATE
              FLATTEN($relation1),
              FLATTEN(EmptyBagToNullFields($relation2)),
              FLATTEN(EmptyBagToNullFields($relation3));
      }

    • Cannot replace to have same logic with above script

    • DEFINE myFunction(relation1, key1, relation2, key2, relation3, key3) returns result 
      {
          A = COGROUP $relation1 BY $key1, $relation2 BY $key2, $relation3 BY $key3;
          $result = FOREACH A GENERATE
              FLATTEN($relation1),
              FLATTEN(EmptyBagToNullFields($relation2)),
              FLATTEN(EmptyBagToNullFields($relation3));
      }

Question

A = load 'Data1' as (name:chararray, team:chararray, position:bag{t:(p:chararray)}, bat:map[]);
B = foreach A generate name, team, position, bat#'batting_average' as batavg;
C = group B by team;
avgC  = foreach C generate group, AVG(B.batavg);
store avgC into 'by_team';
flattenData = foreach B generate name, team, flatten(position) as position, batavg;
D = group flattenData by position parallel 100;
avgD = foreach D generate group, AVG(flattenData.batavg);
store avgD into 'Rank';

How many reduce will run at D relation?

Answer
    • 100

    • Not enough information

    • Depend on Data1 file

    • Depend on flattenData relation

Question

A = COGROUP input1 BY key, input2 BY key, input3 BY key;
B = FOREACH A GENERATE
    FLATTEN(input1), -- left join on this
     FLATTEN((IsEmpty(input2) ? TOBAG(TOTUPLE((int)null,(int),null)) : input2))
       AS (input2::key,input2::val),
    FLATTEN((IsEmpty(input3) ? TOBAG(TOTUPLE((int)null,(int),null)) : input3))
       AS (input3::key,input3::val);
   
Which script is similar with above script?

Answer
    • A = JOIN input1 BY key LEFT, input2 BY key;
      B = JOIN A BY input1::key LEFT, input3 BY key;

    • A = JOIN input1 BY key LEFT, input3 BY key;
      B = JOIN A BY input1::key LEFT, input2 BY key;

    • Cannot replace to have same logic with above script

    • A = JOIN input1 BY key, input3 BY key;
      B = JOIN A BY input1::key, input2 BY key; 

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