WINSEM2020-21 CSE1007 ELA VL2020210504676 Reference Material II 03-Jun-2021 FAT L21

You might also like

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

School of Computer Science and Engineering

Winter Semester-2020-21
B.Tech Computer Science Engineering
Final Assessment Test
Programming in Java Lab
Time-45 Minutes

1. A hash algorithm uses rotation and fold shift methods to compute the address at which the
user input has to be stored. Define a static method to perform rotation of the data by
moving the least significant digit to the most significant bit position. Also define a non-
static method to perform fold shift by dividing the rotated data into segments of length 2
and then add all the segments to get the hash address. If the sum has more than 2 digits,
delete the most significant digit and the resulting number is the address. Invoke these
methods from main( ) method.

Eg., If the data is 112286, after rotation it should be 611228 and after fold shift it should
be 61 + 12 + 28=101 =01 (after deleting the most significant digit)

2. Define a class ‘Donor’ to store the below mentioned details of a blood donor, Name, age,
Address, Contact number, blood group, date of last donation. Create ‘n’ objects of this
class for all the regular donors at Vellore. Write these objects to a file using character
stream. Read these objects from the file and display only those donors’ details whose
blood group is ‘A+ve’ and had not donated for the recent six months.

3. The interface GCD contains an abstract method computeGCD(int num1, int num2).
Class APPROACH1 implements the interface by following Euclid’s algorithm and
class APPROACH2 implements the interface by listing all the factors (need not be
prime factors) of the two numbers and choosing the highest common factor. Write a
Java program to do the above said operations.

4.
Marks 1 2 3 4 5 6 7 8 9 10
(xi)
Student 3 4 17 8 23 10 4 6 5 2
count
(fi)

Your Java faculty evaluates Digital Assignment-I and stores the count of students who
have scored 1 mark, 2marks and so on, as shown in the table above. She/He wants to
calculate the mean of the distribution given by

∑𝑛 𝑓𝑖𝑥𝑖
𝑚𝑒𝑎𝑛 =∑𝑖=1
𝑛
𝑓𝑖
𝑖=1

Assist him/her in completing this task by spawning two threads out of which one works
for calculating ∑𝑛𝑖=1 𝑓𝑖𝑥𝑖 and the other for calculating ∑𝑛𝑖=1 𝑓𝑖 . The main thread should
calculate mean of the marks.

5. Develop a JAVAFX to simulate a smart board. The teacher should be able to write on the
smart board by dragging the mouse in the required direction. Your JAVAFX window must
contain 4 buttons namely Red, Green,magenta and Eraser. Color of the writing should be
based on the buttons chosen. Default color black must be used, should the teacher doesn’t
choose any color. Clicking the Eraser button and then dragging the mouse over a portion
should erase the contents in that portion.
6. Inside a package named p1, define a class ‘Extract’ with a method that will extract the digits
of a number passed to it and store the extracted digits in an array. Create another package
p2 inside p1 package and define two classes ‘Sum’ and ‘SumOfSquares’ in it. In the ‘Sum’
class include a method to find the sum of the elements of the array stored in ‘Extract’ class.
In the ‘SumOfSquares’ class include a method to find the sum of the squares of the array
elements. Now define the main class inside another package p3 which is a sub-package of
p2. The main method should find the quotient after dividing the sum of squares of digits of
the given number by sum of the digits.
7. Develop a JDBC application to retrieve the name and 12th board exam marks (Language-I,
Language-II, Maths, Physics, Chemistry, Biology) of a student, given his/her registration
number. Assume registration number, name and marks to have been stored in a table.
Implement Insert and update operations also.
8. Write a JavaFX program that simulates traffic light. The program let user select one of
three lights : red, yellow or green .When a checkbox is selected with red light, the
COLOR BOX Label should be displayed as red, if the green light is selected, the label
should be green, and so on. When starting the program “NO lights: should be ON, so
that the colour of the Label should be black.

You might also like