Interview Questions and Answers - Order By Newest Q751. What is the difference between out.println(a+b); and out.println (a+" " +b); in Java? with a=2 and b=1 Core Java
Ans. First will give the ouput as 3 and the second will give output as 2 1 Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   system.out.println   coding Q752. Which sorting algorithm is used by Collections.sort() in Java ? Core Java
Ans. The sorting algorithm is a modified mergesort. This algorithm offers guaranteed n log(n) performance. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   algorithm   collections   collections.sort   sorting algorithm expert Try 1 Question(s) Test Q753. What doesn Http keep alive header does ? Java EE
Ans. Http is connection less by default. header informs hosts to keep the connection alive so that the same connection can be reused for multiple communication. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   http   http-alive   client server communication Q754. Do you see Class as a Data Type or Data Structure ?
Ans. Class can be better seen as Data Type. This could be implemented as a Data Structure too in some cases. One thing worth understanding here is that Data type and Data structure are conceptual things. Class could be implementation of either of these. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java   oops   class   data type   data structure Q755. 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 Q756. 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 Q757. 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 Q758. 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 Q759. 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 Q760. 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 Q761. 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 Q762. 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 Q763. 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 Q764. 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 Q765. 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 Q766. 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 Q767. 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 Q768. 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 Q769. 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 Q770. 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 Q771. 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 Q772. 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 Q773. 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 Q774. 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 Q775. 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 Q776. 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 Q777. 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 Q778. 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 Q779. 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 Q780. 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