Programming > EXAM REVIEW > Questions and Answers > JAVA DA2 Programming Exam (All)

Questions and Answers > JAVA DA2 Programming Exam

Document Content and Description Below

CSE MISC Q1. Write a program to demonstrate the knowledge of students in Java Exception handling. Eg., Read the Register Number and Mobile Number of a student. If the Register Number does not cont... ain exactly 9 characters or if the Mobile Number does not contain exactly 10 characters, throw an IllegalArgumentException. If the Mobile Number contains any character other than a digit, raise a NumberFormatException. If the Register Number contains any character other than digits and alphabets, throw a NoSuchElementException. If they are valid, print the message ‘valid’ else ‘invalid’. Q2. Write a program to demonstrate the knowledge of students in Java Exception handling. Create a class by name Employee with members – Employee ID, Name and year of birth. The Employee ID is a string that contains the ID in the format year-designation-number. The year is represented with the last two digits. The designation is a single letter code - 'F' for faculty and 'S' for staff. The number is a 3 digit number. Q3. Write a program to demonstrate the knowledge of students in multithreading. Eg., Three students A, B and C of B.Tech-IT II year contest for the PR election. With the total strength of 240 students in II year, simulate the vote casting by generating 240 random numbers (1 for student A, 2 for B and 3 for C) and store them in an array. Create four threads to equally share the task of counting the number of votes cast for all the three candidates. Use synchronized method or synchronized block to update the three count variables. The main thread should receive the final vote count for all three contestants and hence decide the PR based on the values received. Q4. Create a User Defined Exception, Implement a remainder ClockAPP to the person saying Good Morning, Good Afternoon and Good Night by showing the current time. Write a code that assigns different values to the String variable timeofDay based on the value of time in hours. Raise remainder if time is 5 and 12, including 5 but not including 12, set timeofDay to “Morning, Have Fresh Vegetable Juice and then Sugar Tablet with mild walking”. Raise Exception, if time is between 12 and 17, including 12 but not including 17, set timeofDay as “its Day Time, after lunch have tablet to avoid sleep”. If time is between 17 and 18.30. Including 17 but not including 18.30, set timeofDays as “Hello, Good Evening have a dinner” and finally, if time variable does not satisfy all the above condition, set time as “Night, Go for sleep”. Q5. Write a program to demonstrate the knowledge of students in File handling. Eg., Define a class ‘Donor’ to store the below mentioned details of a blood donor. Name, age, Address, Contactnumber, bloodgroup, date of last donation. Create ‘n’ objects of this class for all the regular donors at Vellore. Write these objects to a file. 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. [Show More]

Last updated: 1 year ago

Preview 1 out of 17 pages

Add to cart

Instant download

We Accept:

We Accept
document-preview

Buy this document to get the full access instantly

Instant Download Access after purchase

Add to cart

Instant download

We Accept:

We Accept

Reviews( 0 )

$7.00

Add to cart

We Accept:

We Accept

Instant download

Can't find what you want? Try our AI powered Search

OR

REQUEST DOCUMENT
116
0

Document information


Connected school, study & course


About the document


Uploaded On

Aug 23, 2022

Number of pages

17

Written in

Seller


seller-icon
QuizMaster

Member since 4 years

1091 Documents Sold


Additional information

This document has been written for:

Uploaded

Aug 23, 2022

Downloads

 0

Views

 116

Document Keyword Tags

What is Browsegrades

In Browsegrades, a student can earn by offering help to other student. Students can help other students with materials by upploading their notes and earn money.

We are here to help

We're available through e-mail, Twitter, Facebook, and live chat.
 FAQ
 Questions? Leave a message!

Follow us on
 Twitter

Copyright © Browsegrades · High quality services·