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 Rating | ||||
| ||||
Ans. Yes and No. JVM is an extra layer that translates Byte Code into Machine Code. So Comparing to languages like C, Java provides an additional layer of translating the Source Code. C++ Compiler - Source Code --> Machine Code Java Compiler - Source Code --> Byte Code , JVM - Byte Code --> Machine Code Though it looks like an overhead but this additional translation allows Java to run Apps on all platforms as JVM provides the translation to the Machine code as per the underlying Operating System. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   jvm   interpreter   platform independent   yes-no   advanced   architecture | ||||
Related Questions | ||||
Why is String immutable in Java ? | ||||
Why Char array is preferred over String for storing password? | ||||
Does garbage collection guarantee that a program will not run out of memory? | ||||
Describe, in general, how java's garbage collector works ? | ||||
Describe what happens when an object is created in Java ? | ||||
Can you provide some implementation of a Dictionary having large number of words ? | ||||
Can constructors be synchronized in Java ? | ||||
What are various types of Class loaders used by JVM ? | ||||
what is covariant return type? | ||||
Can I import same package/class twice? Will the JVM load the package twice at runtime? | ||||
Advanced level question frequently asked in US based companies. Recently asked in EMC and Intuit. | ||||
| ||||
Ans. Simplest implementation we can have is a List wherein we can place ordered words and hence can perform Binary Search. Other implementation with better search performance is to use HashMap with key as first character of the word and value as a LinkedList. Further level up, we can have linked Hashmaps like , hashmap { a ( key ) -> hashmap (key-aa , value (hashmap(key-aaa,value) b ( key ) -> hashmap (key-ba , value (hashmap(key-baa,value) .................................................................................... z( key ) -> hashmap (key-za , value (hashmap(key-zaa,value) } upto n levels ( where n is the average size of the word in dictionary. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   collections   hashmap   binary search   search algorithm   advanced   architecture   data structure Asked in 6 Companies   frequent | ||||
Try 1 Question(s) Test | ||||
Related Questions | ||||
Which AWS services would you use if you have find a cheapest solution for an analytics application ? | ||||
If a company comes to you with a problem statement, how would you help provide a solution for it ? | ||||
While working on a web application, you are informed that there is no new data in Database for last few hours ? How would you go about debugging this problem ? | ||||
How would you test a Twitter application ? | ||||
Can we keep application configuration at different places and what could be the consideration for choosing multiple places for doing so ? | ||||
Give an example wherein you recommended some solution that fixed the problem in a much easier way ? | ||||
| ||||
Ans. WEDNESDAY FRIDAY SATURDAY Only one FRIDAY will be printed as Set doesn't allow duplicates.Elements will be printed in the order in which constants are declared in the Enum. TreeSet maintains the elements in the ascending order which is identified by the defined compareTo method. compareTo method in Enum has been defined such that the constant declared later are greater than the constants declared prior. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   code   coding   enum   set   treeset   advanced | ||||
Try 3 Question(s) Test | ||||
Related Questions | ||||
Difference beween HashSet and TreeSet ? | ||||
What is comparator interface used for ? | ||||
If I try to add Enum constants to a TreeSet, What sorting order will it use ? | ||||
Which are the sorted collections ? | ||||
If we add Enum constants to a sorted collection ( Treemap , TreeSet ), What will be the order in which they will be maintained ? | ||||
What is the difference between TreeSet and TreeMap ? | ||||
Which of the following is insertion heavy - HashSet or TreeSet ? | ||||
How to sort objects based on one of the field ? | ||||