
L&T Technology Services


L&T Technology Services C Developer Interview Questions and Answers
Structures in C++ allow for multiple data types to be grouped together, while unions share the same memory space for all members.
Structures in C++ can hold multiple data types, each with its own memory allocation.
Unions in C++ share the same memory space for all members, allowing only one member to be active at a time.
Structures are used when different types of data need to be stored together, while unions are used when only one type of data needs to be stored at a time.
Dynamic memory allocation in C allows for allocating memory at runtime, enabling flexibility in memory usage.
Dynamic memory allocation is done using functions like malloc(), calloc(), realloc() in C.
It allows for allocating memory as needed during program execution.
Dynamic memory allocation helps in managing memory efficiently by allocating and deallocating memory as required.
Example: int *ptr = (int*)malloc(5 * sizeof(int)); // Allocates memory for an array of 5 integers
To convert a value from Big Endian to Little Endian format, reverse the order of bytes.
Iterate through the bytes of the value in reverse order
Swap the positions of each byte to convert from Big Endian to Little Endian
Example: Big Endian value 0x12345678 becomes Little Endian value 0x78563412
A zombie process is a process that has completed execution but still has an entry in the process table.
Zombie processes occur when a child process finishes execution before the parent process can collect its exit status.
Zombie processes consume system resources and should be cleaned up by the parent process using wait() or waitpid() system calls.
Zombie processes can be identified using tools like ps command in Unix/Linux systems.
Example: When a parent process forks a child pr...read more
Q5. 3. Write a class to debit, credit and balance check functionalities
A class for debit, credit and balance check functionalities
Create a class with member variables for balance
Add member functions for debit, credit and balance check
Ensure proper validation and error handling
Consider using exception handling for errors
IPC stands for Inter-Process Communication, which allows processes to communicate and share data with each other.
IPC enables processes to exchange data and information with each other.
Common IPC mechanisms include pipes, message queues, shared memory, and sockets.
Examples of IPC usage include communication between a parent and child process, or between different processes on a network.
Q7. How to add external API to project
To add an external API to a project, you need to first obtain the API documentation and credentials.
Obtain API documentation and credentials
Integrate API into project using appropriate libraries or frameworks
Test API functionality and handle errors appropriately
Q8. Explain Abstract design pattern.
Abstract design pattern is a way to define a blueprint for a group of objects with common characteristics.
It allows creating objects without specifying their concrete classes.
It promotes loose coupling between classes.
It is implemented using abstract classes and interfaces.
Example: Shape is an abstract class and Circle, Square, Triangle are its concrete subclasses.
Example: JDBC API uses abstract classes and interfaces to provide a common interface for different database vendo...read more
Q9. 2. Convert string to integer.
Convert string to integer in C++.
Use stoi() function to convert string to integer.
Include
header file. stoi() function throws an exception if the string is not a valid integer.
Use stol() or stoll() for long integers.
Use atoi() for C-style strings.



Reviews
Interviews
Salaries
Users/Month

