Pig
1. Which of the following is shortcut for DUMP operator ? a) \de alias b) \d alias c) \q d) None of the mentioned
Answer: b Explanation: If alias is ignored last defined alias will be used.
3. You can run Pig in batch mode using __________ . a) Pig shell command b) Pig scripts c) Pig options d) All of the mentioned
Answer: b Explanation: Pig script contains Pig Latin statements.
5. Point out the wrong statement : a) To run Pig in local mode, you need access to a single machine b) The DISPLAY operator will display the results to your terminal screen c) To run Pig in mapreduce mode, you need access to a Hadoop cluster and HDFS installation d) All of the mentioned
Answer: b Explanation: The DUMP operator will display the results to your terminal screen.
2. Point out the correct statement : a) During the testing phase of your implementation, you can use LOAD to display results to your terminal screen b) You can view outer relations as well as relations defined in a nested FOREACH statement c) Hadoop properties are interpreted by Pig d) None of the mentioned
Answer: b Explanation: Viewing outer relations is possible using DESCRIBE operator.
3. Which of the following command is used to show values to keys used in Pig ? a) set b) declare c) display d) All of the mentioned
Answer: a Explanation: All Pig and Hadoop properties can be set, either in the Pig script or via the Grunt command line.
4. ___________ operator is used to view the step-by-step execution of a series of statements. a) ILLUSTRATE b) DESCRIBE c) STORE d) EXPLAIN
Answer: a Explanation: ILLUSTRATE allows you to test your programs on small datasets and get faster turnaround times.
7. You can run Pig in interactive mode using the ______ shell. a) Grunt b) FS c) HDFS d) None of the mentioned
Answer: a Explanation: Invoke the Grunt shell using the "pig" command (as shown below) and then enter your Pig Latin statements and Pig commands interactively at the command line.
10. PigUnit runs in Pig's _______ mode by default. a) local b) tez c) mapreduce d) none of the mentioned
Answer: a Explanation: Local mode does not require a real cluster but a new local one is created each time.
8. Which of the following is correct syntax for parameter substitution using cmd ? a) pig {-param param_name = param_value | -param_file file_name} [-debug | -dryrun] script b) {%declare | %default} param_name param_value c) {%declare | %default} param_name param_value cmd d) All of the mentioned
Answer: a Explanation: Parameter Substitution is used to substitute values for parameters at run time.
8. Which of the following is the default mode ? a) Mapreduce b) Tez c) Local d) All of the mentioned
Answer: a Explanation: Specify local mode using the -x flag (pig -x local).
9. Which of the following will compile the Pigunit ? a) $pig_trunk ant pigunit-jar b) $pig_tr ant pigunit-jar c) $pig_ ant pigunit-jar d) None of the mentioned
Answer: a Explanation: The compile will create the pigunit.jar file.
8. Which of the following is the default mode ? a) Mapreduce b) Tez c) Local d) All of the mentioned
Answer: a Explanation: To run Pig in mapreduce mode, you need access to a Hadoop cluster and HDFS installation.
6. Which of the following command can be used for debugging ? a) exec b) execute c) error d) throw
Answer: a Explanation: With the exec command, store statements will not trigger execution; rather, the entire script is parsed before execution starts.
1. Pig operates in mainly how many nodes ? a) Two b) Three c) Four d) Five
Answer: a Explanation: You can run Pig (execute Pig Latin statements and Pig commands) using various mode: Interactive and Batch Mode.
2. Point out the correct statement : a) You can run Pig in either mode using the "pig" command b) You can run Pig in batch mode using the Grunt shell c) You can run Pig in interactive mode using the FS shell d) None of the mentioned
Answer: a Explanation: You can run Pig in either mode using the "pig" command (the bin/pig Perl script) or the "java" command (java -cp pig.jar ...).
5. Point out the wrong statement: a) You can run Pig scripts from the command line and from the Grunt shell b) DECLARE defines a Pig macro c) Use Pig scripts to place Pig Latin statements and Pig commands in a single file d) None of the mentioned
Answer: b Explanation: DEFINE defines a Pig macro.
1._________ operator is used to review the schema of a relation. a) DUMP b) DESCRIBE c) STORE d) EXPLAIN
Answer: b Explanation: DESCRIBE returns the schema of a relation.
7. The ________ class mimics the behavior of the Main class but gives users a statistics object back. a) PigRun b) PigRunner c) RunnerPig d) None of the mentioned
Answer: b Explanation: Optionally, you can call the API with an implementation of progress listener which will be invoked by Pig runtime during the execution.
8. ___________ is a simple xUnit framework that enables you to easily test your Pig scripts. a) PigUnit b) PigXUnit c) PigUnitX d) All of the mentioned
Answer: b Explanation: With PigUnit you can perform unit testing, regression testing, and rapid prototyping. No cluster set up is required if you run Pig in local mode.
2. Point out the correct statement: a) Invoke the Grunt shell using the "enter" command b) Pig does not support jar files c) Both the run and exec commands are useful for debugging because you can modify a Pig script in an editor d) All of the mentioned
Answer: c Explanation: Both commands promote Pig script modularity as they allow you to reuse existing components.
6. Which of the following function is used to read data in PIG ? a) WRITE b) READ c) LOAD d) None of the mentioned
Answer: c Explanation: PigStorage is the default load function.
5. Point out the wrong statement : a) ILLUSTRATE operator is used to review how data is transformed through a sequence of Pig Latin statements b) ILLUSTRATE is based on an example generator c) Several new private classes make it harder for external tools such as Oozie to integrate with Pig statistics d) None of the mentioned
Answer: c Explanation: Several new public classes make it easier for external tools such as Oozie to integrate with Pig statistics.
4. Use the __________ command to run a Pig script that can interact with the Grunt shell (interactive mode). a) fetch b) declare c) run d) all of the mentioned
Answer: c Explanation: With the run command, every store triggers execution.
7. Which of the following file contains user defined functions (UDFs) ? a) script2-local.pig b) pig.jar c) tutorial.jar d) excite.log.bz2
Answer: c Explanation: tutorial.jar contains java classes also.
4. Pig Latin statements are generally organized in one of the following ways : a) A LOAD statement to read data from the file system b) A series of "transformation" statements to process the data c) A DUMP statement to view results or a STORE statement to save the results d) All of the mentioned
Answer: d Explanation: A DUMP or STORE statement is required to generate output.
3. Which of the following operator is used to view the map reduce execution plans ? a) DUMP b) DESCRIBE c) STORE d) EXPLAIN
Answer: d Explanation: EXPLAIN displays execution plans.
9. You can specify parameter names and parameter values in one of the ways: a) As part of a command line. b) In parameter file, as part of a command line c) With the declare statement, as part of Pig script d) All of the mentioned
Answer: d Explanation: Parameter substitution may be used inside of macros.
10.$ pig -x tez_local ... will enable ________ mode in Pig. a) Mapreduce b) Tez c) Local d) None of the mentioned
Answer: d Explanation: Tez Local Mode is similar to local mode, except internally Pig will invoke tez runtime engine.
6. __________ is a framework for collecting and storing script-level statistics for Pig Latin. a) Pig Stats b) PStatistics c) Pig Statistics d) None of the mentioned
nswer: c Explanation: The new Pig statistics and the existing Hadoop statistics can also be accessed via the Hadoop job history file.
10. _________ are scanned in the order they are specified on the command line. a) Command line parameters b) Parameter files c) Declare and default preprocessors d) Both parameter files and command line parameters
swer: d Explanation: Parameters and command parameters are scanned in FIFO manner.