Search Interview Questions | More than 3000 questions in repository. There are more than 900 unanswered questions. Click here and help us by providing the answer. Have a video suggestion. Click Correct / Improve and please let us know. |
|
| ||||
Interview Questions and Answers - Order By Newest | ||||
| ||||
Ans. Though we are trying to serialize BuggyBread1 object but we haven't declared the class to implement Serializable. This will throw java.io.NotSerializableException upon execution. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   io   file   fileio   coding   code   serialization   notserializableexception   exception   file handling | ||||
| ||||
Ans. No, It will throw java.io.NotSerializableException. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   io   file   fileio   coding   code   serialization   notserializableexception   exception   file handling | ||||
| ||||
Ans. Yes. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   io   file   fileio   coding   code   serialization   yesno  file handling | ||||
| ||||
Ans. Date and Time after 5 months from now. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   date   calendar   scjp   ocjp   coding   code | ||||
Very Frequently asked. Favorite question in walkins and telephonic interviews. Usually among first few questions. Asked in different variants. Must know for intermediate and expert professionals.Among Top 10 frequently asked questions. | ||||
| ||||
Ans. A Class must override the hashCode method if its overriding the equals method. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   collections   hashcode  hash code   equals   collections Asked in 44 Companies intermediate   frequent | ||||
Try 1 Question(s) Test | ||||
| ||||
Ans. 4567 5678 6789 | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   collections   set   treeset   coding   code | ||||
Ans. SUNDAY MONDAY SATURDAY | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  enum   set   collections   hashset   coding   code | ||||
Try 3 Question(s) Test | ||||
Ans. FRIDAY , SATURDAY and WEDNESDAY will be printed but the order cannot be determined. Only one FRIDAY will be printed as Set doesn't allow duplicates. Order cannot be determined as HashSet doesn't maintain elements in a particular order. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   code   coding   enum   set   hashset | ||||
Try 3 Question(s) Test | ||||
| ||||
Ans. 1 111 2 TreeSet maintains the elements in the ascending order which is identified by the compareTo method. compareTo method in String has been defined such that it results in the natural alphabetic Order. Here the elements in the TreeSet are of String and not of Integer. In String Natural Order, 111 comes before 2 as ascii of 1st character first determines the order. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   code   coding   set   treeset   string   integer | ||||
| ||||
Ans. 1 2 111 TreeSet maintains the elements in the ascending order which is identified by the compareTo method. compareTo method in Integer has been defined such that it results in the natural numerical Order. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   code   coding   set   treeset | ||||
| ||||
Ans. No. This will give a compilation error saying "Abstract methods do not specify a body". | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   abstract classes   abstract methods   java compilation error   java coding   java code   coding   yes-no | ||||
| ||||
Ans. Select the package -> Right Click -> Source -> Organize Imports. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  eclipse   import statement   code cleaning   code review   clean code | ||||
| ||||
Ans. FishEye is used to extract information from source code repository whereas Crucible is used to request, perform and manage code reviews. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   fisheye   crucible   code review   tools | ||||
| ||||
Ans. Yes | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   fisheye   crucible   code review   tools   yes-no | ||||
| ||||
Ans. Red Background for a line denotes the lines that have been deleted with the change set and Green background denotes the addition. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   crucible   fisheye   code review | ||||
| ||||
Ans. Before Unicode there were many language / country standards like ASCII , ISO , KOI and BIG 5. In order to accommodate multiple language letters and to overcome problems with using different multiple standards , a new language standard was developed i.e unicode system. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   unicode | ||||
| ||||
Ans. One. As we haven't specified the type of TreeSet, it being evaluated with the first element insertion. Once it's identified that it's of type String and as no comparator has been defined, the comparison is done using the String compareTo method. String compareTo method compares the elements by the content / value. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   set   treeset   string   compareto   coding   code | ||||
| ||||
Ans. Collision is the situation when two different elements have the same Hash Code. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   collections   collision   hashcode  hash code   hash collections   ebay Asked in 1 Companies intermediate   frequent | ||||
| ||||
Ans. http://stackoverflow.com/questions/18799591/print-natural-sequence-with-help-of-2-threads1-is-printing-even-and-2nd-is-pri | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  print natural numbers with two threads   multithreading   multi threading   threads   code   coding   makemytrip.com | ||||
Must know at all levels. Among Top 10 frequently asked questions in Java. Very frequently asked to fresh graduates or less experienced professionals. | ||||
| ||||
Ans. Its a facility for code reuse and independent extension wherein a derived class inherits the properties of parent class. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  inheritance  object oriented programming (oops)  oops concepts  oops concepts  java concepts  code reuse  code re-use   classes  derived classes Asked in 14 Companies basic   frequent | ||||
| ||||
Ans. http://www.geeksforgeeks.org/find-duplicates-in-on-time-and-constant-extra-space/ | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  algorithm   program   code   coding  makemytrip.com | ||||
| ||||
Ans. http://javasearch.buggybread.com/CodeSnippets/searchCodeSamples.php?keyword=Method+to+convert+all+elements+of+a+collection&category=code | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  code  coding  string  String.toLowerCase  set  collections | ||||
| ||||
Ans. http://javasearch.buggybread.com/CodeSnippets/searchCodeSamples.php?keyword=singleton+class&category=code | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  singleton  code  coding  design pattern Asked in 1 Companies Intermediate   frequent | ||||
| ||||
Ans. http://javasearch.buggybread.com/CodeSnippets/searchCodeSamples.php?&category=code&searchOption&keyword=946 | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  code  coding  scanner basic | ||||
Very frequently asked to fresh graduates. Frequently asked in NSEiT and Accenture India | ||||
| ||||
Ans. public class Main { public static void main(String args[]) { int number = 2; int count = 0; long sum = 0; int givenNumber = 1000; while (count < givenNumber) { if (isPrimeNumber(number)) { sum = number; count; } number; } System.out.println(sum); } private static boolean isPrimeNumber(int number) { for (int i = 2; i <= number / 2; i) { if (number % i == 0) { return false; } } return true; } } | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  generate prime numbers  code  coding Asked in 5 Companies basic   frequent | ||||
| ||||
Ans. public class Factorial { public static void main(String[] args){ int x = 5; System.out.println(calculateFactorial(x)); } private static int calculateFactorial(int x){ if(x==1){ return 1; } return x * calculateFactorial(x-1); } } | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  factorial  calculate factorial  code  coding  recursion Asked in 1 Companies basic | ||||
| ||||
Ans. http://javasearch.buggybread.com/CodeSnippets/searchCodeSamples.php?&category=code&searchOption&keyword=964 | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  builder design pattern  builder pattern  code  coding intermediate | ||||
| ||||
Ans. http://javasearch.buggybread.com/CodeSnippets/searchCodeSamples.php?&category=code&searchOption&keyword=965 | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  constructor overloading  code  coding Asked in 2 Companies basic | ||||
| ||||
Ans. http://javasearch.buggybread.com/CodeSnippets/searchCodeSamples.php?&category=code&searchOption&keyword=963 | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  ternary operator  code  coding | ||||
| ||||
Ans. http://javasearch.buggybread.com/CodeSnippets/searchCodeSamples.php?&category=code&searchOption&keyword=952 | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  set  collections  sorting  treeset  code  coding | ||||