Knowee
Questions
Features
Study Tools

Problem 2 (5 points)We have four text files as follows, storing the student grades of four subjects.math.txt physics.txt chemistry.txt art.txtJames, 91 James, 57 James, 78 James, 67John, 89 John, 78 John, 92 John, 89Robert, 72 Robert, 68 Robert, 68 Robert, 88Michael, 81 Michael, 71 Michael, 91 Michael, 87David, 76 David, 79 David, 77 David, 68Mary, 79 Mary, 69 Mary, 74 Mary, 79Linda, 63 Linda, 79 Linda, 89 Linda, 94Susan, 67 Susan, 76 Susan, 87 Susan, 78Lisa, 76 Lisa, 74 Lisa, 92 Lisa, 91Our goal is to calculate the total scores of students in all four subjects. (In practice, we could have morestudents and more subjects.)(a) What are the relationships between MapReduce and Hadoop?(b) Write pseudo-code for map worker, including the (key, value) pairs of the input and output.(c) Write pseudo-code for reduce worker, including the (key, value) pairs of the input and output.(d) What are the concrete inputs and outputs of your implemented mapper and reducer when process-ing the above four text files?

Question

Problem 2 (5 points)We have four text files as follows, storing the student grades of four subjects.math.txt physics.txt chemistry.txt art.txtJames, 91 James, 57 James, 78 James, 67John, 89 John, 78 John, 92 John, 89Robert, 72 Robert, 68 Robert, 68 Robert, 88Michael, 81 Michael, 71 Michael, 91 Michael, 87David, 76 David, 79 David, 77 David, 68Mary, 79 Mary, 69 Mary, 74 Mary, 79Linda, 63 Linda, 79 Linda, 89 Linda, 94Susan, 67 Susan, 76 Susan, 87 Susan, 78Lisa, 76 Lisa, 74 Lisa, 92 Lisa, 91Our goal is to calculate the total scores of students in all four subjects. (In practice, we could have morestudents and more subjects.)(a) What are the relationships between MapReduce and Hadoop?(b) Write pseudo-code for map worker, including the (key, value) pairs of the input and output.(c) Write pseudo-code for reduce worker, including the (key, value) pairs of the input and output.(d) What are the concrete inputs and outputs of your implemented mapper and reducer when process-ing the above four text files?

...expand
🧐 Not the exact question you are looking for?Go ask a question

Solution

(a) MapReduce and Hadoop are closely related as they are both used for processing large data sets. MapReduce is a programming model that allows for the processing and generating of big data sets with a parallel, distributed algorithm on a cluster. Hadoop, on the other hand, is an open-source software framework that supports data-intensive distributed applications, and it implements the MapReduce model.

(b) Pseudo-code for map worker:

function map(String name, String grades):
  // split the grades by comma
  gradeList = grades.split(",")
  for grade in gradeList:
    emit(name, Integer.parseInt(grade))

The input key-value pair is the student's name and their grades (e.g., "James", "91,57,78,67"). The output key-value pair is the student's name and each grade (e.g., "James", 91).

(c) Pseudo-code for reduce worker:

function reduce(String name, Iterator<Integer> grades):
  int sum = 0
  while(grades.hasNext()):
    sum += grades.next()
  emit(name, sum)

The input key-value pair is the student's name and a list of their grades (e.g., "James", [91,57,78,67]). The output key-value pair is the student's name and the sum of their grades (e.g., "James", 293).

(d) The concrete inputs for the mapper would be the lines from the text files, such as "James, 91" from math.txt, "James, 57" from physics.txt, etc. The output would be key-value pairs of student names and their grades, such as ("James", 91), ("James", 57), etc.

The concrete inputs for the reducer would be the output from the mapper, such as ("James", [91,57,78,67]). The output would be key-value pairs of student names and their total grades, such as ("James", 293).

This problem has been solved

Similar Questions

The following procedure took data from the “Scores” dataset and A represents the number of male students whose Physics marks are less than the Mathematics marks but equal to their Chemistry marks. The programmer may have made mistakes in one or more steps. Identify all such steps (if any). It is a Multiple Select Question (MSQ).Step 1 : Arrange all cards in a single pile called Pile 1Step 2 : Initialize variable A to 1Step 3 : If Pile 1 is empty then stop the iterationStep 4 : Read the top card in Pile 1Step 5 : If Gender is ‘M’ and Physics marks = Mathematics marks and Chemistry marks > Physics marks then add 1 to AStep 6 : Move the current card to another pile called Pile 2 and repeat from Step 3

Create a database of students using structures, where in each entry of the database will have the following fields:a name, which is a string with at most 128 characterstheir marks in physics, which is an int between 0 and 100their marks in chemistry, which is an int number between 0 and 100their marks in mathematics, which is an int number between 0 and 100You have to output a list of students in the following order.if a student 'A' has lower marks in physics than a student 'B', then A's data is listed before B.If A and B have the same physics marks and A has lower chemistry marks than B, then A is listed before B.If A and B have the same marks in physics and chemistry, and A has lower marks in mathematics than B, then A is listed before B.If all marks are equal and A's name precedes B's name in the dictionary order, then A is listed before B..Input Format :First line contains the number of students n, where 1<=n<=100.In following n lines each line contains(space separated)  a name and their respective marks in physics, chemistry, maths, where 0<=marks<=100.Output Format :Sorted database of n lines.

Write command to create a dataframe to store marks of 3 subjects . columns can be named as ["GE", "SEC","VAC "]. Rows are indexed by rollno of the students [25,30,50]

Single File Programming QuestionProblem Statement:Thiru is working on a grading system for his class of students. He needs a program that takes input for student scores, inserts a new score at the beginning and end of the existing scores, and then displays the modified list of scores.Write a program to help Thiru achieve this.Input format :The first line of input is an integer, the value n, indicating the number of elements in the array.The second line of input consists of n space-separated integers, representing the elements of the array arr[i].The third line of input consists of two integers M and P, representing the value to be inserted at the beginning and ending of the array, separated by a space.Output format :The output is a single line containing n + 2 space-separated integers, which represent the modified array after inserting the element at the beginning and ending of the existing scores.Refer to the sample output for the formatting specifications.Code constraints :In this scenario, the test cases will fall under the following constraints:1 ≤ n ≤ 101 ≤ arr[i] ≤ 1001 ≤ M, P ≤ 100Sample test cases :Input 1 :53 4 5 6 72 8Output 1 :2 3 4 5 6 7 8 Input 2 :14590 78Output 2 :90 45 78 Input 3 :1098 37 48 28 16 18 20 100 25 131 19Output 3 :1 98 37 48 28 16 18 20 100 2

You have a class consisting of 5 students, each with a unique name and their respective marks. As the end of the semester approaches, you decide to assess the performance of your students and recognize their academic achievements.You write a Python program to categorize the students into different grades based on their marks. The program utilizes a Grade_analyzer class to represent each student and a StudentGradeAnalyzer function to analyze their grades. The function iterates through the list of students, calculates their grades and returns a dictionary containing the count of students in each grade.For grading:Students scoring between 80-100 will be in Grade A.Students scoring between 70-80 will be in Grade B.Students scoring between 60-70 will be in Grade C.Students scoring between 50-60 will be in Grade D.Students scoring below 50 will be in Grade E.Constraints:Input Format:5 lines of input, each line containing name and marks of each student.Ouptut Format:Should display items in dictionary which is holding Grades as keys and count of students falling under the grades as values.Example:Input:john 78missy 89sheldon 90mary 45meemaw 67Output:('A', 2)('B', 1)('C', 1)('D', 0)('E', 1)Explanation:input:--------Space saperated input name and marks for all the 5 students.john 78-->78 Falls into a range 70-80 so count of grade 'B' should be increased to 1.missy 89-->89 Falls into a range 80-100 so count of grade 'A' should be increased to 1.sheldon 90-->90 Falls into a range 80-100 so count of grade 'A' should be increased to 2.mary 45-->45 is less than 50 so count of grade 'E' should be increased to 1.meemaw 67-->67 Falls into a range 60-70 so count of grade 'C' should be increased to 1.

1/1

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.