Today I would like to share an interview experience with you. Any way let me start.
They conducted a 2 hours written exam which includes technical question as well as aptitude question. I am not bothered about the aptitude question :P from my point of view , one with high technical skill will elected regardless of evaluating their aptitude skills.
Well.. now let’s consider the technical questions. They have 4 questions. Two of them related to java collection framework , one is from hashSet and another from hashmap. And the third one related to database queries . It is not that much challenging ; an average programmer can handle that very quickly . For that reason will explain all other questions except the last one.
Before I dive in to the explanation I would like to share my overall outcome or how I treated that event. All those question are very simple to me but for various reasons I can’t perform well in that interview. I am a big fan of ”copy paste code” for that reason I couldn’t reproduce some boilerplate code at that time , and my handwriting is very bad as well , for the last six month I am using eclipse IDE to coding so majority of boilerplate code will generate automatically. And I were playing with Hibernate framework so far for that reason I failed in answering the database related question . Summing up all these the interview result is a big zero. The end of the interview HR said that “after evaluating the exam we will get back to you” and she added that she expected ill more from me. :P.
Using nested for loop print the following pattern .
1
1 3
1 3 5
1 3 5 7
1 3 5 7 9
The answer is simple . Using following nested loop we can print a pattern
Now lets consider the collection framework questions . Those questions are simple enough; Define one hashmap and arraylist and then add some values and print those values using iterator , add one null value to it and check against those null value; that’s all.
Answer:
They conducted a 2 hours written exam which includes technical question as well as aptitude question. I am not bothered about the aptitude question :P from my point of view , one with high technical skill will elected regardless of evaluating their aptitude skills.
Well.. now let’s consider the technical questions. They have 4 questions. Two of them related to java collection framework , one is from hashSet and another from hashmap. And the third one related to database queries . It is not that much challenging ; an average programmer can handle that very quickly . For that reason will explain all other questions except the last one.
Before I dive in to the explanation I would like to share my overall outcome or how I treated that event. All those question are very simple to me but for various reasons I can’t perform well in that interview. I am a big fan of ”copy paste code” for that reason I couldn’t reproduce some boilerplate code at that time , and my handwriting is very bad as well , for the last six month I am using eclipse IDE to coding so majority of boilerplate code will generate automatically. And I were playing with Hibernate framework so far for that reason I failed in answering the database related question . Summing up all these the interview result is a big zero. The end of the interview HR said that “after evaluating the exam we will get back to you” and she added that she expected ill more from me. :P.
Using nested for loop print the following pattern .
1
1 3
1 3 5
1 3 5 7
1 3 5 7 9
The answer is simple . Using following nested loop we can print a pattern
for(int i=1;i<10;i+=2){
for(int j=1;j<i+1;j+=2){
System.out.print(j+" ");
}
System.out.println("\n");
}
Now lets consider the collection framework questions . Those questions are simple enough; Define one hashmap and arraylist and then add some values and print those values using iterator , add one null value to it and check against those null value; that’s all.
Answer:
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.ListIterator;
import java.util.Set;
class Student{
Long id=null;
String name=null;
Student(Long id,String name){
this.id=id;
this.name=name;
}
}
public class StringFunction {
public static void main(String[] args) {
ArrayList<String> list=new ArrayList<String>();
list.add("sudeep");
list.add("cv");
list.add("miyas");
System.out.println(list);
list.add("last");
System.out.println(list);
list.remove(1);
System.out.println(list);
ListIterator<String> iterator=list.listIterator();
while(iterator.hasNext()){
String value=iterator.next();
System.out.println(value);
}
HashMap<String,String> map=new HashMap<String, String>();
map.put("sudeep", "java Developer");
map.put("John", "web designer");
System.out.println(map);
Set<String> keys=map.keySet();
Iterator<String> mapiterator=keys.iterator();
while(mapiterator.hasNext()){
System.out.println("the Value is:"+map.get(mapiterator.next()));
}
Student obj1=new Student(1l,"sudeep");
Student obj2=new Student(2l,"");
Student obj3=new Student(3l,"Manu");
HashMap<Long, Student> stdMap=new HashMap<Long, Student>();
stdMap.put(1l, obj1);
stdMap.put(2l, obj2);
stdMap.put(3l, obj3);
Set<Long> stdMapkeys=stdMap.keySet();
Iterator<Long> stdMapkeysIterator=stdMapkeys.iterator();
while(stdMapkeysIterator.hasNext()){
Student oneStudent=stdMap.get(stdMapkeysIterator.next());
System.out.println("Id:"+oneStudent.id+"\n");
System.out.println("Name:"+oneStudent.name+ "\n");
if(oneStudent.name.isEmpty())
System.out.println("this name is null");
// System.out.println("first print"+stdMap.get(stdMapkeysIterator.next()).name.isEmpty());
}
}
}
I have read your blog. Your blog is really helpful for me to attend the Java interview. Keep posting. I did Java Training in Chennai at TIS academy. Its really useful for me to make a bright future in IT industry.
ReplyDeleteyou need more publicize this so many people who know about it are rare for people to know this
ReplyDeleteSalesforce Training in Hyderabad
unique content is awesome . you have done a great job. I appreciate your effort and I hope that you will get more positive comments from the web users.
ReplyDeleteDigital Marketing Company in Chennai
Digital Marketing Services in Chennai
Excellent and very cool idea and the subject at the top of magnificence and I am happy to this post..Interesting post! Thanks for writing it. What's wrong with this kind of post exactly? It follows your previous guideline for post length as well as clarity..
ReplyDeleteStudy Abroad Consultants in Chennai | Study in Germany Consultants in Chennai | Germany Education Consultants in Chennai
nice post for sharing Java article. It’s really helpful for me. keep sharing tutorials????????????????
ReplyDeleteThis comment has been removed by the author.
ReplyDelete