Thread: Interview Questions - Technical Round

Forum : Java EE FAQ?s and Interview Questions   11-2-2018 02:26:40 AM
User Image
RajaKnL

Newbie

Joined: Jun 25, 2017

Points: 100

Threads: 7

Posts: 21

Interview Questions - Technical Round

| Quote Date : Feb 11, 2018    Views:1061    

Date 10/02/2018

1.if i have a object then how to get Class type of that object?
2.if i have an object how to check whether the object is belongs to which class?
3.what are OOPs principles? explain them? where you found them in jdk provided classes?
4.
Set<Test> set=new HashSet<>();
Test t=new Test();
set.add(t);
set.add(t);
System.out.println(set.size());
how many objects will be added to Hashset and what is the size of the Hashset? explain
5. what are the differences b/n set and list
6.if i add 2 different objects to set by using same referance variable, how many objects will be added to set?
Test t=new Test();
HashSet<Test> tests=new HashSet<>();
tests.add(t);
t=new Test();
tests.add(t);
System.out.println(tests.size());
7.i have list of employees i want to remove a employee whos id is 1 write the logic? 
wrote for each loop and removed one object..
is there any problem with in this code? do we get any exception?
List<Test> tests=new ArrayList<>();
tests.add(new Test());
tests.add(new Test());
tests.add(new Test());
tests.add(new Test());
tests.add(new Test());
for(Test test:tests){
System.out.println(test);
tests.remove(test);
}
8.int add() and long add() are in same class are they overloaded or duplicate methods? if i have long add() in super class int add() in sub class is it valid overriding?
9.In a class i have void add(Employee) void add(Student) and i called add(null) in main method which method will be called?
10.parent method is throwing checked-exception is it mandatory that child class method should also throw?
11.what are checked and unchecked exceptions?
12.how to create checked and how to create un-checked exception?
13.parent method is throwing both Checked and unchecked exceptions then what child should be throwing?
14.what is cascade in hibernate?
15.what is many-many relationship, how many tables we need to have in many-many relationship?
16.what are default methods in interfaces? what is the purpose of them?
17.If i have 100 methods in an Interface if i want to provide implementaion is it mandatory that i need to override 100 methods?

Coding Round Question
1.if i have an int[] which has some values, i have an index place called (Breaking point) which fulfills below features
Sum of all the elements less than breaking point sum is
exactly equals to the
product of all the elements grater than breaking point to end of that array
OR
Sum is ZERO

find all such breaking points and put them in a Set and write test cases
case-1:- if given array is empty or null then throw IllegalArgumentException
case 2: [1,2,1] has break point at index 1
case 3:[5,0,-5,-4] has 0,3 as breaking points
Write JUnit test cases for all possibilities including exception paths?

Comments

User Image
Samanta1

Newbie

Joined : Jun 27, 2017

Points : 130

Threads: 8

Posts: 16

Re: Interview Questions - Technical Round

Reply Date : Feb 22, 2018

Thanks

User Image
Prasad2992

Newbie

Joined : Apr 20, 2017

Points : 100

Threads: 0

Posts: 1

Re: Interview Questions - Technical Round

Reply Date : Feb 20, 2018

Hi can u provide a solution for breaking point program

User Image
Sriman

Member

Joined : Jul 15, 2016

Points : 570

Threads: 642

Posts: 184

Re: Interview Questions - Technical Round

Reply Date : Feb 11, 2018

Thanks for sharing the questions

Load More

No More Comments