Interview Questions and Answers - Order By Newest Q751. Which of the following data type you will prefer to store price - BigDecimal or Double ?
Ans. BigDecimal if memory and Performance is not critical concern, otherwise double. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   data types   double   bigdecimal Q752. Which takes more memory - float or Float ? Core Java
Ans. float is a native data type whereas Float is a class. A Float object will always take more memory than float variable as there are metadata overheads with the objects. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   data type   float Asked in 3 Companies basic   frequent Q753. Difference between HashMap and WeakHashMap ?
Ans. WeakHashMap uses weak reference for keys, which means if the key object doesn't have any reference then both key/value mapping will become eligible for garbage collection. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   collections   hashmap   weakhashmap   difference between   garbage collection   ebay Q754. Which tree is used to implement TreeMap in Java?
Ans. Red Black Tree Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   collections   treemap   map expert Q755. What is collision in hash collections ? Core Java
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 Q756. When are static and instance methods resolved ? During compile time or Runtime ?
Ans. Static methods are resolved during compile time and hence they cannot participate in runtime polymorphism. Instance methods are resolved during runtime. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   static methods   methods   runtime polymorphism intermediate Q757. What will the following code result ? List> intList = new ArrayList>(); intList.add(Optional.empty()); intList.add(Optional.of(2)); intList.add(Optional.of(3)); intList.add(Optional.of(4)); System.out.println(intList.get(null));
Ans. Compile time error at last line as the get method expect argument of type native int. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  arraylist   list   coding   collections Q758. What will the following code result ? Will it compile ? List> intList = new ArrayList>(); intList.add(Optional.empty()); intList.add(Optional.of(2)); intList.add(Optional.of(3)); intList.add(Optional.of(4)); System.out.println(intList.get((Integer)null));
Ans. Yes but the last line will throw NullPointerException upon execution. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  collections   arraylist   list   coding Q759. What will be the output ?Integer a = 10, b =10;Integer c = 10, d = 1000;System.out.println(a == b);System.out.println(c ==d); Core Java
Ans. truefalse Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   coding   equality   object equality Q760. How to determine if the linked list has a cycle in it ?
Ans. http://stackoverflow.com/questions/494830/how-to-determine-if-a-linked-list-has-a-cycle-using-only-two-memory-locations Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  linked list   data structure   algorithm   java   ebay Q761. Can we have multiple classes in single file ?
Ans. Yes, but there can be only 1 public class in a single file. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   classes Q762. What is Apache Kafka ? BigData
Ans. Kafka is a distributed, partitioned, replicated commit log service. It provides the functionality of a messaging system through messages being written to logs. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  kafka   bigdata   message queue Asked in 4 Companies Q763. Do you know of any facility to convert between Scala and Java Util Collections ? Scala
Ans. We can use JavaConversions which is a part of Scala Library. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  scala   scala collections   java collections Q764. Which interfaces are implemented by BatchUpdateException?
Ans. [Iterable] Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   BatchUpdateException   include Q765. What is the package name for CertStoreParameters class?
Ans. java.lang Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  interfaces   java   CertStoreParameters   include Q766. Which is the Parent Class of CertStoreParameters class?
Ans. Clonable Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  interfaces   java   CertStoreParameters   include Q767. If we add Enum constants to a sorted collection ( Treemap , TreeSet ), What will be the order in which they will be maintained ? a. Sorted Collection wont maintain them in any order. b. Insertion Order c. Order in which constants are declared. d. Natural Sorting Order.
Ans. Order in which constants are declared. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  enum   collections   sorted collections   treemap   treeset   compareto   comparable   java Q768. Which of the following is not type of inner classes ? a. Simple Inner Class b. Static Nested Inner Class c. Method Nested Static Inner Class d. Anonymous Inner Class
Ans. Method Nested Static Inner Class Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   classes   inner classes Try 1 Question(s) Test Q769. Which interface does java.util.Hashtable implement ? a. List b. Set c. Collection d. Map Core Java
Ans. Map Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  hashtable   java   collections Q770. Which of the following is false ? a. HashMap came before HashTable. b. HashMap allows null values whereas Hashtable doesn’t allow null values. c. HashTable and HashMap allow Key-Value pairs. d. Hashtable is synchronized whereas HashMap is not.
Ans. HashMap came before HashTable. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  map   hashmap   hashtable   collection   java Try 2 Question(s) Test Q771. Which of the following is true ? a. We can serialize static variables b. We can serialize transient variables c. We can serialize final variables d. We can serialize instance methods
Ans. We can serialize final variables Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  serialization   java   file io Try 1 Question(s) Test Q772. Which of the collections allows null as the key ?
a. HashTable
b. HashMap
c. TreeMap
d. LinkedHashMap Core Java
Ans. HashMap Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   collections   map  hashtable Asked in 2 Companies basic   frequent Q773. What is the initial state of a thread when it is created and started ? a. Wait b. Running c. Ready d. Sleep
Ans. Ready Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   threads   multithreading   thread states Q774. What state does a thread enter when it terminates its processing? a. Wait b. Ready c. Dead d. Running
Ans. Dead Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   threads   multithreading   thread states Q775. Which of the following is fastest to locate the DOM element ? a. document.getElementById b. document.getElementByName c. document.ElementName.SubElementName d. They all result in similar performance in retrieving the DOM element.
Ans. document.ElementName.SubElementName Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  html   dom   javascript Q776. Which of the following is not a Table tag ? a. th b. td c. tb d.
Ans. tb Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  html   table   html tags Q777. Why should we have Javascript method definitions within HTML Head section ? a. Its safe to have javascript code within head section b. Head section gets loaded even if there is any error in loading HTML page c. Head section gets executed first and hence assure that js method definition will be loaded before they are called d. So that we can have method definition and method call at the same place
Ans. Head section gets executed first and hence assure that js method definition will be loaded before they are called Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  html   head section   javascript Q778. Which of the following is usually not part of EAR file ? a. Server Configuration files b. HTML and Media Files c. Application Configuration files d. Class files
Ans. Server Configuration files Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  ear   deployment   servers   java Q779. Which of the following are usually manual ? a. Unit Test b. Integration Test c. Load Test d. Both a and c
Ans. Integration Test Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  testing   manual testing   automated testing Q780. What is the default location of local repository ? a. ~/.m2/repo b. ~/m2./home/repository c. ~/m2./repository d. ~/m2./home/repo Maven
Ans. ~/m2./repository Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  maven   repositories   local repositories   m2