Interview Questions and Answers for 'Hcl' | Search Interview Question - javasearch.buggybread.com
Javasearch.buggybread.com

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.
Label / Company      Label / Company / Text

   



Interview Questions and Answers - Order By Newest

   next 30
 Q41. What is a stream and what are the types of Streams and classes of the Streams?Core Java
Ans. A Stream is an abstraction that either produces or consumes information. There are two types of Streams :

Byte Streams: Provide a convenient means for handling input and output of bytes.

Character Streams: Provide a convenient means for handling input & output of characters.

Byte Streams classes: Are defined by using two abstract classes, namely InputStream and OutputStream.

Character Streams classes: Are defined by using two abstract classes, namely Reader and Writer.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   file io   streams   byte stream   character stream  file handling     Asked in 3 Companies


 Q42. What are the contents of Hibernate configuration file ( hibernate.cfg.xml ) ?Hibernate
Ans. HBM Files ( Mapping )
DB Connection ( DB Connection String , User Name , Password , Pool Size )
SQL Dialect ( SQL variant to be generated )
Show SQL ( Show / No show SQL on Console )
Auto Commit ( True / False )

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     hibernate   configuration   barclays     Asked in 11 Companies


Frequently asked. Among first few questions in the J2EE segment of interview.
  Q43. What is deployment descriptor ?

or

What is the use of deployment descriptor ?
Java EE
Ans. Deployment Descriptor which is usually web.xml is used to specify the classes, resources and configuration of the application and how the web server uses them to serve web requests.This file is usually added to WEB-INF folder and contains following

* Servlet entries and url mapping
* Plugins
* Some info regarding authentication / filters
* Landing Page
* Event Handlers

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     web.xml   servlets  deployment descriptor     Asked in 15 Companies      basic        frequent

Try 1 Question(s) Test


 Q44. Difference beween HashSet and TreeSet ?Core Java
Ans. 1. HashSet doesnt maintain its elements in any specific order and is all random whereas TreeSet maintains elements in natural order 9 order defined by the equals method of TreeSet element type )

2. TreeSet doesnt allow null elements whereas HashMap does.

3. As TreeSet orders elements and is hence insertion is comparatively slower.

4. HashSet performs basic operations like add(), remove(), contains(), size() etc. in a constant size time. A TreeSet performs these operations at the order of log(n) time.

5. HashMap in Java internally backs a HashSet. A NavigableMap backs a TreeSet internally.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     collections  hashset  treeset  set   hashet vs treeset     Asked in 4 Companies      Basic        frequent

Try 1 Question(s) Test


 Q45. Which elements of a class are ignored during serialization ?Core Java
Ans. 1. Objects are serialized and not classes and hence Static variables are ignored.

2. Transient is an explicit declaration to ignore the variable during serialization and hence transient instance variables are ignored too.

3. Base class instance variables if the base class hasn't been declared serializable.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     serialization     Asked in 1 Companies      intermediate        frequent

Try 1 Question(s) Test


  Q46. What are the different types of inner classes ?Core Java
Ans. Simple Inner Class,
Local Inner Class,
Anonymous Inner Class,
Static Nested Inner Class.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   inner classes   classes     Asked in 6 Companies      basic        frequent

Try 1 Question(s) Test


Frequently asked in Indian Service Companies. Tech Mahindra ( Based on 3 inputs ) and Infosys ( 3 inputs )
  Q47. What is the difference between List, Set and Map ?

or

What are the different Java Collections Interfaces ?
Core Java
Ans. List - Members are stored in sequence in memory and can be accessed through index.
Set - There is no relevance of sequence and index. Sets doesn't contain duplicates whereas multiset can have duplicates.
Map - Contains Key , Value pairs.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   collections   list   set   map   list vs set vs map     Asked in 8 Companies      basic        frequent

Try 1 Question(s) Test


Frequently asked at HCL Technologies ( Based on 3 feedback )
  Q48. Difference between Checked and Unchecked exceptions ?Core Java
Ans. Checked exceptions are the exceptions for which compiler throws an errors if they are not checked whereas unchecked exceptions are caught during run time only and hence can't be checked.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   exceptions   checked exceptions   unchecked exceptions   exception handling   checked vs unchecked exceptions     Asked in 39 Companies      basic        frequent

Try 1 Question(s) Test


Very frequently asked. Favorite question in Walk in Drive of many Indian service companies.
  Q49. What is a Final Variable ?Core Java
Ans. Final variable is a variable constant that cannot be changed after initialization.

  Sample Code for final variable

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     oops   java   final   final variable   basic interview question     Asked in 12 Companies      basic        frequent

Try 1 Question(s) Test


  Q50. Difference between Vector and ArrayList ?Core Java
Ans. Vectors are synchronized whereas Array lists are not.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   basic interview question   vector   arraylist   collections   synchronization   vector vs arraylist     Asked in 35 Companies      basic        frequent


  Q51. What is the use of Transient Keyword ?Core Java
Ans. It in Java is used to indicate that a field should not be serialized.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   oops   serialization   transient   java keywords     Asked in 39 Companies      intermediate        frequent

Try 2 Question(s) Test


Very Frequently asked. Usually asked along with String Class related questions.
  Q52. What is an immutable class ?Core Java
Ans. Class using which only immutable (objects that cannot be changed after initialization) objects can be created.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   oops   immutable  immutability   immutable  immutability class   string class   basic interview question     Asked in 18 Companies      Basic        frequent

Try 2 Question(s) Test


Very frequently asked in phone and walk in interviews.
  Q53. What are Marker Interfaces ? Name few Java marker interfaces ?Core Java
Ans. An interface without any method declaration is called as marker interface. there are 3 in-built interfaces in JVM i.e. serializable, clonable, remote

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   oops   interfaces   marker interface   serializable   clonable     Asked in 21 Companies      intermediate        frequent

Try 1 Question(s) Test


Very frequently asked. Usually difference between String,StringBuffer and StringBuilder is asked in different variations.
  Q54. Difference between StringBuffer and StringBuilder ?Core Java
Ans. StringBuffer is synchronized whereas StringBuilder is not.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   string   stringbuffer   string class   stringbuilder   synchronized   basic interview question   infosys technologies     Asked in 17 Companies      basic        frequent

Try 1 Question(s) Test


  Q55. What is reflection ?
Ans. It is the process of examining / modifying the behaviour of an object at runtime.

  Sample Code for reflection

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   reflection   reflection api   ebay   mindtree     Asked in 29 Companies      basic        frequent


 Q56. When do you get ClassCastException?

or

What is ClassCastException ?
Ans. As we only downcast class in the hierarchy, The ClassCastException is thrown to indicate that code has attempted to cast an object to a subclass of which it is not an instance.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   oops   class casting   classcastexception   exception   error     Asked in 4 Companies      intermediate        frequent

Try 2 Question(s) Test


 Q57. what is fail fast and Fail Safe in collections?Core Java
Ans. Iterators in java are used to iterate over the Collection objects.

Fail-Fast iterators immediately throw ConcurrentModificationException if there is any addition, removal or updation of any element.

Fail-Safe iterators don't throw any exception if a collection is structurally modified while iterating over it. This is because, they operate on the clone of the collection and not on the original collection.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     ail fast   fail saf     Asked in 9 Companies      intermediate


Very Frequently asked.
 Q58. Explain throw, throws , try and catch in Java ?Core Java
Ans. throw is used to re throw an exception.throws is used to declare that the method throws the respective exceptions.try block is used to identify if the respective block has thrown any exception.catch is used to catch the exception that has been thrown by the respective try block.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   exception handling   throw   throws   try   catch     Asked in 5 Companies      basic        frequent


  Q59. Difference between GET and POST Requests ?Web Service
Ans. GET is supposed to get information from the server. Client sends the minimal information so that Server can respond with the response body on basis of request. For example - You want to get complete employment record for employee id 123

POST is supposed to send the information for submission. Payload or a Body is usually sent so that it can be persisted on the server. For example - Sending the complete information of an employee ( id, name , dept etc ) to the server for persisting it.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     get vs post   web service   rest     Asked in 11 Companies      basic        frequent


  Q60. What is coupling and Cohesion ?Design
Ans. Coupling is the degree of interdependence between software modules, a measure of how closely connected two modules are or the strength of the relationships between modules.

Cohesion refers to the degree to which the elements of a module belong together. Cohesion measures the strength of relationship between pieces of functionality within a given module.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     coupling  cohesion     Asked in 10 Companies        frequent


  Q61. What is JSON ?Json
Ans. JSON is "JavaScript Object Notation", primarily used for client-server or server-server communication. Its a much lighter and readable alternative to XML. JSON is language independent and is easily parse-able in all programming languages.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     json   markup language   client server communication     Asked in 26 Companies      basic        frequent

Try 2 Question(s) Test


Very Frequently asked.Favorite question in Walk in drive for many Indian service companies.
 Q62. What is a Final Class ?
Ans. A Class that cannot be sub classed.

  Sample Code for final class

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   oops   final   final class   java keyword   basic interview question     Asked in 3 Companies      basic        frequent


  Q63. what is the difference between collections class vs collections interface ?Core Java
Ans. Collections class is a utility class having static methods for doing operations on objects of classes which implement the Collection interface. For example, Collections has methods for finding the max element in a Collection.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   collections   collections class   collection interface   basic interview question     Asked in 6 Companies      basic        frequent

Try 1 Question(s) Test


Frequently asked in CTS ( Based on 2 feedback )
  Q64. What is the difference between comparable and comparator in java.util pkg?Core Java
Ans. Comparable interface is used for single sequence sorting i.e.sorting the objects based on single data member where as comparator interface is used to sort the object based on multiple data members.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   java.util   comparable   comparator   collections     Asked in 23 Companies      basic        frequent


  Q65. Advantage of Collection classes over Arrays ?Core Java
Ans. Collections are re-sizable in nature. We can increase or decrease the size as per recruitment.
Collections can hold both homogeneous and heterogeneous data's.
Every collection follows some standard data structures.
Collection provides many useful built in methods for traversing,sorting and search.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   collections   collections classes   advantages of collections over arrays   collections vs arrays   basic interview question     Asked in 6 Companies      basic        frequent


  Q66. Write a method to check if input String is Palindrome?Core Java
Ans. private static boolean isPalindrome(String str) {

if (str == null)
return false;

StringBuilder strBuilder = new StringBuilder(str);

strBuilder.reverse();

return strBuilder.toString().equals(str);

}

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   string   stringbuilder   stringbuilder   string class   code   palindrome     Asked in 38 Companies      Basic        frequent


 Q67. Why String is popular HashMap key in Java?Core Java
Ans. Since String is immutable, its hashcode is cached at the time of creation and it doesnt need to be calculated again. This makes it a great candidate for key in a Map and its processing is fast than other HashMap key objects. This is why String is mostly used Object as HashMap keys.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   string class   string   immutable  immutability   hashmap   immutable  immutability   hashcode   hash code   advanced     Asked in 2 Companies      expert        frequent


Very frequently asked in HCL Tech ( Based of 4 inputs )
  Q68. Write a program to reverse a string iteratively and recursively ?Core Java
Ans. Using String method -

new StringBuffer(str).reverse().toString();

Iterative -

public static String getReverseString(String str){
StringBuffer strBuffer = new StringBuffer(str.length);
for(int counter=str.length -1 ; counter>=0;counter--){
strBuffer.append(str.charAt(counter));
}
return strBuffer;
}

Recursive -

public static String getReverseString(String str){
if(str.length <= 1){
return str;
}
return (getReverseString(str.subString(1)) + str.charAt(0);
}

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   string   reverse   stringbuffer   string class   code     Asked in 6 Companies        frequent


Very frequently asked Hibernate interview question. Frequently asked in TCS ( based on 2 feedback )
  Q69. What are different types of associations in Hibernate ?Hibernate
Ans. There are 4 types of associations in Hibernate

One to One
One to Many
Many to One
Many to Many

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     hibernate   associations     Asked in 11 Companies        frequent


Very frequently asked if being interviewed for hibernate. Frequently asked in Tata Consultancy (TCS) and Overstock.com
  Q70. Difference between load and get ?Hibernate
Ans. If id doesnt exist in the DB load throws an exception whereas get returns null in that case.get makes the call to DB immediately whereas load makes the call to proxy.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     hibernate     Asked in 16 Companies      basic        frequent


previous 30   next 30

Help us and Others Improve. Please let us know the questions asked in any of your previous interview.

Any input from you will be highly appreciated and It will unlock the application for 10 more requests.

Company Name:
Questions Asked: