i
HCLTech
Filter interviews by
Mutex is used in multithreading to prevent multiple threads from accessing shared resources simultaneously.
Mutex stands for mutual exclusion and is used to synchronize access to shared resources in multithreaded programs.
It allows only one thread to access the shared resource at a time, preventing data corruption or race conditions.
Mutexes are typically used in critical sections of code where data integrity is imp...
STL libraries provide efficient and easy-to-use container classes like Vector for storing and manipulating data.
STL Vector is a dynamic array that can resize itself automatically.
It provides random access to elements, similar to arrays.
Vector supports various operations like push_back, pop_back, insert, erase, etc.
Example: std::vector<int> numbers = {1, 2, 3, 4, 5};
OOP is a programming paradigm based on the concept of objects, which can contain data and code to manipulate that data.
OOP focuses on creating objects that interact with each other to solve complex problems.
Encapsulation: Objects encapsulate data and behavior within a single unit.
Inheritance: Objects can inherit attributes and methods from other objects.
Polymorphism: Objects can take on different forms or have mul...
Vtable and Vptr are mechanisms in C++ for supporting dynamic polymorphism through virtual functions.
Vtable (Virtual Table) is a static table created by the compiler for each class with virtual functions.
Vptr (Virtual Pointer) is a pointer in each object instance that points to the Vtable of its class.
When a virtual function is called, the Vptr is used to look up the correct function in the Vtable.
Example: If class...
What people are saying about HCLTech
Runtime polymorphism allows objects of different classes to be treated as objects of a common superclass.
Use virtual functions in base class and override them in derived classes
Use pointers or references of base class to call derived class methods
Example: Animal class with virtual function 'makeSound', Dog and Cat classes overriding 'makeSound'
Use a loop to copy characters from one string to another
Create two character arrays to store the strings
Use a loop to iterate through each character of the source string and copy it to the destination string
Add a null terminator at the end of the destination string to mark the end of the copied string
Compile time polymorphism is achieved through function overloading and templates in C++.
Compile time polymorphism allows for different functions to be called based on the arguments provided at compile time.
Function overloading is a form of compile time polymorphism where multiple functions have the same name but different parameters.
Templates in C++ allow for generic programming and compile time polymorphism by cr...
Overload + operator to add two complex numbers in C++.
Define a class for complex numbers with real and imaginary parts.
Overload the + operator as a member function of the class.
Return a new complex number with the sum of real and imaginary parts.
To delete a node from a linked list, update the pointers of the previous node to skip the node to be deleted.
Traverse the linked list to find the node to be deleted
Update the pointers of the previous node to skip the node to be deleted
Free the memory allocated to the node to be deleted
A function pointer is a variable that stores the address of a function. Its signature includes the return type and parameter types of the function.
Function pointers allow for dynamic function calls based on the stored address
Syntax: return_type (*pointer_name)(parameter_types)
Example: void (*funcPtr)(int) = &someFunction;
I appeared for an interview in Dec 2024.
20 - MCQ test related C&C++ basic to advance
2 - coding questions -
1) create class which allows only one instance creation at a time if you try to create another before deleting existing object then class should throw exception..
2) find the distance between leftmost string and rightmost string(string's chars order doesn't matter) In a given long shuffled string.
Ex :-
Shuffled string = "xaxxcxbxxxcxxaxxbx"
target string= "abc"
Ans: 3
(Leftmost string is last index 6
Right most is 9 so 9-6=3)
Note:- other chars not necessarily 'x' it can be any
OOP is a programming paradigm based on the concept of objects, which can contain data and code to manipulate that data.
OOP focuses on creating objects that interact with each other to solve complex problems.
Encapsulation: Objects encapsulate data and behavior within a single unit.
Inheritance: Objects can inherit attributes and methods from other objects.
Polymorphism: Objects can take on different forms or have multiple...
Runtime polymorphism allows objects of different classes to be treated as objects of a common superclass.
Use virtual functions in base class and override them in derived classes
Use pointers or references of base class to call derived class methods
Example: Animal class with virtual function 'makeSound', Dog and Cat classes overriding 'makeSound'
Vtable and Vptr are mechanisms in C++ for supporting dynamic polymorphism through virtual functions.
Vtable (Virtual Table) is a static table created by the compiler for each class with virtual functions.
Vptr (Virtual Pointer) is a pointer in each object instance that points to the Vtable of its class.
When a virtual function is called, the Vptr is used to look up the correct function in the Vtable.
Example: If class A ha...
STL libraries provide efficient and easy-to-use container classes like Vector for storing and manipulating data.
STL Vector is a dynamic array that can resize itself automatically.
It provides random access to elements, similar to arrays.
Vector supports various operations like push_back, pop_back, insert, erase, etc.
Example: std::vector<int> numbers = {1, 2, 3, 4, 5};
Singleton class ensures only one instance of a class is created and provides a global point of access to it.
Ensures only one instance of a class is created
Provides a global point of access to the instance
Useful for managing global resources or settings
Mutex is used in multithreading to prevent multiple threads from accessing shared resources simultaneously.
Mutex stands for mutual exclusion and is used to synchronize access to shared resources in multithreaded programs.
It allows only one thread to access the shared resource at a time, preventing data corruption or race conditions.
Mutexes are typically used in critical sections of code where data integrity is importan...
I applied via Naukri.com and was interviewed in Sep 2024. There was 1 interview round.
Bit shift 1 by 4 positions from LSB results in 16
Use the left shift operator (<<) to shift the bits by 4 positions
1 << 4 = 16
Use a loop to copy characters from one string to another
Create two character arrays to store the strings
Use a loop to iterate through each character of the source string and copy it to the destination string
Add a null terminator at the end of the destination string to mark the end of the copied string
A function pointer is a variable that stores the address of a function. Its signature includes the return type and parameter types of the function.
Function pointers allow for dynamic function calls based on the stored address
Syntax: return_type (*pointer_name)(parameter_types)
Example: void (*funcPtr)(int) = &someFunction;
Polymorphism is the ability of a function to behave differently based on the object it is called with.
Polymorphism allows objects of different classes to be treated as objects of a common superclass.
There are two types of polymorphism: compile-time (function overloading) and runtime (virtual functions).
Example: A base class Animal with a virtual function 'makeSound'. Subclasses Dog and Cat override 'makeSound' to bark ...
Compile time polymorphism is achieved through function overloading and templates in C++.
Compile time polymorphism allows for different functions to be called based on the arguments provided at compile time.
Function overloading is a form of compile time polymorphism where multiple functions have the same name but different parameters.
Templates in C++ allow for generic programming and compile time polymorphism by creatin...
Default arguments in C++ allow functions to be called with fewer arguments than defined, enhancing flexibility.
Default arguments are specified in the function declaration, e.g., `void func(int x, int y = 10);`.
If a default argument is provided, it can be omitted when calling the function, e.g., `func(5);` uses `y = 10`.
Default arguments can be used for any data type, including user-defined types.
They must be specified ...
Overload + operator to add two complex numbers in C++.
Define a class for complex numbers with real and imaginary parts.
Overload the + operator as a member function of the class.
Return a new complex number with the sum of real and imaginary parts.
A template-based stack implementation in C++ that can handle any data type.
Use templates to define a generic Stack class: `template <typename T>`.
Implement basic stack operations: push, pop, and top.
Use a dynamic array (or linked list) to store stack elements.
Example: `Stack<int> intStack; intStack.push(5);`
Example: `Stack<std::string> stringStack; stringStack.push("Hello");`
To delete a node from a linked list, update the pointers of the previous node to skip the node to be deleted.
Traverse the linked list to find the node to be deleted
Update the pointers of the previous node to skip the node to be deleted
Free the memory allocated to the node to be deleted
I applied via Naukri.com and was interviewed in Jul 2021. There were 3 interview rounds.
I applied via Company Website and was interviewed before Mar 2021. There was 1 interview round.
What people are saying about HCLTech
I applied via Campus Placement and was interviewed before May 2021. There were 4 interview rounds.
VERBAL QUANT DI/LR and Picture based test
Fibonacci series can be easily implemented using loops in C++ or C.
Declare variables for first two numbers of the series
Use a loop to calculate and print the next number in the series
Repeat the loop until desired number of terms are printed
I applied via Recruitment Consulltant and was interviewed before Oct 2021. There were 2 interview rounds.
Framework skills are essential for efficient architecture workflow.
Framework skills help in understanding the overall structure of the system.
They aid in identifying the key components and their interactions.
Frameworks provide a common language for communication between team members.
Examples of frameworks include Spring, Hibernate, and AngularJS.
I applied via Naukri.com and was interviewed in Jan 2021. There was 1 interview round.
I applied via Referral and was interviewed before Jan 2021. There was 1 interview round.
Abstract class is a class that cannot be instantiated, List is a collection of objects, SQL is a language used to manage databases, ADO.net is a framework for accessing databases.
Abstract class is used as a base class for other classes
List is a generic collection of objects
SQL is used to create, modify, and query databases
ADO.net provides a set of classes for accessing databases
Example: abstract class Animal { public a...
I applied via Naukri.com and was interviewed before Aug 2021. There were 2 interview rounds.
Standard Coding questing
based on 2 interview experiences
Difficulty level
Duration
based on 1 review
Rating in categories
Software Engineer
24.9k
salaries
| ₹2.7 L/yr - ₹8.1 L/yr |
Technical Lead
22.9k
salaries
| ₹10.9 L/yr - ₹21 L/yr |
Senior Software Engineer
16.8k
salaries
| ₹5.4 L/yr - ₹15.8 L/yr |
Lead Engineer
16.4k
salaries
| ₹5.3 L/yr - ₹12.4 L/yr |
Analyst
15.9k
salaries
| ₹2.3 L/yr - ₹6.5 L/yr |
TCS
Wipro
Accenture
Cognizant