Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

National Institute of Electronics & Information Technology (NIELIT)

1. Given the following class

public abstract class Books


{
protected String name;
protected double rate;
public Books (String n, double r)
{
name = n;
rate = r;
}
public abstract double calcPrice();
public String toString()
{
return name + “\t” + rate;
}
}

a) Based on class Books and the following table, define two subclasses named as
OrderBook and UsedBook,

OrderBook UsedBook
Additional attribute weight Quantity
Price calculation rate*weight rate*quantity

b) By using classes definition from, write an application program that will:


i) declare an array of 20 book objects;
ii) input data for book objects and store them into the array;
iii) display the total price for all types of books
iv) display the total price and the quantity sold for used books
v) display the information for the Book that has been sold for the highest price.
(20)

PGDDS: I042 Page 1 of 2 (04/2022)


National Institute of Electronics & Information Technology (NIELIT)

i) MapReduce
a. Put the attached file ‘internet_users.csv’ to a hdfs directory.
b. Write a MapReduce program to read the column “Country” and “Percent” from that
file.
c. Process them and display the sum of monthly charge per service.
d. Upload the Java file in a zip along with the rest of the files
e. Example output:
India 56.9437858753115
China 70.0527627444257
ii) PIG and HIVE
a) Load the internet_users.csv file in PIG
b) Display the Country and Percent of users paying more than 92%.
c) Count the number of Regions in the dataset
d) Load the same table into Hive.
e) Display the least number of internet_users from the dataset.
(35)

3. Salary Estimation using Machine Learning model

1. Import the necessary libraries


2. Load the dataset ‘salary.csv’.
3. Summarize the dataset and map salary data to binary value.
4. Segregate dataset into independent and dependent variable
5. Split the dataset into train and test data
6. Perform feature scaling for train and test data
7. Use the KNN algorithm and find the best K value
8. Perform Training and predict whether new customer with Age & hours per week will
get salary above 50k or not
9. Predict all the test data
10. Finally evaluate your model using confusion matrix and accuracy score.
(35)

PGDDS: I042 Page 2 of 2 (04/2022)

You might also like