PROGRAMMING IN JAVA (CSE310)
Time Allowed: 02:00 Hrs
Max. Marks: 50
PART B
Q2 a) Write a program to create a class named
find_Average which contains a static method named getAverage which accepts a
two-dimensional array of size M X N and returns an array of size M containing the
largest element in corresponding row of input array. [10
Marks]
Example: Input: {{1, 6, 3, 8},
{6, 5, 7, 2},
{3, 5, 1, 5}
}
Output: [8, 7, 5]
OR
b) (i) What is the difference between LocalDate
and LocalDateTime class? What is the use of parse method in these
classes? Write code snippet to create a LocalDate object with date 30 April
2017 using of method. [5 Marks]
(ii) Write
a program to define a class named Employee with attributes name salary and id.
Also provide a parameterized constructor to initialize all the attributes.
Create a class TestEmployee in which
create at least 3 employee objects and Store in an arraylist.
Implement a method public
void search(int id) which display the name and salary of the employee
with given id. [5 Marks]
Q3 a) What do you mean by Singleton design
pattern? Discuss a scenario where singleton design pattern can be used? Write a
program to implement that scenario. [10
Marks]
OR
b) (i) Differentiate between method and
constructor. What do you mean by constructor chaining? Explain with suitable
example. [5
Marks]
(ii) Write
a program which prompts the user to enter a String now implement the following
method
public int[] countVowels(String s)
which returns the array containing the
number of vowels in String s. Where the count of a, e, i, o, u is stored in
indexes 0 to 4 respectively. [5
Marks]
Q4 a) Write a program to define an interface
Person containing abstract method public VoterId getVoterID().
Create a class Employee which inherits
Person and contains an inner class VoterId with attributes id and name.
Implement the getVoerId method such that it reads the name and automatically
assigns a unique id to each Employee Object and return the VoterId object.
Define a Main class in which create two
Employee objects and display their name and VoterId. [10 Marks]
OR
b) (i) Define
a class Test containing a method public void demo(). Define a local class
MyLocal inside demo() and MyLocal must have a method public int add(int a, int
b). Invoke the add method from another class TestLocal.
[5
Marks]
(ii) Differentiate
between following:
(a)
Abstract class and Interface
(b)
default method and static method in an interface
(c)
Anonymous class and Lambda Expression [5
Marks]
Q5 a) What do you mean by Serialization?
Differentiate between flush() and close() methods.
Write
a program to define a class Employee having attributes name, emp_id and salary.
Create 5 Employee objects and write those objects in a file named as
Employees.txt.
Write a method public void
getDetails(int minsalary) which displays the name, emp_id and salary of
all the employees having salary less than the input minsalary.
[Hint: Use Object Input/Output Stream] [10 Marks]
OR
b) (i) Write a program to define a user defined
exception class named as "InvalidStringException" which prints
"Length of String is ODD" when the object of this class is printed.
Create a class MyString which prompts
the user to enter a string s and if the number of characters in s is odd then
throw the InvalidStringException and handle it using try-catch-finally. [5 Marks]
(ii) What
do you mean by assertion? What is the significance of using assertions in java?
How it is different from Exception handling? [5 Marks]
Q6 a) Write a program to define a class
Employee with attributes employee_id, name and designation and a parameterized
constructor to initialize all the attributes.
Read
the details of Employee from the user at run time and store 4 Employee objects
in an appropriate collection such that the details of Employee can be directly
fetched using the employee_id as the search key.
In
a class TestCollection, prompt the user to enter the employee id and display
all the details of employee. [10 Marks]
OR
b) (i) What
do you mean by Wildcard argument in generics?
Write a program to implement a method
which accepts an arraylist containing duplicate values and returns a Collection
having unique elements only.
public <E extends Number>Collection
removeDuplicate(ArrayList<E > al) [5 Marks]
(ii) Differentiate
between following:
(a) Iterator and ListIterator
(b) HashSet and HashMap
(c) ArrayList and Vector [5
Marks]
Thank You So much Sir...
ReplyDeleteThnx Sir..
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteplease upload the answers sir for reference
ReplyDeleteThis is very useful. we sincerely appreciate your effort.
ReplyDeleteThank you so much sir
ReplyDeleteplease uploaas answere?
ReplyDeleteThanks sir , for giving us idea , that question can be framed.
ReplyDeletethis is good
ReplyDeletethank you so much sir for your cooperation
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteThank you !! Very usefull !!
ReplyDeleteieee java projects in chennai
final year arduino project centers chennai
Web Design training in chennai
digital marketing company in chennai
Thanks for sharing this valuable information to our vision.
ReplyDeleteJava Online course
Thank you !! Very usefull !!
ReplyDeletedot net training in chennai
matlab training in chennai
embedded system training in chennai
COEPD LLC - Center of Excellence for Professional Development is the most trusted online training platform to global participants. We are primarily a community of Business Analysts who have taken the initiative to facilitate professionals of IT or Non IT background with the finest quality training. Our trainings are delivered through interactive mode with illustrative scenarios, activities and case studies to help learners start a successful career. We impart knowledge keeping in view of the challenging situations individuals will face in the real time, so that they can handle their job deliverables with at most confidence.
ReplyDeletecoepd.us/index.html
Nice blog Content.It is very informative and helpful. Please share more content. Thanks.
ReplyDeleteJAVA Training
JAVA Course
JAVA Institute
BE projects in chennai is the well choice in chennai for offering final year IEEE projects for btech projects in chennai and best InPlant Traning-IPT for Engineering students. We're inside the constant lookout of higher techniques for overwhelming our customers our clients with equipment that placed them in btech projects in chennai.
ReplyDeleteIt is really a great and useful piece of info. I’m glad that you shared this helpful info with us.Thank you for sharing.
ReplyDeleteIeee robotics projects in chennai | Cse project centers in chennai
Thank you!
ReplyDeleteBest java internship training in chennai
Thanks for Sharing this Valuable Information i like this i Can Share this with My Friend Circle.
ReplyDeleteGoogle Cloud Platform Training in Hyderabad
I go through your blog it's really very interesting post and useful information. I like it very much.
ReplyDeleteThanks for sharing.
Vehicle Tracking System
Fleet Management Software
thanks for sharing.
ReplyDeleteJava training in Chennai | Java training institute in Chennai | Java course in Chennai
Nice Article !!!
ReplyDeleteluxury properties for sale in chennai
cheap luxury homes for sale in chennai
top luxury apartments in chennai
Nice Article !!! Great Share
ReplyDeletecommercial property for rent in chennai
residential apartments for rent in chennai
independent house for rent in chennai