Write Java program that randomly generate two Integers between 1 and 10 as input and perform an operation (+,-,*,x,/) on them and displays the result of that operation. The program should tell the user whether the result is an even number or odd number. If the result is an even number the program should generate again two integers and repeat the process again. The program will only stop when the result of the operation is an odd number.
Hint: (An even number is a number that can be divided into two equal groups. An odd number is a number that cannot be divided into two equal groups)
Expected output of the program
The number of time the program generated the random number.
The value of the odd that stops the program.
Marks allocation
1. Use of a random function - 10 Marks
2. Use of a loop - 10 Marks
3. Use of a switch case 10 Marks
4. The use of a sentinel value - Odd number to stop the program - 10
4. correct output- 10
total sales a company has four sales people who sell 5 different products. once a day, each salesperson passes in a slip for each different type of product sold. each slip contains a) salesperson id b) product number c) total price (in rs.) of that product sold that day assume that all slip data are stored in a file. write a program that can be used by every salesperson to store his/her data in the file. write another program to generate weekly summary report on every saturday night in a tabular format. report will display (based on user’s choice) a) product-wise daily sale b) salesperson-wise daily sale c) maximum and minimum sale (product and salesperson-wise) d) total summary of weekly sales
1. In K-means algorithm, what is the most commonly used distance metric to calculate distance between centroid of each cluster and data points?
a)Chebyshev distance
b)Manhattan
c)Euclidean
d)None of the above
1. Which of the following statement is not correct about k-means?
a)Accuracy of cluster are improved by scaling of attributes.
b)K-means clusters are affected by outliers.
c)K-Means clustering is NOT influenced by initial centroids which are called cluster seeds
d)Number of clusters to be built is typically an user input and it impacts the way clusters are created
1. The method / metric which is NOT useful to determine the optimal number of clusters in unsupervised clustering algorithms is
a)Dendogram
b)Elbow method
c) Scatter plot
d) None of the above
1. Each centroid in K- means algorithm defines one
a.cluster
b.data point
c.two clusters
d.None of the above
1. Match the terms in Group A with the relevant terms in Group B
Group A Group B
A.) k-means 1) unsupervised learning algorithm
B) knn 2) k is no. of clusters
c.) logistic regression 3) k is no. of neighbours
d). clustering 4) logit function
Ms. Ashwini has a deck of cards and she wants to find the Fibonacci series of chosen cards. Write an application using functions to find the Fibonacci series of chosen cards. (The Fibonacci numbers are generated by setting F0 = 0, F1 = 1, and then using the recursive formula. Fn = Fn-1 + Fn-2. to get the rest. Thus the sequence begins: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55.).
The requirements to solve the problem are
a: Get the number up to which Fibonacci series is to be calculated.
b: Write a function to calculate the Fibonacci series
c: Print the result
Harry likes candies and he cannot get satisfied with only the ones he buys from the stores. He knows one of the best places to get it a Candy warehoue Vie decades to raid the warehouse located in Mary-ville. The warehouse has m containers, in the ith container there are x i candy boxes each having yi candies. All candy bees are of the same size. Harry is carrying a rucksack which can hold n boxes. He needs to find out which boxes to pick up so that he gets the maximum number of candles in this raid
Can you help him pick up the boxes and report on how many maximum number of candies he could steal?
Input
First line contains integer n (1 <= n <= 2x10^8 ") and integer *m (1 <= m <= 20). The i+ 1th line contains a pair of numbers and yi[1<x< 10^81<=y_j<=10
Output
Single number for the number of candies.
Sample input
73
5 10
25
36
Enter number to check Fibonacci are not