Unit 3: Map Reduce and YARN - Practice Quiz

INT312 — Big Data Fundamentals 60 Questions
0 Correct 0 Wrong 60 Left
0/60

1 Which Hadoop class is commonly extended to create a custom Mapper?

Review of the Java code required to handle the Mapper class Easy
A. Configuration
B. Job
C. Reducer
D. Mapper

2 Which method contains the main processing logic of a Hadoop Mapper?

Review of the Java code required to handle the Mapper class Easy
A. map()
B. submit()
C. reduce()
D. schedule()

3 Which statement is used to emit a key-value pair from the map() method?

Review of the Java code required to handle the Mapper class Easy
A. context.write(key, value)
B. job.write(key, value)
C. mapper.send(key, value)
D. context.read(key, value)

4 Which Hadoop class is commonly extended to create a custom Reducer?

Review of the Java code required to handle the Reducer class Easy
A. Path
B. FileSystem
C. Reducer
D. Mapper

5 What does the values parameter of a Reducer's reduce() method normally contain?

Review of the Java code required to handle the Reducer class Easy
A. Names of cluster nodes
B. Keys from every input file
C. Values grouped for one key
D. Paths of output files

6 Which Java loop is commonly used to process all values received by a Reducer?

Review of the Java code required to handle the Reducer class Easy
A. Enhanced for loop
B. Empty for loop
C. Infinite while loop
D. do-while loop

7 Which method usually serves as the entry point of a Java MapReduce driver program?

Program driver needed to access MapReduce Easy
A. main()
B. cleanup()
C. reduce()
D. map()

8 Which driver method sets the Mapper class for a Hadoop job?

Program driver needed to access MapReduce Easy
A. setReducerClass()
B. setJarByClass()
C. setMapperClass()
D. setInputFormatClass()

9 What does job.waitForCompletion(true) do in a MapReduce driver?

Program driver needed to access MapReduce Easy
A. Creates a new input file
B. Restarts every failed node
C. Waits for the job to finish
D. Deletes the output directory

10 What does YARN stand for in Hadoop?

YARN model Easy
A. Your Application Resource Network
B. Yearly Allocated Resource Namespace
C. Yielding Automated Runtime Node
D. Yet Another Resource Negotiator

11 Which YARN component manages resources across the entire cluster?

YARN model Easy
A. ApplicationMaster
B. NodeManager
C. ResourceManager
D. DataNode

12 Which YARN component manages containers on an individual worker machine?

YARN model Easy
A. NodeManager
B. NameNode
C. JobHistoryServer
D. ResourceManager

13 In a standard Word Count Mapper, what value is usually emitted for each word occurrence?

Java code for word count Easy
A. The integer 1
B. The integer 0
C. The word length
D. The line number

14 What operation does a Word Count Reducer perform on the values for each word?

Java code for word count Easy
A. Adds the values
B. Removes the values
C. Reverses the values
D. Sorts the values

15 Which Java condition correctly checks whether an integer n is even?

Java code for sum of even numbers Easy
A. n % 2 == 1
B. n + 2 == 0
C. n % 2 == 0
D. n / 2 == 0

16 What is the sum of the even numbers in the list ?

Java code for sum of even numbers Easy
A.
B.
C.
D.

17 Which comparison can confirm that an integer is a palindrome after its digits have been reversed?

Java code for palindrome Easy
A. original > reversed
B. original == reversed
C. original != reversed
D. original < reversed

18 Which number is a palindrome?

Java code for palindrome Easy
A.
B.
C.
D.

19 What initial value should a factorial accumulator normally have in Java?

Java code for factorial Easy
A. 0
B. 2
C. -1
D. 1

20 What is the value of ?

Java code for factorial Easy
A.
B.
C.
D.

21 A mapper processes a text file using Hadoop's default TextInputFormat. Which declaration correctly represents the mapper's input types?

Review of the Java code required to handle the Mapper class Medium
A. Mapper<LongWritable, Text, Text, IntWritable>
B. Mapper<IntWritable, Text, LongWritable, Text>
C. Mapper<NullWritable, Text, Text, LongWritable>
D. Mapper<Text, LongWritable, Text, IntWritable>

22 A mapper extends Mapper<LongWritable, Text, Text, IntWritable>. Which statement can be used inside its map() method without causing an output type mismatch?

Review of the Java code required to handle the Mapper class Medium
A. context.write(new Text(word), new IntWritable(1));
B. context.write(new LongWritable(1), new Text(word));
C. context.write(new Text(word), new LongWritable(1));
D. context.write(new IntWritable(1), new Text(word));

23 Which reducer loop correctly adds all IntWritable values associated with a key?

Review of the Java code required to handle the Reducer class Medium
A. for (IntWritable value : values) sum += value.hashCode();
B. for (IntWritable value : values) sum = value.get();
C. for (IntWritable value : values) sum += value.get();
D. for (IntWritable value : values) sum += values.size();

24 A reducer must retain values after iterating over Iterable<IntWritable> values. Which approach is safest because Hadoop may reuse value objects?

Review of the Java code required to handle the Reducer class Medium
A. Store the values iterator and traverse it after reduction
B. Store each result of value.get() in a new integer collection
C. Store each value reference directly in an object collection
D. Store the reducer context and request the values again

25 A mapper emits <Text, IntWritable>, while the reducer emits <Text, LongWritable>. Which driver configuration correctly declares both output pairs?

Program driver needed to access MapReduce Medium
A. setMapOutputKeyClass(IntWritable.class), setMapOutputValueClass(Text.class), setOutputKeyClass(LongWritable.class), setOutputValueClass(Text.class)
B. setMapOutputKeyClass(Text.class), setMapOutputValueClass(LongWritable.class), setOutputKeyClass(Text.class), setOutputValueClass(IntWritable.class)
C. setMapOutputKeyClass(Text.class), setMapOutputValueClass(IntWritable.class), setOutputKeyClass(Text.class), setOutputValueClass(LongWritable.class)
D. setMapOutputKeyClass(LongWritable.class), setMapOutputValueClass(Text.class), setOutputKeyClass(IntWritable.class), setOutputValueClass(Text.class)

26 Which driver statement waits for job completion and returns a conventional process status code?

Program driver needed to access MapReduce Medium
A. System.exit(job.waitForCompletion(true) ? 0 : 1);
B. System.exit(job.submit() ? 0 : 1);
C. System.exit(job.isComplete() ? 1 : 0);
D. System.exit(job.waitForCompletion(false) ? 1 : 0);

27 In YARN, which component negotiates containers for one application and coordinates that application's tasks?

YARN model Medium
A. DataNode
B. ResourceManager
C. ApplicationMaster
D. NodeManager

28 A YARN worker machine must launch containers and report their status and resource usage. Which component performs these duties?

YARN model Medium
A. ApplicationMaster
B. ResourceManager
C. NameNode
D. NodeManager

29 An application requests a YARN container with 4 GB of memory and 2 virtual cores. What does the container primarily represent?

YARN model Medium
A. A replacement process for the ResourceManager
B. A queue containing only reduce outputs
C. A permanent copy of an HDFS block
D. A resource allocation on a cluster node

30 A word-count mapper converts tokens to lowercase before emitting them. What output should the complete job produce for the line Data data DATA?

Java code for word count Medium
A. DATA 3
B. Data 1, data 2
C. Data 1, data 1, DATA 1
D. data 3

31 Why can the word-count reducer class usually also be registered as a combiner?

Java code for word count Medium
A. Tokenization is associative and commutative
B. Integer addition is associative and commutative
C. Every word is sent to a different reducer
D. The combiner executes exactly once per mapper

32 A mapper declares one reusable Text word = new Text(); field. For each token, it calls word.set(token) followed immediately by context.write(word, one). Why is this normally valid?

Java code for word count Medium
A. Hadoop serializes the key when it is written
B. Reducers receive the mapper's original object reference
C. The mapper can process only one token per call
D. Hadoop makes Text objects globally immutable

33 A mapper emits only even integers, and the reducer adds them. What result is produced for the input values ?

Java code for sum of even numbers Medium
A.
B.
C.
D.

34 Which mapper condition correctly recognizes both positive and negative even integers in Java?

Java code for sum of even numbers Medium
A. number % 2 == 0
B. number / 2 == 0
C. number > 0 && number % 2 == 0
D. number % 2 == 1

35 A palindrome mapper removes non-letter characters and converts the remaining text to lowercase. How should it classify Never odd or even?

Java code for palindrome Medium
A. Not a palindrome, because uppercase letters are always different
B. Palindrome, because every sentence is checked word by word
C. Palindrome, because normalization gives neveroddoreven
D. Not a palindrome, because the original text contains spaces

36 A MapReduce palindrome job must preserve a separate result for every input line, including duplicate lines. Which mapper output key is most suitable?

Java code for palindrome Medium
A. A constant NullWritable key for every line
B. The normalized line stored as a Text key
C. The input line's LongWritable byte offset
D. A constant BooleanWritable palindrome key

37 If factorials are stored in a Java long, what is the largest nonnegative integer for which fits without overflow?

Java code for factorial Medium
A.
B.
C.
D.

38 A mapper sends input numbers 3 and 4 under the same NullWritable key. The reducer initializes product = 1 and multiplies every received number once. What does this job output?

Java code for factorial Medium
A. A single factorial of
B. A single sum of
C. Two factorials, and
D. A single product of

39 For a -digit number, which expression should Armstrong-number code compute before comparing the result with the original number?

Java code for Armstrong number Medium
A. The sum of each digit raised to the power
B. The sum of all digits multiplied by
C. The original number raised to the power
D. The product of each digit raised to the power

40 A Java mapper checks 9474 using the four-digit Armstrong rule. Which calculation confirms that it is an Armstrong number?

Java code for Armstrong number Medium
A.
B.
C.
D.

41 A job uses TextInputFormat and declares Mapper<Text, LongWritable, Text, IntWritable>. The mapper's map method has the same declared parameter types. What is the most likely result when the job processes input?

Review of the Java code required to handle the Mapper class Hard
A. The input format automatically swaps the key and value to match the mapper declaration
B. The mapper runs normally because generic parameters are ignored by Hadoop
C. The framework fails when it supplies a LongWritable key and Text value to the mapper
D. The framework converts the byte offset into Text before invoking the mapper

42 A mapper creates one Text object as a field, changes its contents for every token, and calls context.write(reusedText, ONE) after each change. Under the normal Hadoop mapper output path, which statement is correct?

Review of the Java code required to handle the Mapper class Hard
A. This is invalid because Hadoop retains every mutable object reference until all mapper input records have been processed and then serializes the references together
B. The object can be reused only when speculative execution has been disabled
C. This is valid because each map output is serialized when context.write collects it
D. Every emitted record will contain the final token assigned to the shared object

43 Why can the following reducer logic produce an incorrect list even though the loop visits all values? for (IntWritable v : values) saved.add(v);

Review of the Java code required to handle the Reducer class Hard
A. The framework may reuse the same IntWritable instance while advancing the iterator
B. The list automatically removes values that compare equal under WritableComparator
C. The iterator returns values in descending numerical order by default
D. The reducer receives only values that were processed by a combiner

44 A composite mapper key is (customerId, timestamp). The sort comparator orders both fields, while the grouping comparator compares only customerId. What behavior does the reducer receive?

Review of the Java code required to handle the Reducer class Hard
A. One call per partition, with all customer identifiers and timestamps in arbitrary order
B. One call per customer, with that customer's values encountered in timestamp sort order
C. One call per timestamp, with customers encountered in customer identifier order
D. One call per composite key, because grouping cannot differ from sorting

45 A mapper emits <Text, IntWritable>, but the reducer emits <Text, LongWritable>. The driver sets only setOutputKeyClass(Text.class) and setOutputValueClass(LongWritable.class). What configuration is missing?

Program driver needed to access MapReduce Hard
A. setInputFormatClass(TextInputFormat.class) and setNumReduceTasks(1)
B. setOutputFormatClass(TextOutputFormat.class) and setJarByClass(LongWritable.class)
C. setPartitionerClass(HashPartitioner.class) and setCombinerClass(Reducer.class)
D. setMapOutputKeyClass(Text.class) and setMapOutputValueClass(IntWritable.class)

46 A driver configures job.setNumReduceTasks(0) for a map-only job. Which type constraint now applies to records written by the mapper?

Program driver needed to access MapReduce Hard
A. Mapper keys must be NullWritable, but mapper values may use any writable type
B. Mapper output types must match the configured reducer's input parameter types
C. Mapper records are treated as intermediate data and are converted by the output format
D. Mapper output types must match the job's final output key and value classes

47 Which YARN component is primarily responsible for negotiating containers for one submitted MapReduce job and coordinating its tasks?

YARN model Hard
A. The HDFS NameNode
B. The cluster's ResourceManager scheduler
C. Each worker's NodeManager
D. The job's ApplicationMaster

48 An ApplicationMaster first requests a map container on the node holding an input block, but that node lacks resources. How can YARN improve progress while still considering locality?

YARN model Hard
A. Move the HDFS block synchronously to whichever node has an available container
B. Convert the request into a reducer container because reducer tasks do not require locality
C. Relax the request from node-local to rack-local and eventually off-rack placement
D. Launch the task inside the ResourceManager until the preferred node becomes available

49 A NodeManager stops sending heartbeats after launching several task containers. Which response best matches the YARN execution model?

YARN model Hard
A. The ResourceManager marks the node unhealthy or lost, and the application can reschedule affected work
B. The ResourceManager reconstructs each container's process memory from heartbeat data and transfers it to another worker
C. The ApplicationMaster becomes the NodeManager for those containers and continues their execution remotely
D. The NameNode immediately promotes another NodeManager and resumes the same container processes

50 A word-count mapper performs in-mapper combining by storing counts in a HashMap<String, Integer> and emitting them in cleanup. What is the main correctness and scalability requirement?

Java code for word count Hard
A. The map must emit after every input line so reducers receive keys in lexical order
B. The map must be task-local, and its memory usage must be bounded for high-cardinality input
C. The map must use input byte offsets as keys to prevent speculative execution from duplicating words
D. The map must be static so all mapper JVMs share one globally consistent count table

51 A word-count job uses the ordinary sum reducer as its combiner. Which assumption makes this valid even though Hadoop may invoke the combiner zero, one, or multiple times?

Java code for word count Hard
A. Integer count addition is associative and commutative
B. Every mapper emits exactly one record for each distinct word
C. The partitioner sends every mapper's output through the same combiner instance
D. The combiner receives all occurrences of a word from the entire cluster

52 Two mapper tasks tokenize "Data" and "data". The reducer must produce one case-insensitive count independent of the workers' default locales. Which mapper normalization is most appropriate?

Java code for word count Hard
A. token.equalsIgnoreCase(previousToken)
B. token.toUpperCase(Locale.getDefault())
C. token.toLowerCase()
D. token.toLowerCase(Locale.ROOT)

53 A job must exactly sum all even signed 64-bit input values whenever the mathematical result fits in a signed 64-bit integer. Which implementation is appropriate?

Java code for sum of even numbers Hard
A. Parse through Double.parseDouble, test the low binary bit after conversion, and round the reducer's floating-point total back to a signed integer
B. Parse with Integer.parseInt, test n % 2 == 0, and cast the final sum to long
C. Parse with Long.parseLong, test n % 2 == 0, and aggregate with LongWritable
D. Parse with Long.parseLong, test n % 2 == 1, and aggregate with LongWritable

54 Each mapper emits <NullWritable, partialEvenSum>, and the reducer adds all partial sums. Why is NullWritable a suitable key only when a single global sum is intended?

Java code for sum of even numbers Hard
A. It forces each mapper to send its partial sum to every reducer for cross-checking
B. It causes Hadoop to bypass serialization and combine all values inside the ResourceManager
C. All records have the same logical key and are therefore routed to one reduce group
D. It preserves the original input order so the reducer can detect missing numbers

55 A palindrome job should treat "A man, a plan, a canal: Panama" as a palindrome. Which transformation must occur before comparing the text with its reverse?

Java code for palindrome Hard
A. Hash each input line and compare its hash with the hash of the preceding line
B. Remove whitespace only and preserve punctuation and original letter case
C. Sort all characters and compare the sorted text with the original text
D. Remove non-alphanumeric code points and apply locale-neutral case normalization

56 A mapper emits <word, 1> only when word is a palindrome, and a reducer sums values by word. What does the final output represent?

Java code for palindrome Hard
A. One global count of palindrome occurrences across the input
B. The number of mapper tasks that encountered at least one palindrome
C. The occurrence count of each distinct palindromic word
D. The total number of characters shared by all palindromic words

57 A Java mapper calculates factorials using a signed long and must detect overflow before multiplication. For positive i, which check should precede result *= i?

Java code for factorial Hard
A. result > Long.MAX_VALUE % i
B. result + i > Long.MAX_VALUE
C. result > Long.MAX_VALUE / i
D. result * i > Long.MAX_VALUE

58 A factorial job replaces long with BigInteger and needs to emit exact results through Hadoop. Which design is valid?

Java code for factorial Hard
A. Store the result in LongWritable because Hadoop automatically expands its capacity
B. Serialize the result as Text or implement a dedicated Writable for BigInteger
C. Store the result in DoubleWritable because every integer has an exact floating-point representation
D. Emit the BigInteger directly because every Serializable Java object is automatically a Hadoop writable

59 For a nonnegative decimal integer with digits, an Armstrong-number mapper must test whether . Which edge case requires explicit attention when digit counting uses repeated division by 10?

Java code for Armstrong number Hard
A. The number 0 must be treated as having one digit
B. Leading zeroes must always be reconstructed from the parsed integer
C. Every number ending in 0 must be treated as having an extra digit
D. Single-digit numbers must use an exponent of 0

60 Why is (long) Math.pow(digit, digitCount) potentially unsafe in an exact Armstrong-number test for large inputs?

Java code for Armstrong number Hard
A. Math.pow calculates modular exponentiation and discards higher decimal digits
B. Math.pow returns negative values whenever the exponent exceeds nine
C. Math.pow always interprets both arguments as hexadecimal numbers
D. Math.pow uses floating-point arithmetic and may round before the cast