Java - Interview Questions and Answers for 'HCL Technologies' | Search Java Interview Question - javasearch.buggybread.com
Javasearch.buggybread.com
Share

Search Java Interview Questions


 2098 questions in repository.
 There are more than 200 unanswered questions.
Click here and help us by providing the answer.
Label / Company      Label / Company / Text

   



HCL Technologies

HCL Technologies Limited is an Indian multinational IT services company, headquartered in Noida, Uttar Pradesh, India. It is a subsidiary of HCL Enterprise.

Link: https://www.hcltech.com/
   




Interview Questions and Answers for 'HCL Technologies' - 81 question(s) found - Order By Newest

Very Very frequently asked. Among the first few questions in almost all interviews.Among Top 5 frequently asked questions.
  Q1. Difference between == and .equals() ?Core Java
Anonymous
Ans. "equals" is the method of object class which is supposed to be overridden to check object equality, whereas "==" operator evaluate to see if the object handlers on the left and right are pointing to the same object in memory.

x.equals(y) means the references x and y are holding objects that are equal. x==y means that the references x and y have same object.

Sample code:

String x = new String("str");
String y = new String("str");

System.out.println(x == y); // prints false
System.out.println(x.equals(y)); // prints true

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

   Like      Discuss      Correct / Improve     java   string comparison   string   object class   ==    equals   object equality     Ebay  Cerner  GuideWire  Expeditors Associate  Revature  SAIC  ValueLabs  Realty Redefined  Bank Of America  Capgemini  HCL Technologies  Goldman Sachs  Symmetric Corp  Backstop Solutions  Frontier  IQOR   Science  Vanguard  eClinicalWorks  Experticity  Blue Cross and Blue Shield of Kansas  ComTrade  Banja Luka  Overstock.com  Intrasoft International  IBM  Apex Systems  infoview technologies      basic        frequent

Try 6 Question(s) Test


Advanced level question. Frequently asked in High end product companies. Frequently asked in Cognizant ( Based on 2 feedbacks )
  Q2. Why is String immutable in Java ?Core Java
Anonymous
Ans. 1. String Pool - When a string is created and if it exists in the pool, the reference of the existing string will be returned instead of creating a new object. If string is not immutable, changing the string with one reference will lead to the wrong value for the other references.

Example -

String str1 = "String1";
String str2 = "String1"; // It doesn't create a new String and rather reuses the string literal from pool

// Now both str1 and str2 pointing to same string object in pool, changing str1 will change it for str2 too

2. To Cache its Hashcode - If string is not immutable, One can change its hashcode and hence it's not fit to be cached.

3. Security - String is widely used as parameter for many java classes, e.g. network connection, opening files, etc. Making it mutable might possess threats due to interception by the other code segment.

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

   Like      Discuss      Correct / Improve     java   oops   string   string class   immutable   advanced     Barclays  Jungo  Cloudera  Allston  Man Group  Prokarma  Optimus  Gamesys  ABS  TransPerfect  Fidelity  Deloitte  Zalando  Cognizant (CTS)  Zeta Interactive  SuccessFactors   EchoStar  InterGlobe Technologies  HCL Technologies  Intuit  JP Morgan  Optimus Information  Faichi Solutions  Blip  Adobe  Subex Limited  Remo Software  Allstate  IBM  Bizmatics  Bytecode Cyber Security  Calsoft Systems  IDS Infotech      expert        frequent

Try 4 Question(s) Test


Very frequently asked in different variations. Frequently asked in Deloitte ( 2 feedback ) , HCL Tech ( 3 feedback ) and Coginizant (CTS)
  Q3. Explain the scenerios to choose between String , StringBuilder and StringBuffer ?

or

What is the difference between String , StringBuilder and StringBuffer ?
Core Java
Anonymous
Ans. If the Object value will not change, use String Class because a String object is immutable.

If the Object value can change and will only be modified from a single thread, use StringBuilder because StringBuilder is unsynchronized(means faster).

If the Object value may change, and can be modified by multiple threads, use a StringBuffer because StringBuffer is thread safe(synchronized).

  Sample Code for String

  Sample Code for StringBuffer

  Sample Code for StringBuilder

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

   Like      Discuss      Correct / Improve     java   string class   string   stringbuilder   stringbuffer     Cognizant (CTS)   San Jose State University (SJSU)  HCL Technologies   Deloitte  Sophos  Hitachi  JPMorgan Chase  IBM  Kony Labs  Keystone  ebay  TIAA Financial Services  Ancestry      basic        frequent

Try 3 Question(s) Test


Frequently asked to fresh graduates and less experienced developers. Among the first few questions in many interviews.
  Q4. What are the difference between composition and inheritance in Java?Core Java
Admin
info@buggybread.com
Ans. Composition - has-a relationship between classes.
Inheritance - is-a relationship between classes.

Composition - Composing object holds a reference to composing classes and hence relationship is loosely bound.
Inheritance - Derived object carries the base class definition in itself and hence its tightly bound.

Composition - Used in Dependency Injection
Inheritance - Used in Runtime Polymorphism

Composition - Single class objects can be composed within multiple classes.
Inheritance - Single class can only inherit 1 Class.

Composition - Its the relationship between objects.
Inheritance - Its the relationship between classes.

  Sample Code for inheritance

  Sample Code for composition

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

   Like      Discuss      Correct / Improve     java   java concepts   inheritance   composition   inheritance vs composition     HCL Technologies  Tata Consultancy (TCS)  Infosys  Amazon  Source Intelligence  News UK  Starmount  MapQuest  SalesForce  Expedia  Deegit  JP Morgan  Canva  Todle  Yodle  Berkley Net  Help Scout  Partners HealthCare  Doximity  Commvault  Heroku  Starmount  Help.com  healthcare system  TU Kaiserslautern      basic        frequent

Try 5 Question(s) Test


Frequently asked in Infosys and HCL Technologies ( Based on 2 feedback )
 Q5. What are different ways of object creation in Java ?Core Java
Admin
info@buggybread.com
Ans. Using new operator - new xyzClass()

Using factory methods - xyzFactory.getInstance( )

Using newInstance( ) method - (Class.forName(xyzClass))emp.newInstance( )

By cloning an already available object - (xyzClass)obj1.clone( )

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

   Like      Discuss      Correct / Improve     java   oops   object creation   new operator   class.forname   cloning   ebay     Intelligrape  Infosys  Polaris  British Telecom (BT)  Vyom Labs  Deutsche Bank  HCL Technologies      expert


Frequently asked question in companies using Hibernate.
  Q6. What is Lazy Initialization in Hibernate ?Hibernate
Admin
info@buggybread.com
Ans. It's a feature to lazily initialize dependencies , relationship and associations from the Database. Any related references marked as @OneToMany or @ManyToMany are loaded lazily i.e when they are accessed and not when the parent is loaded.

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

   Like      Discuss      Correct / Improve     hibernate   lazy loading hibernate   lazy initialization hibernate   architecture     overstock.com  BridgePoint Technologies  Medgate  Dex Media  Diversant  Tieto  Oracle  Bank of America Merrill LYNCH  NEC Japan  HCL Technologies      Basic        frequent

Try 2 Question(s) Test


Very frequently asked to Fresh graduates.
  Q7. What is the difference between Encapsulation and Abstraction?Core Java
Anonymous
Ans. 1.Abstraction solves the problem at design level while encapsulation solves the problem at implementation level

2.Abstraction is used for hiding the unwanted data and giving relevant data. while Encapsulation means hiding the code and data into a single unit to protect the data from outside world.

3. Abstraction lets you focus on what the object does instead of how it does it while Encapsulation means hiding the internal details or mechanics of how an object does something.

4.For example: Outer Look of a Television, like it has a display screen and channel buttons to change channel it explains Abstraction but Inner Implementation detail of a Television how CRT and Display Screen are connect with each other using different circuits , it explains Encapsulation.

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

   Like      Discuss      Correct / Improve     java   oops   oops concepts   encapsulation   abstraction   basic interview question     Synechron  Amazon  HCL Technologies  Tata Consultancy (TCS)  Wipro  Infosys Technologies  3DPLM Software Solutions      basic        frequent

Try 2 Question(s) Test


Very frequently asked. Favorite question in Walk in Drive of many Indian service companies. Frequently asked in HCL Technologies.
  Q8. What is the difference between final, finally and finalize() ?Core Java
Admin
info@buggybread.com
Ans. final - constant variable, objects cannot be de-referenced, restricting method overriding, restricting class sub classing.

finally - handles exception. The finally block is optional and provides a mechanism to clean up regardless of what happens within the try block. Use the finally block to close files or to release other system resources like database connections, statements etc.

finalize() - method helps in garbage collection. A method that is invoked before an object is discarded by the garbage collector, allowing it to clean up its state.

  Sample Code for final

  Sample Code for finally

  Sample Code for finalize

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

   Like      Discuss      Correct / Improve     java   oops   final   finally   finalize     Thomson Reuters  WITS  Antra  Jive  MorningStar  VanGuard   Alcatel Lucent  Morningstar  A9.com  EPAM  Nuance  SirsiDynix  NCR  VanGuard  Proofpoint Interview  Disney  Orbitz Worldwide  GFI Informatique  Canon  WITS  Simba Technologies  Marlabs  American Well  Global Relay  L&T Infotech  HCL Technologies  Tata Consultancy (TCS)  Wipro  Infosys  Accenture  Jive  Salesforce  Deegit  NTT DATA  Proofpoint  Morningstar  Bank Of America  Manhattan Associates  Optum  NorthPoint  Nok Nok Labs  Simba Technologies   Rhino Africa  Solutionreach  V Soft Consulting  EBay  Cognizant (CTS)  IBM  ExactTargetKewill  CV Holdings  Symphony  Cubic Web solutions  Star International  FatWire  Mindteck      basic        frequent

Try 4 Question(s) Test


Very frequently asked. Favorite question in Walk in Drive of many Indian service companies.
  Q9. Difference between TreeMap and HashMap ?Core Java
Anonymous
Ans. They are different the way their elements are stored in memory. TreeMap stores the Keys in order whereas HashMap stores the key value pairs randomly.

  Sample Code for treemap

  Sample Code for hashmap

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

   Like      Discuss      Correct / Improve     java   collections   map   treemap   hashmap     Amber Road  CTS (Cognizant)  ION Trading  DataMetica  Accenture  The Advisory Board Company  BidGely  Infosys  Tata Consultancy (TCS)  HCL Technologies  Wipro  Booking.com  MakeMyTrip  Garena Online  Garmin  ION Trading  Accuity  Palantir Technologies  Books International  Wealthfront  Marin Software  Garmin  IBM  Global Logic  Fiserv  Cumulus Systems  CCTS  UST Global      basic        frequent

Try 1 Question(s) Test



Do you think these are the Best Java Frameworks ?

OpenXavaSPRING MVCApache StripesCheck everything
that is Best in Java

Click Here



Very frequently asked across all types of companies.
  Q10. Difference between HashMap and Hashtable?Core Java
Anonymous
Ans. Hashtable is synchronized whereas HashMap is not.HashMap allows null values whereas Hashtable doesnt allow null values.

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

   Like      Discuss      Correct / Improve     java   collections   hashmap   map   hashtable   basic interview question   ebay   tcs    hcl technologies   infosys technologies     Morgan Stanley  Yahoo  Q3 Technologies  PriceLine  Solution Rally  Coupang  HCL Technologies  Tata Consultancy (TCS)   Infosys Technologies  Accenture India  JPMorgan Chase  Priceline.com      basic        frequent

Try 2 Question(s) Test


Very frequently asked. Favorite question in Walk in Drive of many Indian service companies.
  Q11. What is the difference between ArrayList and LinkedList ?Core Java
admin
info@buggybread.com
Ans. Underlying data structure for ArrayList is Array whereas LinkedList is the linked list and hence have following differences -

1. ArrayList needs continuous memory locations and hence need to be moved to a bigger space if new elements are to be added to a filled array which is not required for LinkedList.

2. Removal and Insertion at specific place in ArrayList requires moving all elements and hence leads to O(n) insertions and removal whereas its constant O(1) for LinkedList.

3. Random access using index in ArrayList is faster than LinkedList which requires traversing the complete list through references.

4. Though Linear Search takes Similar Time for both, Binary Search using LinkedList requires creating new Model called Binary Search Tree which is slower but offers constant time insertion and deletion.

5. For a set of integers you want to sort using quicksort, it's probably faster to use an array; for a set of large structures you want to sort using selection sort, a linked list will be faster.

  Sample Code for ArrayList

  Sample Code for LinkedList

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

   Like      Discuss      Correct / Improve     collections   java   data structures   arraylist   linkedlist     Deutsche Bank  Overstock.com  HCL Technologies  Infosys  EBay  The Advisory Board Company  Accuity  JC Penney  Cerner  Chase  Amazon  Deloitte  Deegit  Tata Consultancy  Cognizant (CTS)  IBM  Accenture  Mindtree  ESRI  QwikCilver Solutions  TMC Bonds  GumGum  EMC  Yelp  Classteacher Learning System  FactSet  Simply Hired  SalesForce  Royall & Company  Indeed  eClinicalWorks  TravelClick  State Farm  Manhattan Associates  GoEuro  Veeva Systems  Ness Technologies  Marlabs  Rolta  Volante Technologies  Happiest Minds Technologies  Coviam  Velocify  zanox  SimplyHired  IDBI Intech  Wissen Infotech  Nike  OnDot  PexSupply  Pramati Technologies  Credit Agricole  Mastek  Six Dee Telecom  Accuity  Kellton Tech      Basic        frequent

Try 1 Question(s) Test


 Q12. Which keyword is used to provide explicit access of a code block to single thread ?

a. Transient
b. Final
c. Explicit
d. Synchronized
Core Java
Anonymous
Ans. Synchronized

  Sample Code for Synchronized

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

   Like      Discuss      Correct / Improve     java   threads   multithreading     Infoview  HCL Technologies      basic


  Q13. What is a String Pool ?Core Java
Anonymous
Ans. String pool (String intern pool) is a special storage area in Java heap. When a string is created and if the string already exists in the pool, the reference of the existing string will be returned, instead of creating a new object and returning its reference.

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

   Like      Discuss      Correct / Improve     java   oops   string   string class   string pool   heap memory     SAS Institute  Ariba  GuideWire  Harbinger  Oracle  Virtusa  Knoa  Polaris  GuideWire  HCL Technologies  Tata Consultancy (TCS)  Infosys  Technologent  MphasiS  Harbinger Group  Kony  Evergent  NTT Data  VMware  Markit  Ariba  Tech Mahindra  Bureau Veritas  InfoStretch  PTC Software  Mindtree  Centre for Internet and Society (CIS)  Trimax IT Infrastructure & Services      intermediate        frequent

Try 2 Question(s) Test


Very Frequently asked to fresh graduates and less experienced. Favorite question in Walk in drives.
  Q14. Difference between Overloading and Overriding ?Core Java
Anonymous
Ans. Overloading - Similar Signature but different definition , like function overloading.

Overriding - Overriding the Definition of base class in the derived class.

  Sample Code for overloading

  Sample Code for overriding

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

   Like      Discuss      Correct / Improve     java   oops   overloading   overriding   oops concepts   basic interview question     PC Technology  Cognizant (CTS)  Donlen   hybris Software  RedMane  Allerin Technologies  Gemalto  Allerin Technologies  HCL Technologies  Tata Consultancy (TCS)  Accenture India  Infosys Technologies  Polaris  United Healthcare India  IBM India  Xchanging  American Express  Antra  Flipp  Computer Sciences Corporation (CSC)  Garmin  NetSuite  Donlen  Hudsons Bay  Techlogix  SevOne  Synactive  Oodles Technologies  FDM Group  Marlabs  RedMane Technology  Faichi Solutions  TD  Tech Mahindra  Shutterfly  Luxoft  PC Technology  CCC Information Services  State Farm  Raja Software  Mastek  EPAM  Morgan Stanley  SummitWorks  Sony  Citibank  Emtec  LowerMyBills  Consilience  Xavor  AllState  FasTrak  AmTrust Financial  Walt Disney  Ultramain Systems  International Turnkey Systems  Knoldus Software  CA Technologies  Amdocs  FDM Group  Hybris  Fidelity  United Health Group (UHG)  Bluewhale Solutions  Pegasystems  Revature   Innoplexus  Vanguard  AptSource  Perficient  Grapecity  Subex  QuintilesIMS  NimbleUser  Expeditors Associate  Sapient  HR Cloud  Summitworks  Jabong.com  Kony Labs  Price Waterhouse Coopers (PWC)      basic        frequent

Try 1 Question(s) Test


  Q15. Difference between Vector and ArrayList ?Core Java
Anonymous
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     Oracle  Lab49  Infosys  Wipro  Zoho  HCL Technologies  Tata Consultancy (CTS)  BirlaSoft  Emory  Xplana  British Telecom (BT)  Apex Systems  Capgemini  Accenture  3dplm Software Solution  AppKnox  eIntern  Landmark Information Group  ESystems  Orbitz Worldwide  HARMAN  Starmount  iConsultus  KARYA Technologies  Smart Chip  Cuelogic Technologies  Kronos  Trigent Software  Deloitte  ACI Worldwide  Unisys  Tavant Technologies  Referance data      basic        frequent


 Q16. What are the contents of Hibernate configuration file ( hibernate.cfg.xml ) ?Hibernate
Admin
info@buggybread.com
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     Mphasis  Mccoy Global Links  Availity  Infosys  GlobalLogic  Cognizant (CTS)  Overstock.com  Erricson  Erricson India  HCL Technologies  Tata Consultancy (TCS)


Very Frequently asked. Have been asked in HCL Technologies very frequently ( based on 2 feedback ). Among first few questions in many interviews.
  Q17. Differences between abstract class and interface ?Core Java
Admin
info@buggybread.com
Ans. Abstract classes can have both abstract methods ( method declarations ) as well as concrete methods ( inherited to the derived classes ) whereas Interfaces can only have abstract methods ( method declarations ).

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

   Like      Discuss      Correct / Improve     java   classes   abstract class   interfaces     GlobalLogic  HCL Technologies  Tata Consultancy (TCS)  Infosys  Wipro  Mindtree  CapitalOne  Accenture  IBM India  Infoview Technologies  Salesforce  AT&T  United Health Group (UHG)  Verilogue  Amazon  Expeditors  Syntel  SalesForce  Cornerstone OnDemand  Expedia  OLA  NSF International  Copper Mobile  Think Future Technologies  MorphoTrust  Global Healthcare  Prodigious  Internet Brands  SciQuest  arvato Systems  iCIMS  Ideas2IT  virtusa polaris  Vitech Systems  Cognizant (CTS)      basic        frequent


Almost sure to be asked in every company using any Dependency Injection framework ( Spring, Guice etc )
  Q18. What is Dependency Injection or IOC ( Inversion of Control ) ?Design

Ans. It is a Design Pattern that facilitates loose coupling by sending the dependency information ( object references of dependent object ) while building the state of the object. Objects are designed in a manner where they receive instances of the objects from other pieces of code, instead of constructing them internally and hence provide better flexibility.

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

   Like      Discuss      Correct / Improve     design patterns   ioc ( Inversion of Control )  dependency injection     Nucleus Software Exports  HCL Technologies  Tata Consultancy (TCS)  HCL  Infosys  Cognizant (CTS)  Barclays  General Electric  Infosys Technologies  Elsevier  Sabre  ZapCom  Nike  Sogeti  CSG International  Lowes  DWS  Mitsui Bussan Logistics  Payment Processing Partners  Liquidnet  AmTrust Financial  VectorForm  Cybage  Vanderbilt University  Cigniti  Accenture  Ball Aerospace  GE Healthcare  1-800 Contacts  VinSolutions  Arrow Electronics  Monitise  Avenue Code  Thetus Corporation  Shodogg  Levi9  BuildLinks  Suyati Technologies  Kanerika Software  Alliance Inspection Management  Promega  Victorious  Zoll Data Systems  Parkmobile  PerceptiMed  Crate and Barrel  Carbonite  Concur  Codazen  GlobalLogic  AccuSoft  Attinad  Tillster  AppRiver  TrustPilot  Pearson  Kony  Art Technology Group  VeriSign  Accion Labs  IGS Energy  National Bankruptcy Services  RealPage  Green Dot  Indecomm Global  bebo Technologies  Open Solutions  Xoriant  NCR  Macmillan Cancer Support  NetSuite  Asynchrony Labs  DealDash  Vizio  Fiserv  Federal Reserve Bank of Minneapolis  Tinder  FICO  Trustwave      intermediate        frequent


Frequently asked. Among first few questions in the J2EE segment of interview.
  Q19. What is the use of deployment descriptor ?Java EE2016-06-04 22:46:40

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     The NewBury Corp  Fast Dolphin  uCertify  General Electric  Cognizant (CTS)  Web coop  HCL Technologies  Tara Consultancy (TCS)  Wipro  Infosys  Cognizant (CTS)  Sonatype  IBM  computer science corporation (CSC)      basic        frequent

Try 1 Question(s) Test



Do you think these are the Best Java Frameworks ?

OpenXavaSPRING MVCApache StripesCheck everything
that is Best in Java

Click Here



Basic and Very Frequently asked.
  Q20. What is Polymorphism in Java ?Core Java2016-11-06 09:10:54

Ans. Polymorphism means the condition of occurring in several different forms.

Polymorphism in Java is achieved in two manners

1. Static polymorphism is the polymorphic resolution identified at compile time and is achieved through function overloading whereas

2. Dynamic polymorphism is the polymorphic resolution identified at runtime and is achieved through method overriding.

  Sample Code for overloading

  Sample Code for overriding

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

   Like      Discuss      Correct / Improve     polymorphism  oops concepts     Credit Suisse  Unbounded Solutions  Microsoft   Google  Purch  HCL Technologies  Tata Consultancy (TCS)  Wipro  Mathworks  Accenture  ZonOff  ZapCom  Addteq  Priceline.com  Acute Informatics  Trimax IT Infrastructure & Services   USAA      Basic        frequent

Try 2 Question(s) Test


  Q21. What are Inner , Outer , Left and Right Joins in SQL ?Database2017-01-09 13:07:55

Ans. Inner join is the intersection of two tables on the condition defined by the where clause i.e will get records from both tables matched by a column.

Outer join is the union of two tables i.e will get all records from both tables and will put null in the columns where related records are not present.

Left Outer join is the left union of two tables i.e all records from the table on the left and values from the right table for related records else null for the columns from right table.

Right Outer join is the right union of two tables i.e all records from the table on the right and values from the left table for related records else null for the columns from left table.

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

   Like      Discuss      Correct / Improve     sql  inner join  outer join  right join  left join     EPAM  Antra  MSCI  HCL Technologies  Cognizant (CTS)  Morgan Stanley  Wipro  Infosys  Accenture  IBM  PayPal  A9.com  Curriculum Associates  Gold Coast IT  Kobie Marketing  Hybris  Aptroid Technologies  E2open  IGATE  SnapDeal  Verilogue  Span Infotech      basic        frequent


 Q22. Can we have multiple main methods in a single class ?Core Java2017-01-12 11:00:02

Ans. We can overload the main method by specifying different argument types. For example -

2 main methods with different arguments is perfectly legal

public static void main();
public static void main(String[] args);

The following are not legal as compiler will complain of duplicate methods

public static void main(String[] args);
public static void main(String[] args);

Even The following are not legal as we cannot overload on return types

public static String main(String[] args);
public static void main(String[] args);

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

   Like      Discuss      Correct / Improve     main method     HCL Technologies  SapientNitro


 Q23. Which elements of a class are ignored during serialization ?Core Java2017-01-12 11:08:21

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     HCL Technologies      intermediate        frequent

Try 1 Question(s) Test


 Q24. Can we declare static variables as transient ?Core Java2017-01-12 11:12:48

Ans. It's weird that compiler doesn't complain if we declare transient with static variable because it makes no sense. At least a warning message saying "transient is useless in this situation" would have helped with code cleaning.

Static variables are never serialized and transient is an indication that the specified variable shouldn't be serialized so its kind of double enforcement not to serialize.

It could be that as it makes no different to the variable behavior and hence using both keywords with a variable are permitted.

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

   Like      Discuss      Correct / Improve     static  transient  serialization     HCL Technologies      expert        rare

Try 1 Question(s) Test


  Q25. What are the different types of inner classes ?Core Java
Anonymous
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     Infosys  Tata Consultancy (TCS)  HCL Technologies  IBM  IBM India  Gateway Media      basic        frequent

Try 1 Question(s) Test


Very Frequently asked across all type of companies and across all levels.
  Q26. Difference between Public, Private, Default and Protected ?Core Java
Anonymous
Ans. Private - Not accessible outside object scope.

Public - Accessible from anywhere.

Default - Accessible from anywhere within same package.

Protected - Accessible from object and the sub class objects.

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

   Like      Discuss      Correct / Improve     java   oop   access specifier   public   private   default   protected   basic interview question     HCL Technologies  Tata Consultancy (TCS)  IBM  Wipro  Deegit  Argonne National Laboratory  Motorola Mobility  Accenture  Deegit  Cerner      basic        frequent

Try 1 Question(s) Test


Very frequently asked. Favorite question in Walk in Drive of many Indian service companies.
  Q27. What is a Final Variable ?Core Java
Anonymous
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     IBM  Goldman Sachs  TrueCar  Intertek  RedMane  Antra  HCL Technologies  Tata Consultancy (TCS)  Accenture  Forte Group  Mastercard      basic        frequent

Try 1 Question(s) Test


Very frequently asked. Favorite question in Walk in Drive of many Indian service companies.
  Q28. What is a final method ?Core Java
Anonymous
Ans. Its a method which cannot be overridden. Compiler throws an error if we try to override a method which has been declared final in the parent class.

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

   Like      Discuss      Correct / Improve     java   oops   final   final method     Oracle  Intertek  HCL Technologies  Tata Consultancy (TCS)  Accenture   IBM  Goldman Sachs   TrueCar   Intertek RedMane   Antra      basic        frequent

Try 1 Question(s) Test


  Q29. What is casting?Core Java
Anonymous
Ans. There are two types of casting, casting between primitive numeric types and casting between object references. Casting between numeric types is used to convert larger values, such as double values, to smaller values, such as byte values. Casting between object references is used to refer to an object by a compatible class, interface, or array type reference

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

   Like      Discuss      Correct / Improve     java   data types   casting   basic interview question     Mindtree  HCL Technologies  Wipro  Tata Consultancy (TCS)  Infosys  KPMG      basic        frequent



Do you think these are the Best Java Frameworks ?

OpenXavaSPRING MVCApache StripesCheck everything
that is Best in Java

Click Here



Frequently asked question for intermediate developers.
  Q30. What is Volatile keyword used for ?Core Java
Anonymous
Ans. Volatile is a declaration that a variable can be accessed by multiple threads and hence shouldnt be cached.

  Sample Code for volatile

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

   Like      Discuss      Correct / Improve     java   oops   synchronization   volatile   java keywords     ABC Ltd   Ciena  Xchanging  Square  Infoview Technologies  HCL Technologies  EPAM  GrubHub  TeleMessage  TRUSTe  Informatica  Square  Medidata Solutions  Yellow Pages  eQ Technologic  Sutra Analytics  CustomerXPs  Globant  BB Holdings  Rakuten  Booking.com  BlackRock  Qualcomm  LSI Corporation  ARM Holdings  SpaceX  Toshiba  Peapod  Amadeus  Apptio  Tivo  EchoStar  HomeAway  Syscom Technologies  Aversan  Symantec  Samsung India  Axtria  Qualcomm  CGI Group      intermediate        frequent

Try 1 Question(s) Test


  Q31. What is Serialization ? Why do we need it ?Core Java
Anonymous
Ans. Storing the state of an object in a file or other medium is called serialization.

Classes can communicate only if they are built together ( as they need Byte code for communication ). What if we need to enable communication between different applications ( i.e they have been built independently or even they reside at different locations ), We need a mechanism that will transfer the Bean state to a Medium than can be transferred to the receiving application.

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

   Like      Discuss      Correct / Improve     java   oops   serialization     Computer Sciences Corporation (CSC) India   Tieto  Uproar  Priceline.com  HCL Technologies  Cognizant (CTS)      basic        frequent

Try 1 Question(s) Test


Very Frequently asked.Favorite question in Walk in drive for many Indian service companies.
 Q32. What is a Final Class ?
Anonymous
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     HCL Technologies  Tata Consultancy (TCS)  Infosys      basic        frequent


Very frequently asked.Usually among first few questions.
  Q33. What is MVC ? Design
Anonymous
Ans. The Model/View/Controller pattern, a strategy for dividing responsibility in a GUI component.

The model is the data for the component.

The view is the visual presentation of the component on the screen.

The controller is responsible for reacting to events by changing the model.

According to the MVC pattern, these responsibilities should be handled by different objects.

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

   Like      Discuss      Correct / Improve     j2ee   mvc   mvc design pattern   design pattern   struts   spring   web application   web frameworks   ebay     HCL Technologies  Tata Consultancy (TCS)  Wipro  United Health Group (UHG)  Accenture  Fidelity  Fidelity Investments   Tieto  Walt Disney  Sharon Software Systems  Tech Mahindra  Amdocs  Deegit  Lexis Nexis  Elsevier      basic        frequent

Try 1 Question(s) Test


  Q34. Write a method to check if input String is Palindrome?Core Java
Admin
info@buggybread.com
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     HCL Technologies  Hootsuite  ebay  Mobile Apps Company  TripAdvisor  Wallet Hub  Groupon  OpenText  Airbnb  Vantiv  Minted LLC  Boston Analytics  mint.com  Arista Networks  Dealer.com  the Zappos Family  Sony PlayStation  Taser  Wolters Kluwer  Wize Commerce  Hitachi Consulting  Quickr  SmartBrief  Liaison International  Monitise  Exilant Technologies  Enova  Wayfair  Amadeus  MakeMyTrip  Naggaro  Vudu  OnDeck Capital  HighRadius   thePlatform  Trimax IT Infrastructure & Services      Basic        frequent


Very frequently asked in HCL Tech ( Based of 4 inputs )
 Q35. Write a program to reverse a string iteratively and recursively ?Core Java
Admin
info@buggybread.com
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     HCL Technologies  Exelis  Mahindra Comviva  Fidelity National Information Services (FIS)        frequent


Very frequently asked in companies using SOA.
  Q36. What are RESTful Web Services ?Rest
Admin
info@buggybread.com
Ans. REST or Representational State Transfer is a flexible architecture style for creating web services that recommends the following guidelines -
1. http for client server communication,
2. XML / JSON as formatiing language ,
3. Simple URI as address for the services and,
4. stateless communication.

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

   Like      Discuss      Correct / Improve     java   web services   rest   java   j2ee  architecture     Synechron  CapitalOne  Overstock.com  Ebay  At&t  HCL Technologies  Barclays  Tata Consultancy (TCS)  Cognizant (CTS)  Wipro  Infosys  EPAM  Mphasis      intermediate        frequent


Very frequently asked if being interviewed for hibernate. Frequently asked in Tata Consultancy (TCS) and Overstock.com
  Q37. Difference between load and get ?Hibernate
Admin
info@buggybread.com
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     Overstock.com  Nagarro  Anthem  Tata Consultancy (TCS)  Nucleus Software Exports  CDK Global  Dell  Capgemini  Persistent Systems  HCL Technologies  Nagarro  Sears  CDK Global  Oracle  Nucleus Software Exports  CACI International      basic        frequent


 Q38. Can we use static method definitions in Interfaces ?Core Java
Admin
info@buggybread.com
Ans. Yes, Effective Java 8.

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

   Like      Discuss      Correct / Improve     java   java8   static interface methods   yes-no     HCL Technologies


 Q39. Difference beween HashSet and TreeSet ?Core Java2016-11-27 19:08:35

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     HCL Technologies  AppKnox  Pramati Technologies  Mist Minds Technologies      Basic        frequent

Try 1 Question(s) Test



Do you think these are the Best Java Frameworks ?

OpenXavaSPRING MVCApache StripesCheck everything
that is Best in Java

Click Here



 Q40. Explain OOPs Core Java2017-06-13 08:25:45

Ans. OOPs or Object Oriented Programming is a Programming model which is organized around Objects instead of processes. Instead of a process calling series of processes, this model stresses on communication between objects. Objects that all self sustained, provide security by encapsulating it's members and providing abstracted interfaces over the functions it performs. OOP's facilitate the following features

1. Inheritance for Code Reuse
2. Abstraction for modularity, maintenance and agility
3. Encapsulation for security and protected
4. Polymorphism for flexibility and interfacing

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

   Like      Discuss      Correct / Improve     oops  oops features     Trimax IT Infrastructure & Services  Aricent  HCL Technologies   Tata Consultancy (TCS)  Infosys      basic        frequent


Frequently asked in Tech Mahindra ( Based on 3 inputs )
  Q41. What is the difference between List, Set and Map ?Core Java
Anonymous
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     Cognizant (CTS)  Ebay   Infosys   HCL Technologies   Tech Mahindra  Cumulus Systems  Mindteck      basic        frequent

Try 1 Question(s) Test


Frequently asked at HCL Technologies ( Based on 3 feedback )
  Q42. Difference between Checked and Unchecked exceptions ?Core Java
Anonymous
Ans. Checked exceptions and the exceptions for which compiler throws an errors if they are not checked whereas unchecked exceptions and 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   basic interview question     Verilogue  F5 Network  Pegasystems  PegaSystems  SAP  Ciber  Conde Nast  Pramati Technologies  IBM  JP Morgan  HCL Technologies  Tata Consultancy (TCS)  Cognizant (CTS)  Cogent Infotech  MarketAxess  defense group  NETS INTERNATIONAL  Accenture  Integra Micro  ColdLight Solutions  Endeavor      basic        frequent

Try 1 Question(s) Test


Frequently asked.
  Q43. What is an Iterator?Core Java
Anonymous
Ans. Iterator is an interface that provides methods to iterate over any Collection.

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

   Like      Discuss      Correct / Improve     java   collections   iterator     Magic Software  Maverick Software  Wipro  IBM  HCL Technologies  Tata Consultancy (TCS)  Cognizant (CTS)  Wipro  Accenture      basic        frequent


Frequently asked in CTS ( Based on 2 feedback )
  Q44. What is the difference between comparable and comparator in java.util pkg?Core Java
Admin
info@buggybread.com
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     Verilogue  Accenture  Varian Medical Systems  L&T Infotech  Oracle  eIntern  Happiest Minds Technologies  HCL Technologies  Cognizant (CTS)  Cerner  Coviam  EdgeVerve Systems  Virtusa Polaris  Trimax IT Infrastructure & Services      basic        frequent


Very Frequently asked Spring question.
  Q45. What is bean auto wiring?Spring
Admin
info@buggybread.com
Ans. The Spring container is able to autowire relationships between collaborating beans. This means that it is possible to automatically let Spring resolve collaborators (other beans) for your bean by inspecting the contents of the BeanFactory without using and elements.

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

   Like      Discuss      Correct / Improve     j2ee   spring   mvc   frameworks   web applications   autowiring   beans   at&t   ge     Infosys  HCL Technologies  Tata Consultancy  Wipro  PwC  Tech Mahindra  AT&T  General Electric  Sophos        frequent


 Q46. Why String is popular HashMap key in Java?Core Java
Admin
info@buggybread.com
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   hashmap   immutable   hashcode   hash code   advanced     TD Bank  HCL Technologies      expert        frequent


Very Frequently asked. Favorite question in walkins and telephonic interviews. Usually among first few questions. Asked in different variants. Must know for intermediate and expert professionals.Among Top 10 frequently asked questions.
  Q47. What is rule regarding overriding equals and hashCode method ?Core Java
Admin
info@buggybread.com
Ans. A Class must override the hashCode method if its overriding the equals method.

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

   Like      Discuss      Correct / Improve     java   collections   hashcode  hash code   equals   collections     Cognizant (CTS)  CapitalOne  Tata Consultancy (TCS)  HCL Technologies  Deloitte  Wipro  Infosys  Sabre  Sophos   Tieto  Addteq  Priceline.com  Cisco Systems  Visa Inc  Vibrant Media  Audience Science  GT Nexus  OpenCrowd  Instinet  Kronos  Elsevier  IMC Financial  LG Mobile  Dun & Bradstreet  WBUT  codecentric  Satmetrix  Interactive Brokers  Roposo  SecureView  Azuga  Envestnet  Criteo  Skillz  MobileIron  Walmart  R Systems  Overstock.com  Verilogue  Goldstone Technologies  FatWire  LinkedIn  Southwest Airlines      intermediate        frequent

Try 1 Question(s) Test


Very frequently asked Hibernate interview question.
  Q48. What are different types of associations in Hibernate ?Hibernate
Admin
info@buggybread.com
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     Overstock.com  BirlaSoft  Fiserv  Overstock.com  Tata Consultancy (TCS)  Wipro  Tech Mahindra  Infosys  HCL Technologies  Fidelity  Sabre        frequent


Very frequently asked. Usually followed by questions related to private constructor and synchronized access. Frequently asked in JPMorgan (Based on 2 feedback)
  Q49. Explain Singleton Design Pattern ?Design
Admin
info@buggybread.com
Ans. http://www.buggybread.com/2014/03/java-design-pattern-singleton-interview.html

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

   Like      Discuss      Correct / Improve     java   design pattern   singleton   at&t   ebay  fidelity india  united healthcare india     JP Morgan  Tata Consultancy (TCS)  HCL Technologies  Wipro  Infosys  Tibco  Edline  JPMorgan Chase  Sabre  Bank Of America India  Fidelity  Samsung India  Robert Bosch India  ZapCom  Goldman Sachs India  Eze Software  ZapCom  Dailymotion  Netflix  CenturyLink  Misfit  TSYS  ECI Telecom  Dealogic  Robert Bosch  Redolent  EFI  CSX  Prolific  Validus  Birlasoft  AdNovum  NCR  Ray Business Technologies  Nagravision  Unify  SLK Group  DBS Bank   Razorthink  GST Global      intermediate        frequent



Do you think these are the Best Java Frameworks ?

OpenXavaSPRING MVCApache StripesCheck everything
that is Best in Java

Click Here



  Q50. Difference between jar , war and ear ?Java EE
Admin
info@buggybread.com
Ans. Jar is Java Archieve i.e compressed Class or Class / Java files.

War comprises of compressed Servlet class files,JSP FIles,supporting files, GIF and HTML files.

Ear comprise of compressed Java and web module files ( was files ).

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

   Like      Discuss      Correct / Improve     java   j2ee   jar   web development   war   ear   build management   release management     Sirius Computer Solutions  HCL Technologies  Wipro  Deloitte  Tech Mahindra  eGain  Southwest Airlines  Aveiro  Accenture  MIMOS Berhad      basic        frequent


  Q51. Explain Application / Server architecture being used in your project ?
Admin
info@buggybread.com
Ans. We are using cluster of Web servers and Application servers. Load Balancer is used to manage the load between them. Down the layer we have middleware server and then DB server to access database.

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

   Like      Discuss      Correct / Improve     architecture   production support   java   servers   application support     Tata Consultancy (TCS)  HCL Technologies  IBM  Overstock.com  Choice Hotels  Amdocs        frequent


  Q52. Explain the challenging problems you faced recently and how you overcame it ?General

Ans. [Open Ended Answer]

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

   Like      Discuss      Correct / Improve     elsevier   open ended questions   overstock.com   cerner     Overstock.com  Elsevier  Infoview Technologies  Syntel  Hexaware  Yahoo  Nationwide  GE Transportation  Concur  MH Alshaya  Infosys  Capital One  HCL Technologies  Ann Arbor  PowerAdvocate        frequent


Must know at all levels. Among Top 10 frequently asked questions in Java. Very frequently asked to fresh graduates or less experienced professionals.
  Q53. What is Inheritance ?Core Java

Ans. Its a facility for code reuse and independent extension wherein a derived class inherits the properties of parent class.

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

   Like      Discuss      Correct / Improve     inheritance  oops concepts  java concepts  code reuse  code re-use   classes  derived classes     Maverick Software  Infosys  HCL Technologies  Tata Consultancy (TCS)  Cognizant (CTS)  Myntra  Capital One  Barclays  Accenture  Infoview Technologies  Wipro      basic        frequent


Frequently asked question in companies using Rest Web services.
 Q54. Different between POST and PUT in Rest Rest2016-07-22 14:33:40

Ans. PUT requests are only meant to place the object as it is on server. For example - You want a file to be uploaded and then placed in a particular folder or you want an Employee object to be persisted in the table.

POST requests are also meant to transfer information from client to server but that information once received at the server is evaluated , modified or refactored before persisting.

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

   Like      Discuss      Correct / Improve     Put vs Post   Rest     overstock.com  HCL Technologies  Tata Consultancy (TCS)  Tech Mahindra  Indra        frequent


 Q55. What are the benefits of Enums ?Core Java2016-09-07 09:05:01

Ans. Enums in Java are used to declare predefined objects and then reuse them. they offer many benefits

1. Enum instance are type safe and thread safe.

2. Enum instances are singleton and hence reused.

3. If we use Enums with Switch , It makes sure that the passed argument is either of its instance and hence provides a safeguard.

4. If we use Enum with Sorted Collections we can sort the elements with a predefined priorities ( as per constant declaration in enum )

5. We can use Enum as a Factory by defining its constructor.

6. We can store related constant data within enum. For example - If we know the values for the map upfront, we can alternatively use an enum.

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

   Like      Discuss      Correct / Improve          Sapient  HCL Technologies  Tata Consultancy (TCS)  Cognizant (CTS)  Accenture


 Q56. How to Bulk upload the data into Oracle database?Database2016-10-21 12:36:26

Ans. We can use external table feature of Oracle.

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

   Like      Discuss      Correct / Improve          HCL Technologies      Intermediate


Frequently asked Design Pattern interview question.
 Q57. What is a prototype design pattern ?Design2016-11-04 08:06:01

Ans. The prototype pattern is a creational design pattern. It is used when the type of objects to create is determined by a prototypical instance, which is cloned to produce new objects. Prototype is used when we need duplicate copies of objects.

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

   Like      Discuss      Correct / Improve     design pattern  prototype design pattern     CapitalOne  Orion Edutech  Harris  Myntra  Tata Consultancy (TCS)  HCL Technologies  Infosys  Wipro  Tech Mahindra  IBM  Mahindra Satyam      intermediate


  Q58. What is coupling and Cohesion ?Design2016-11-15 16:16:10

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     State Farm  EPAM  Vanguard  Incedo  Maverick  B2 Solutions  At&T  Datto  HCL Technologies  Xactly        frequent


Very Frequently asked to Senior Software Engineers or Developers.
  Q59. Describe some of the Design Patterns you have used ?Design2016-12-01 16:31:17

Ans. [Open Ended Answer]

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

   Like      Discuss      Correct / Improve     design patterns     Goldman Sachs  Lexis Nexis  Elsevier  HCL Technologies  Tata Consultancy (TCS)  Infosys Technologies  Fidelity Investments  Nucleus Software Exports  General Electric  Cognizant (CTS)  Amdocs  MathWorks  Xebia  Goldstone technologies  Horizon Solutions  ECI Telecom      intermediate        frequent



Do you think these are the Best Java Frameworks ?

OpenXavaSPRING MVCApache StripesCheck everything
that is Best in Java

Click Here



 Q60. What will be the crontab to run a job every last day of month ?Unix2016-12-16 09:34:26

Ans. 59 23 28-31 * * [ "$(date +%d -d tomorrow)" = "01" ] && job_name

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

   Like      Discuss      Correct / Improve     unix  crontab     HCL Technologies


 Q61. Write a unix command to find top 10 files by size ?Unix2016-12-16 09:35:31

Ans. du -a /var | sort -n -r | head -n 10

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

   Like      Discuss      Correct / Improve     unix command     HCL Technologies


 Q62. What are fields that gets displayed when you execute "Top" command and briefly explain each field ?Unix2016-12-16 09:41:47

Ans. PID - process identification number is an identification number that is automatically assigned to each process when it is created

USER - User Name

PR - PR is the process actual priority

NI is the nice value, which is a user-space concept.

VIRT -Virtual Image (kb). The total amount of virtual memory used by the task.

RES - Resident size (kb). The non-swapped physical memory a task has used.

SHR - Shared Mem size (kb). The amount of shared memory used by a task.

S - Process Status. The status of the task which can be one of:

D = uninterruptible sleep
R = running
S = sleeping
T = traced or stopped
Z = zombie

%CPU - % CPU usage

%MEM - % MEM Usage

TIME - Total CPU time the task has used since it started.

COMMAND - Command which was used to execute the process

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

   Like      Discuss      Correct / Improve     top command  unix command     HCL Technologies


  Q63. What is an exception and exception handling in Java ?Core Java2017-01-09 13:01:40

Ans. An Exception in java is the occurrence during computation that is anomalous and is not expected.

Exception handling is the mechanism which is used to handle such situations.


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

   Like      Discuss      Correct / Improve     exception handling     EPAM  Deloitte  Choice Hotels  Future Group  Cognizant (CTS)  Wipro  Infosys  HCL Technologies  Accenture  Amdocs  IBM  Ultramain Systems      basic        frequent


 Q64. Scale yourself on Java on the scale of 1 to 10General2017-01-11 15:48:29

Ans. [Open Ended Answer]

The objective of the question is to check how efficient one is in the language so that appropriate level questions are asked. Don't tell too high number if you are being interviewed for a junior or mid level position as the interviewer may throw advance level questions.

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

   Like      Discuss      Correct / Improve          Overstock.com  Revature  Incture Technologies  Nucsoft  Wipro  HCL Technologies  Tata Consultancy (TCS)  Infosys  Cerner  Nucsoft  Incture Technologies  macys  F5 Networks  IVY Comptech  Rubicon Project  Sogeti  AllState


 Q65. Which environment variables do we need to set in order to run Java programs?Core Java2017-01-12 10:55:08

Ans. PATH, CLASSPATH and JAVA_HOME

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

   Like      Discuss      Correct / Improve     environment variables  path  classpath  java_home     QUADRATIC SYSTEMS  Computer sciences corporation (csc)  HCL Technologies      basic        frequent


 Q66. Can an application have multiple main methods within different classes ? If yes, How will the app decide which one to be executed ?Core Java2017-01-12 10:56:40

Ans. Yes we can have a main method with string[] argument in every class of an application. When we execute an app we specify the starting point i.e the class that will get the control first and hence main method of that class gets executed.

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

   Like      Discuss      Correct / Improve     main method     HCL Technologies  Aspire Systems  SapientNitro


 Q67. Does importing a package imports all its sub packages too ?Core Java2017-01-12 11:02:13

Ans. No, but we can use wild card (*) to do so

For example -

import java.util.*

will import all packages with name starting with java.util

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

   Like      Discuss      Correct / Improve     package   import packages     HCL Technologies      basic


 Q68. Is it a good practice to use Asterick(*) in import statement to load multiple packages with single import statement ?Core Java2017-01-12 11:04:19

Ans. No, we should be lean in loading only packages which are required. Loading packages which are not being used result in memory overheads.

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

   Like      Discuss      Correct / Improve     import  import packages     HCL Technologies


 Q69. What is the default value of a declared object reference ?Core Java2017-01-12 11:05:03

Ans. Null

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

   Like      Discuss      Correct / Improve     object reference  null     HCL Technologies      basic



Do you think these are the Best Java Frameworks ?

OpenXavaSPRING MVCApache StripesCheck everything
that is Best in Java

Click Here



 Q70. Is there a way to know size of an object in Java ?Core Java2017-01-12 11:14:59

Ans. No, Java doesn't have a sizeOf operator. In C / C++ , its required to determine how much memory allocation is required which is not the case with Java. Java handles memory allocation and deallocation intrinsically.

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

   Like      Discuss      Correct / Improve     sizeOf  size of object     HCL Technologies        rare


 Q71. What are the different ways to handle an exception ?Core Java2017-01-12 11:17:53

Ans. 1. Wrap the desired code in try block followed by a catch / finally to catch the exception

2. Declare the throws clause with exceptions that the code is expected to throw as an indication to the calling method to take care of it.

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

   Like      Discuss      Correct / Improve     exception handling     HCL Technologies  Wipro  Mindtree  HeadStrong

Try 1 Question(s) Test


 Q72. How does Java handle integer overflows and underflows?Core Java2017-01-12 11:18:41

Ans. It uses those low order bytes of the result that can fit into the size of the type allowed by the operation.

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

   Like      Discuss      Correct / Improve     integer  data types     HCL Technologies        rare


 Q73. Is delete a keyword in Java ?Core Java2017-01-12 11:20:42

Ans. No, delete is not a keyword in Java. Destruction of objects is taken care by Java Garbage Collection mechanism.

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

   Like      Discuss      Correct / Improve     delete  keywords     HCL Technologies


 Q74. Is exit a keyword in Java ?Core Java2017-01-12 11:21:28

Ans. No exit is a method to exit execution of a program.

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

   Like      Discuss      Correct / Improve     exit  keywords  exit a program     HCL Technologies


 Q75. Who invokes a thread's run method ?Core Java2017-01-12 11:23:15

Ans. After a thread is started using a call to start method, JVM invokes the thread’s run method when the thread is initially executed.

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

   Like      Discuss      Correct / Improve     threads  thread run method     HCL Technologies


 Q76. How and Why Strings are interned in Java ?Core Java2017-01-25 11:00:00

Ans. String class has a public method intern() that returns a canonical representation for the string object. String class privately maintains a pool of strings, where String literals are automatically interned.

these are automatically interned so as to have efficient String comparison using == operator instead of equals which is usually slower.

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

   Like      Discuss      Correct / Improve     string  string pool  string intern     HCL Technologies


 Q77. Write a Program to print duplicate words in a StringCore Java2017-01-29 14:22:37

Ans. public class BuggyBread {
public static void main(String args[]) {
String str = "we are what we repeatedly Do excellence, then, is not an act but a haBit";
Set<String> words = new HashSet();
for(String word:str.split(" ")){
if(words.contains(word)){
System.out.println(word);
} else {
words.add(word);
}
}
}
}

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

   Like      Discuss      Correct / Improve          HCL Technologies


 Q78. Write code to find second largest number in an array of integers.Core Java2017-07-10 14:31:32

 This question was recently asked at 'HCL Technologies'.This question is still unanswered. Can you please provide an answer.


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

   Like      Discuss      Correct / Improve     code  coding  find in array     HCL Technologies


 Q79. Is synchronized a keyword , modifier, identifier? what is it ?Core Java2017-04-26 19:48:55

Ans. synchronized is a keyword and a modifier. The synchronized keyword is used to indicate that a method can be accessed exclusively by one thread at a time.

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

   Like      Discuss      Correct / Improve     synchronization  synchronized  modifier  identifier     HCL Technologies



Do you think these are the Best Java Frameworks ?

OpenXavaSPRING MVCApache StripesCheck everything
that is Best in Java

Click Here



 Q80. Difference between constructor and setter injection ?Spring2017-06-23 11:49:27

 This question was recently asked at 'Sofi,HCL Technologies,Tata Consulancy (TCS)'.This question is still unanswered. Can you please provide an answer.


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

   Like      Discuss      Correct / Improve     spring  dependency injection   inversion of control     Sofi  HCL Technologies  Tata Consulancy (TCS)


 Q81. Explain Generics in Java ?Core Java2017-08-01 12:00:02

Ans. Generics are a facility of generic programming that were added to the Java programming language in 2004 within J2SE5.0. They allow "a type or method to operate on objects of various types while providing compile-time type safety.

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

   Like      Discuss      Correct / Improve     generics     TIAA.Cognizant (CTS)  HCL Technologies  Infosys Technologies  Accenture




Subscribe to Java News and Posts. Get latest updates and posts on Java from Buggybread.com
Enter your email address:
Delivered by FeedBurner



comments powered by Disqus
 

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:
         

X Close this

7 person from are looking for questions for 'HCL Technologies'. Connect with them to better prepare for your interview.Click here and post a message

HCL Technologies: HCL is a great company to begin ... Anonymous

HCL Technologies: This company is not bad for someone ... Jagriti

X Close this

Help Us Improve.
Please share your
interview experience.

Company Name:   


Questions Asked: