Interview Questions and Answers - Order By Newest Q911. 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 Q912. 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 Q913. 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 Q914. 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 Q915. 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 Q916. 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 Q917. 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 Q918. 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 Q919. 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 Q920. What is OutOfMemoryError in Java? Core Java
Ans. OutOfMemoryError in Java is a subclass of VirtualMachineError and is thrown by JVM when it runs out of heap memory. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  outofmemoryerror   error   exceptions   jvm   java   heap memory   heap Q921. 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 Q922. What is a broker in Apache Kafka ?
Ans. Kafka is run as a cluster comprised of one or more servers each of which is called a broker Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  kafka   bigdata   message queue Q923. What is a Topic in Apache Kafka ?
Ans. A topic is a category or feed name to which messages are published Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  kafka   bigdata   message queue Q924. 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 Q925. Have you used Kafka in your project ? If Yes, for what ?
Ans. We were using Kafka as a replacement for JMS Message Queue for better throughput. We were just using a simple Java multi threaded client as order of message consumption didn't matter to us. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  kafka   bigdata   message queue   java Q926. Does Kafka uses ZooKeeper ?
Ans. Yes Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  kafka   bigdata   yes-no   yes no Q927. 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 Q928. 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 Q929. 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 Q930. Action Class is singleton and hence not thread safe in .. a. All versions of Struts b. Struts 1 c. Struts 2 d. None of Struts versions
Ans. Struts 1 Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  struts   j2ee   mvc frameworks   struts1   struts2 Q931. 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 Q932. 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 Q933. 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 Q934. 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 Q935. Which of the following is not the use of this keyword ? a. Passing itself to another method b. To call the static method c. Referring to the instance variable when local variable has the same name d. Calling another constructor in constructor chaining
Ans. To call the static method Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  this   this keyword   java Q936. 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 Q937. 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 Q938. 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 Q939. How many bits are used to represent Unicode ? a. 8 bits b. 16 bits c. 24 bits d. 32 bits
Ans. 16 bits Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   character coding   character encoding Q940. How do I determine which POM contains missing transitive dependency? a. mvn -A b. mvn -M c. mvn -R d. mvn -X Maven
Ans. mvn -X Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  maven   maven transitive dependencies