KLA
iPlace Consultancy Interview Questions and Answers
Q1. If new and malloc both allocated in heap then how to access them separately? How to count number of objects created by new and created by malloc.ques
To access objects allocated by new and malloc separately, keep track of the number of objects created by each method using counters.
Use a separate counter variable for objects created by new and malloc.
Increment the respective counter variable each time an object is created using new or malloc.
To access objects allocated by new, use the new counter variable.
To access objects allocated by malloc, use the malloc counter variable.
Q2. How default ” = ” operator and copy constructor is used and why we need to use them explicitlyques
The default = operator and copy constructor are used to assign values and create copies of objects.
The default = operator is used to assign the values of one object to another object of the same class.
The copy constructor is used to create a new object by copying the values of an existing object.
Explicitly defining these functions is necessary when the default behavior is not sufficient or when the class contains dynamically allocated memory.
For example, if a class has a poin...read more
Q3. How to compare two objects. Equal method belong to which class.quest
The equal method is used to compare two objects for equality.
The equal method is typically implemented in the class of the objects being compared.
It returns a boolean value indicating whether the two objects are equal.
The implementation of the equal method can vary depending on the requirements of the class.
For example, in the String class, the equal method compares the contents of the strings.
In the Integer class, the equal method compares the values of the integers.
Q4. In which case garbage collector cannot work explicitly
The garbage collector cannot work explicitly when objects have explicit references.
Garbage collector cannot collect objects that have explicit references.
Explicit references can be created using pointers or strong references.
If an object is explicitly referenced, it will not be considered garbage by the collector.
Examples of explicit references include global variables or objects referenced by other active objects.
Q5. How will you add/multiply very large number
To add/multiply very large numbers, use a programming language that supports big integer arithmetic.
Use a programming language like Python or Java that provides built-in support for big integer arithmetic.
Declare variables of appropriate data types (e.g., BigInteger in Java) to store the large numbers.
Use the addition or multiplication operator to perform the desired operation on the large numbers.
Handle any potential overflow or precision issues that may arise when dealing w...read more
Q6. obj2 = obj1….will destructor work for obj2?
Yes, the destructor will work for obj2.
The destructor is a special member function that is automatically called when an object is destroyed.
When obj2 is assigned the value of obj1, it will still have its own destructor that will be called when obj2 is destroyed.
The destructor is responsible for cleaning up any resources allocated by the object, regardless of how the object was assigned or copied.
Q7. How to identify the source of contamination in a tool?
Q8. why you need operator overloadingques
Operator overloading allows the same operator to be used for different purposes based on the operands.
Operator overloading provides a way to make operators work with user-defined types.
It allows us to define the behavior of an operator when applied to objects of a class.
It can simplify code and make it more readable by allowing intuitive use of operators.
Examples include overloading the '+' operator to concatenate strings or add custom objects.
Q9. Explain ” +” operator overloading
Operator overloading allows the '+' operator to be used with custom types.
Operator overloading is a feature in many programming languages that allows the same operator to have different behaviors depending on the types of the operands.
In the case of the '+' operator, it can be overloaded to perform addition between different types of objects.
For example, you can overload the '+' operator to concatenate strings, add numbers, or combine custom objects.
The behavior of the '+' op...read more
Top HR Questions asked in iPlace Consultancy
Interview Process at iPlace Consultancy
Top Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month