Ramya Shankar | 28 Jul, 2023

HCL Interview Questions

 

HCL interviews can be through campus, employee referrals and other sources like placement companies, newspaper or online ads etc… Whatever is the source, it takes about 2 weeks for the whole process to be over. Generally, when you apply, someone from their HR department calls you and schedules a telephonic interview.

Telephonic interview is a general one where a pre-decided set of simple questions are asked based on what you have mentioned in your resume. For example, if you have mentioned HTML in your resume, they might ask you “What are HTML tags?” or if you have mentioned SQL, they might ask you “what is DBMS?”

HCL Interview Questions

Telephonic interview is like a screening round for the main interview.

Once you clear the telephonic round, you will be called for face to face interview. They expect you to be on time, neatly dressed and look presentable.

The interview could be 3-4 rounds depending upon the job title and client requirements. The rounds could be –

  • Technical round 1
  • Technical round 2 (not always)
  • HR round
  • Client interview round

The last one will be conducted if you are going to be selected for a particular project.

The interview is straightforward and the interviewers are friendly. They start with the technical questions as soon as the basic pleasantries are exchanged, without wasting time with personal questions (that’s the general experience, your experience might be different).

If you are a fresher, the interview will be based on your basic programming knowledge like C, C++, Java, .NET, OOPS concepts. The interviewers might also ask you about your final year projects. If you are an experienced candidate, most of the questions will be from your resume and previous work experience – for example, Java, .NET, Python, SQL, HTML, Cloud and so on. They might ask you some questions on technologies you may not have mentioned – but that could be just to make you a little uncomfortable. Don’t be disappointed. Just say you do not know if you really do not!

The technical interview is an enriching experience and even if you don’t get selected, you will learn a lot. Here are some commonly asked questions that can help you crack the interview. Note that this is a comprehensive list of many interviews and not a single interview. Also, this is not a tutorial and if you want to learn the basics about the topics covered here, visit our website which has loads of them for each topic!

Question: What are the basic OOPS concepts?

Answer: This is a common question asked in an interview. You can explain briefly about inheritance, polymorphism, abstraction, and encapsulation. Watch this video to learn all about OOPS.

Question: Name a few languages that are based on OOPS concepts.

Answer: C++, Java, Python, C# (you can mention any)

Question: How can you achieve multiple inheritance in Java?

Answer: Multiple inheritance is not possible in Java by extending more than one classes, but one can implement as many interfaces as needed.

Question: What are the different operating systems you have worked with? Which one do you like most and why?

Answer: You can mention the ones you have worked with – most likely Unix, Linux, and windows. You can mention few advantages of one of them – for example, Windows has a neat UI which enables you to clearly see what’s happening on the screen while multitasking or Linux is fast and efficient and so on.

Question: Can a class be final?

Answer: Yes, class can be final. We cannot create a subclass of a class that is final.

Question: Can a class be private?

Answer: Only nested or inner classes can be private because they can be accessed by the outer class. A normal class cannot be final because you can not instantiate it (create object).

Question: What is Collection framework?

Answer: The collection is used to store and retrieve a group of objects. Objects of a collection can be easily modified, removed, searched, sorted, added etc… Some examples are List, Map, Set, etc…

Tip – Unless asked for, don’t spend too much time answering a single question. For example, the above question. The interviewer will ask a follow-up question if needed.

Question: Can you explain how HashMap works?

Answer: Here you can start with the basics, but sometimes the interviewer might ask you about the internal working of the collection (hashmap). In that case, you may have to write the code for the same and show. Mention that hashmap works on the hashing principle (data structure).

When we call the get(key) method, the hashcode method is called and the hash value returned is then used to find the bucket location of the key value pairs that are stored as Entry objects. HashMap is not thread safe because it is not synchronized.

Question: What is the difference between Application context and bean factory?

Answer: This is a very common question asked about Spring framework. Spring framework provides two containers for dependency injection – BeanFactory and Application Context. BeanFactory provides basic features whereas Application Context can do more and is feature-rich. For real-time applications, you should prefer the latter. For example, to get the servlet context in a web application, we use WebApplicationContext which is a derivation of ApplicationContext. Same way, application context supports internationalization (i18n).

Read this blog for more spring interview questions.

Question: What is StringBuffer? How is it different from String?

Answer: StringBuffer is a class used to create String objects that are modifiable. We can do a lot of string operations like concatenation, reversing, appending etc... using StringBuffer class. String class is immutable whereas StringBuffer is mutable as we can perform above operations on the same object. StringBuffer consumes less memory than String and concatenation operations are faster because the objects are stored in heap memory.

Question: What is the difference between hashtable and hashmap?

Answer:

HASHMAP HASHTABLE
Hashmap is not thread-safe. We need to write

code to synchronize if we have to share the

hashmap between various threads.

Hashtable is thread-safe and synchronized.
Hashmap allows one null key and

multiple null values.

Hashtable does not allow null values.
Faster and preferred mode unless

synchronization is required.

It is slower since it is synchronized.

Question: Write a small program to reverse a string.

Answer: You can write the program in any language. Here I am showing a C program which takes input string from the user. In the program we are using strrev method, if the interviewer says you have to write the program without using strrev, use while loop and a counter to scan through each element of the string (char array).

  • With strrev
#include 
#include 
int main()
{
 char chrarr[100];
 printf("Enter the string \n");
 gets(chrarr);
 strrev(chrarr);
 printf("Reverse of the entered string is \n%s\n", chrarr);
 return 0;
}
  • Without strrev method
 char str[100], revstr[100];
 int cbegin, cend, count = 0;
 printf("Enter the string \n");
 gets(str); 
 //till string array has not reached end
 while (str[count] != '\0')
 count++; 
 cend = count - 1;
 // for each element of the char array str
 for (cbegin = 0; cbegin < count; cbegin++) {
 // copy contents of str into revstr in the reverse order
 revstr[cbegin] = str[cend];
 cend--;
 }
 revstr[cbegin] = '\0';
 printf("%s\n", r);

Question: Can you implement linked list?

Answer: This is an advanced question. Yes, we can implement a linked list through the Node class. You will have to explain how you will implement three main functionalities in linked list –

  • insertion at start position
  • insertion at end position
  • insertion at the required position

You can check the detailed implementation on this link.

Question: What are threads?

Answer: In any OS, there are multiple processes going on at the same time. For example, you could be writing a document, listening to songs and browsing stuff on IE all at the same time. These processes are divided into small execution units known as threads that allow for parallel processing thus making your system fast. Threads have their own memory space and resources for execution. Different types of thread are – user threads and kernel threads.

Question: What is pass by reference? How is it different from pass by pointer?

Answer: To explain about pass by reference, it is good to know about pass by value and pass by pointer. You can learn all the 3 from this nice and detailed blog.

Question: What is the difference between overloading and overriding?

Answer: The concepts are the same in each programming language based on OOPS.

OVERRIDING OVERLOADING
Overriding a method or a variable means that you are using the same name and signature(parameters). The name should be same but the signature should be different.
Example –
class Animal{
 public void run(){
 System.out.println(“I can run!”);
 }
}
class Cheetah extends Animal{
 public void run(){
 System.out.println(“I can run fast!”);
 } 
}
Example –
class Animal{
 public void run(){
 System.out.println(“I can run!”);
 }
}
class Cheetah extends Animal{
 public void run(float speed){
 System.out.println(“I can run fast at ” + float + "km/h!");
 } 
}
It is a run-time concept because

the object that needs to be instantiated is

decided at run time.

Overloading is checked during compile time itself.

Question: What is a function pointer?

Answer: Function pointer is a pointer to a function. Function pointers point to code unlike the normal pointers that point to data. Function pointers are very useful when you have to pass the address of a function to another function or to implement callback mechanism.

Question: Can you explain about virtual functions?

Answer: Virtual functions are used in C++ as member functions that are declared (and perhaps defined) in the base class and (re)defined by the derived class. That is, a virtual function can be overridden by the derived class with its own implementation.

Question: If you have a class TestSample, how many constructors can you create?

Answer:There is no limit set to the number of constructors that can be created. However, they should have a different set of parameters. For TestSample class, definitely, the default constructor TestSample() and any other constructors with the member variables included can be defined.

Question: What is input-output (I/O) in C++?

Answer: Input stream is used to get inputs from the console (user). Output stream is used to display results of some operations to the console (or output device). iostream represents standard input output stream in C++. It contains the methods like cin, cout etc…

Question: What is the static keyword?

Answer: Static keyword is used when we need more than object to reuse the same value of a variable. If a static variable is declared inside a class, it becomes the variable of the class and not the object. That is, we need not create an instance of the class to use the variable. Example –

class MathVariables{
public static float PIE = 3.14;
}

When we want to use the above, we can use it as –

MathVariables.PIE;

Question: Explain the different types of data in C or explain the differences between basic and derived data types in C.

Answer: This is a common question and it is better you know about it in detail. Here is a detailed article that explains all the data types.

Question: How is a constant variable different from a global variable?

Answer: Global variables can be modified and are accessible by all the functions in a program. Constant variables have a fixed value that cannot be changed throughout the program.

Question: What are postfix and prefix operators?

Answer: The operators ++ and -- can be used as pre or postfix. The difference is in the result. For example,

++i will first increment the counter and then perform the next action whereas i++ will perform the next action and then increment the value of i.

Question: What are SQL joins? Which is your favorite join?

Answer: Joins are used to fetch data from different tables as a single record using foreign keys and common columns. You can mention your favorite as the one you are most familiar with. If you don’t know yet, check out this free tutorial and find out which one you like most!

Question: Write a query to fetch only first 3 records from database.

Answer: Knowledge of this is important especially if you want to get into the data science field. In Oracle, you can fetch the first 3 records using the rownum keyword as –

select * from (select * from student order by student_id) where rownum <=3;

Same way in MySQL, you can use the keyword limit as –

select * from student order by student_id limit 3

Know more about SQL Command

Question: What is the disadvantage of an indexed sequential file?

Answer: The main disadvantage is that as the number of records increase, the performance goes down and the indexed files have to be reorganized so that deleted records are no longer included. Also, indexed files consume a lot of disk space.

Question: Is it possible to overload a procedure in a package?

Answer: Yes, it is possible to overload a procedure inside a package.

Question: What are nested classes?

Answer: We can define a class inside another class in OOP language. The enclosed class is called a nested class. A nested class is like another member of the outer class and has the same access rights as other members of the class.

Question: What is cloud computing? How is it useful today?

Answer: In cloud computing, data is stored, processed and managed in a shared network of remote servers over the internet, rather than storing it in local machines or servers. This way data is distributed and hence secure. Cloud computing finds its use in most of the domains today like banking, finance, logistics, etc…

Question: Tell us about the different cloud computing service models.

Answer: Cloud computing service models can be categorized as –

  • IaaS (Infrastructure as a Service)
  • PaaS (Platform as a Service)
  • SaaS (Software as a Service)
  • FaaS (Function as a service)

Visit this Wikipedia link which is quite informative for learning service models.

Question: What is the difference between a private cloud and a public cloud? Which is better?

Answer: If you have some experience in the cloud or are applying for the specific position, answer this question, otherwise, you can say that you don’t know the answer. However, knowing the basics of cloud computing will help you in the long run.

In a private cloud, all the data is protected by a firewall and resides on the company’s (client’s) hosted data center. It is a highly secure but expensive option.

With a public cloud, the data remains with your cloud service provider and they take care of the maintenance and management of the data center. This reduces a lot of overhead of testing and deployment for the client.

Though it is less secure than private cloud, a public cloud is still preferred as it is less expensive.

Question: Do you know about BigData?

Answer: If you do not know right now, do not worry. It is just large volumes of data. The data that we get from various platforms today is complex and huge and for traditional software to analyse and process, interpreting something meaningful from the data is next to impossible. Because of this huge volume of information gathered over the internet, big data is useful to solve a range of business issues from machine learning, customer experience, predictive maintenance and so on. This article will give you some key information on big data.

Question: What is a foreign key?

Answer: Foreign key is a database column is used to link two tables. Most of the times, a foreign key of one table is the primary key of another table.

For example, employee_id could be the primary key of employee table and for rewards table, it could be the foreign key. If we want to fetch details of the employee who was awarded certain rewards, we can join the two tables using this key (employee_id) to get the complete information.

Question: What are access specifiers?

Answer: Access specifiers or modifiers define the access of a particular class, method or variable to the other parts of the application. There are mainly 3 access specifiers – public, private and protected.

  • A public keyword means the variable, function or class is available for any other part of code for use.
  • A private keyword is usually used for member variables and sometimes functions of a class. This would mean only the particular class can access them. An inner class can be private.
  • A protected keyword means derived classes can use the methods or variables. Additionally, in languages like Java, classes within the same package can access protected members.

Question: Tell us the main differences between abstract class and interface.

INTERFACE ABSTRACT CLASS
We implement interface using the ‘implements’ keyword We can extend abstract class using the ‘extend’ keyword
Many classes can implement interface Only one class can extend the abstract class
Interface does not have any data members or constructors Abstract class can have member variables and constructors
All the methods of interface are public Abstract class can specify the access –

private, public or protected for its members

Question: How can you initialize a global variable?

Answer: It depends on the language. You can take one language and give the example. For example, in C, you have to provide an initial value to the global variable during declaration. Further, they should be initialized to a constant value and not as a return value of a function. For example,

int sum = 10;
int average = findavg();
int findavg()
{
// some lines of code
}
int main(){
// some lines of code
}

While the global variable sum won’t give any issues, the compiler won’t be happy with the average variable because there is no constant value assigned to it.

Question: Have you used C with command-line arguments? How many maximum arguments can you pass?

Answer: C supports at least 127 arguments. There is no maximum limit.

Question: Can you write a program to find the sum of digits of a number?

#include 
int main() 
{ 
int number,sum=0,digit; 
printf("Enter the number:"); 
scanf("%d",&number); 
while(number>0) 
{ 
digit=number%10; 
sum=sum+digit; 
number=number/10; 
} 
printf("Sum is=%d",sum); 
return 0; 
} 

Apart from these technical questions, they also ask you some aptitude and story problems which are the standard ones –

  • You have a 5l and a 3l bucket. How would you measure 7l?
  • Finding the heavier ball out of 8 identical balls using a weighing scale in 3 moves. How do you do it?

HR questions

HR questions are subjective. It is a direct indication of your personality and your answer could be different from someone else’s and there can be more than one correct answer. For example, your leadership strategy could be different from someone else, your ways of getting work done might be different and so on. Some common questions asked in the interview are –

  • What are your strengths and weaknesses? / How do you overpower your weaknesses using your strengths?
  • Why do you want to join our organization?
  • What are your long term and short-term goals? /What do you want to achieve in life?
  • Are you willing to relocate?
  • What are your salary expectations?
  • What is the best thing you have learned in your previous work experience/project experience?
  • What are the qualities you look for in a good leader?

Conclusion

Slightly different from other companies like Infosys and TCS, HCL questions are tricky and you will need to be thorough in what you have mentioned in your resume. You might also want to read about trending technologies to know the basics, even if you have never worked on them. For example, if you have worked on the AWS cloud, the interviewer might still ask you about Azure. Go with good preparation and a positive mindset, you will surely crack it!

If you won't leave any stone unturned for this interview then Break Away: Programming And Coding Interviews is a great course to finish your HCL interview preparation.

When it comes to generic programming questions, this is a great book with top programming questions and answers: Cracking the Coding Interview: 189 Programming Questions and Solutions.

People are also reading:

 

 
By Ramya Shankar

A cheerful, full of life and vibrant person, I hold a lot of dreams that I want to fulfill on my own. My passion for writing started with small diary entries and travel blogs, after which I have moved on to writing well-researched technical content. I find it fascinating to blend thoughts and research and shape them into something beautiful through my writing.

View all post by the author

Subscribe to our Newsletter for Articles, News, & Jobs.

I accept the Terms and Conditions.

Disclosure: Hackr.io is supported by its audience. When you purchase through links on our site, we may earn an affiliate commission.

In this article

Learn More

Please login to leave comments