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 Rating

   next 30
 Q61. Is exit a keyword in Java ?Core Java
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     Asked in 1 Companies


 Q62. Is delete a keyword in Java ?Core Java
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     Asked in 1 Companies


 Q63. How does Java handle integer overflows and underflows?Core Java
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     Asked in 1 Companies        rare


 Q64. What are the different ways to handle an exception ?Core Java
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     Asked in 4 Companies

Try 1 Question(s) Test


 Q65. Is there a way to know size of an object in Java ?Core Java
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  sizeOf operator     Asked in 1 Companies        rare


 Q66. Can we declare static variables as transient ?Core Java
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     Asked in 1 Companies      expert        rare

Try 1 Question(s) Test


 Q67. 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


 Q68. What is the default value of a declared object reference ?Core Java
Ans. Null

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

   Like         Discuss         Correct / Improve     object reference  null     Asked in 1 Companies      basic


 Q69. Is it a good practice to use Asterick(*) in import statement to load multiple packages with single import statement ?Core Java
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     Asked in 1 Companies


 Q70. Does importing a package imports all its sub packages too ?Core Java
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     Asked in 1 Companies      basic


 Q71. Can we have multiple main methods in a single class ?Core Java
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     Asked in 2 Companies


 Q72. Can an application have multiple main methods within different classes ? If yes, How will the app decide which one to be executed ?Core Java
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     Asked in 3 Companies


 Q73. Which environment variables do we need to set in order to run Java programs?Core Java
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     Asked in 3 Companies      basic        frequent


 Q74. Scale yourself on Java on the scale of 1 to 10General
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          Asked in 17 Companies


Frequently asked in Cognizant ( Based on 2 feedback )
  Q75. What are Inner , Outer , Left and Right Joins in SQL ?Database
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     Asked in 24 Companies      basic        frequent


  Q76. What is an exception and exception handling in Java ?Core Java
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     Asked in 18 Companies      basic        frequent


  Q77. What is database Normalization ?Database
Ans. https://en.wikipedia.org/wiki/Database_normalization

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

   Like         Discuss         Correct / Improve     normalization  database     Asked in 35 Companies      intermediate        frequent


 Q78. What are fields that gets displayed when you execute "Top" command and briefly explain each field ?Unix
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     Asked in 1 Companies


 Q79. Write a unix command to find top 10 files by size ?Unix
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     Asked in 1 Companies


 Q80. What will be the crontab to run a job every last day of month ?Unix
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     Asked in 1 Companies


  Q81. Difference between Array and ArrayList ?Core Java
Ans. <a href="http://javahungry.blogspot.com/2015/03/difference-between-array-and-arraylist-in-java-example.html" rel="nofollow">http://javahungry.blogspot.com/2015/03/difference-between-array-and-arraylist-in-java-example.html</a>

  Sample Code for ArrayList

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

   Like         Discuss         Correct / Improve     array  arraylist     Asked in 11 Companies      basic        frequent


Very Frequently asked to Senior Software Engineers or Developers.
  Q82. Describe some of the Design Patterns you have used ?Design
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     Asked in 17 Companies      intermediate        frequent


 Q83. 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


  Q84. 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


Basic and Very Frequently asked.
  Q85. What is Polymorphism in Java ?Core Java
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  object oriented programming (oops)  oops concepts  oops concepts     Asked in 108 Companies      Basic        frequent

Try 2 Question(s) Test


Frequently asked Design Pattern interview question.
 Q86. What is a prototype design pattern ?Design
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  cloning     Asked in 11 Companies      intermediate


 Q87. How to Bulk upload the data into Oracle database?Database
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          Asked in 1 Companies      Intermediate


 Q88. Explain Exception Hierarchy in Java SE ?Core Java
Ans. <a href="http://www.programcreek.com/2009/02/diagram-for-hierarchy-of-exception-classes/" rel="nofollow">http://www.programcreek.com/2009/02/diagram-for-hierarchy-of-exception-classes/</a>

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

   Like         Discuss         Correct / Improve     exception hierarchy   exceptions     Asked in 3 Companies


 Q89. What are the benefits of Enums ?Core Java
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          Asked in 6 Companies


  Q90. 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


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: