C Developer
80+ C Developer Interview Questions and Answers

Asked in Tietoevry

Q. OOP'S concepts, reference vs pointer, malloc() vs new, PL SQL questions, simple snippets output
Questions related to OOP concepts, pointers, memory allocation, PL SQL, and code snippets.
OOP concepts include encapsulation, inheritance, and polymorphism.
Pointers hold memory addresses, while references are aliases for existing variables.
malloc() allocates memory on the heap, while new allocates memory on the heap and constructs an object.
PL SQL is a procedural language used for managing data in Oracle databases.
Code snippets can have varying outputs depending on the input ...read more

Asked in Siemens Healthineers

Q. Puzzle 4 tier and one spare tier
The puzzle involves stacking 4 tiers of different sizes with one spare tier. The task is to find the minimum number of moves to stack them all.
Start by placing the largest tier at the bottom and the smallest at the top.
Move the spare tier to the desired position to stack the next tier.
Repeat until all tiers are stacked.
The minimum number of moves required is 15.

Asked in Jio Platforms

Q. How would you store 12 bytes of character data into 6 bytes by reversing each byte?
To store 12 bytes of char in 6 bytes by reversing each byte, we can split the original bytes into pairs and reverse the order of each pair.
Split the 12 bytes into 6 pairs of 2 bytes each
Reverse the order of bytes in each pair
Store the reversed pairs in the 6 bytes of memory

Asked in HCLTech

Q. Describe your experience implementing STL libraries, specifically container classes like Vector.
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};

Asked in TCS iON

Q. How do you delete the middle element of a linked list?
To delete the middle element of a linked list, find the middle element using slow and fast pointers, then remove it by adjusting the pointers.
Use slow and fast pointers to find the middle element
Adjust pointers to remove the middle element
Update the links to maintain the integrity of the linked list

Asked in Broadcom

Q. Have you used any Windows APIs?
Yes, I have used Windows API's extensively in my previous projects.
I have used Windows API's for tasks such as creating windows, handling messages, and interacting with system resources.
Examples include using functions like CreateWindow, SendMessage, and ReadFile.
I have also worked with specific Windows API's like Winsock for networking and WinINet for internet-related tasks.
C Developer Jobs



Asked in Vyrazu Labs

Q. What is the difference between stack memory and heap memory?
Stack memory is allocated automatically, while heap memory is allocated manually.
Stack memory is limited and has a fixed size, while heap memory is larger and can grow dynamically.
Stack memory is faster to access than heap memory.
Stack memory is used for local variables and function calls, while heap memory is used for dynamic memory allocation.
Examples of stack memory include function call stack and local variables, while examples of heap memory include dynamically allocated...read more

Asked in L&T Technology Services

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.
Share interview questions and help millions of jobseekers 🌟

Asked in 63 Moons Technologies

Q. What is function overloading and overriding in C++?
Function overloading allows multiple functions with the same name but different parameters; overriding replaces a base class function in a derived class.
Overloading occurs within the same scope, e.g., void func(int) and void func(double).
Overriding requires a base class and derived class, e.g., virtual void baseFunc() in base and void baseFunc() in derived.
Overloaded functions can differ by number or type of parameters, while overridden functions must have the same signature....read more

Asked in HCLTech

Q. Write a program to copy one string to another without using any standard library function.
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

Asked in Intelizign Lifecycle Services

Q. Write a program to find the second largest element in an array.
Program to find the second largest element in an array
Iterate through the array to find the largest element
Then iterate again to find the second largest element
Handle edge cases like empty array or array with only one element

Asked in TCS

Q. What design patterns have you used in your projects?
The design pattern used in my project is the Observer pattern.
Implemented to establish a one-to-many dependency between objects.
Allows multiple objects to listen and react to changes in a subject.
Promotes loose coupling between objects.
Example: Used to notify multiple UI components when a data model changes.

Asked in L&T Technology Services

Q. How do you add an external API to a 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

Asked in Broadcom

Q. Which version of C++ do you use?
I primarily use C++17, but I am familiar with earlier versions as well.
I am comfortable working with features introduced in C++17 such as structured bindings and constexpr if
I have experience with earlier versions like C++11 and C++14
I stay updated with the latest features and improvements in C++ standards

Asked in HCLTech

Q. Overload the + operator to add two complex numbers.
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.

Asked in HCLTech

Q. Write code to delete a node from a linked list.
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

Asked in QualityKiosk Technologies

Q. What is compile-time polymorphism?
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 creating functions or classes that can work with any data type.
Co...read more

Asked in London Stock Exchange Group

Q. What is the difference between ordered and unordered maps?
Ordered maps maintain element order; unordered maps use hash tables for faster access without order.
Ordered maps (std::map) store elements in a sorted order based on keys.
Unordered maps (std::unordered_map) use hash tables for faster average access time.
Example of ordered map: std::map<int, std::string> orderedMap; // elements sorted by key
Example of unordered map: std::unordered_map<int, std::string> unorderedMap; // elements not sorted

Asked in HCLTech

Q. What is the use of Mutex?
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 important.
Example: Protecting a shared variable in a multithreaded...read more

Asked in Tejas Networks

Q. What is the difference between multiprogramming and multitasking?
Multiprogramming involves running multiple programs on a single processor, while multitasking involves executing multiple tasks within a single program.
Multiprogramming allows multiple programs to be loaded into memory and executed concurrently, while multitasking involves switching between multiple tasks within a single program.
In multiprogramming, the operating system decides which program gets the processor's attention at any given time, while in multitasking, the program ...read more

Asked in TCS iON

Q. What is the difference between multi-programming and multi-tasking?
Multi-programming involves running multiple programs on a single processor, while multi-tasking involves running multiple tasks within a single program.
Multi-programming allows multiple programs to be loaded into memory and executed concurrently, switching between them to utilize processor time efficiently.
Multi-tasking allows a single program to perform multiple tasks simultaneously, such as running multiple threads or processes within the program.
Examples of multi-programmi...read more

Asked in Broadcom

Q. You are given an integer array prices where prices[i] is the price of a given stock on the ith day. On each day, you may decide to buy and/or sell the stock. You can only hold at most one share of the stock at...
read moreMaximize profit by buying and selling stocks multiple times with given prices.
You can buy and sell stocks multiple times.
Profit is made by buying before selling.
Example: Prices = [7, 1, 5, 3, 6, 4] -> Buy at 1, sell at 5, profit = 4.
You can also buy at 3 and sell at 6 for additional profit.
Total profit = 4 + 3 = 7.

Asked in HCLTech

Q. How do you bit shift 1 by 4 positions from the LSB?
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

Asked in Intelizign Lifecycle Services

Q. What are the four pillars of object-oriented programming?
The four pillars of OOP are encapsulation, inheritance, polymorphism, and abstraction, forming the foundation of object-oriented design.
Encapsulation: Bundling data and methods that operate on the data within a single unit (class). Example: A class 'Car' with attributes like 'speed' and methods like 'accelerate()'.
Inheritance: Mechanism to create a new class from an existing class, inheriting its properties and behaviors. Example: 'ElectricCar' inherits from 'Car'.
Polymorphis...read more

Asked in Fatpipe Networks

Q. What are threads and programs?
Threads are lightweight processes within a program that can run concurrently, allowing for multitasking. Programs are sets of instructions executed by a computer.
Threads are independent sequences of execution within a program.
Threads share the same memory space and resources, allowing for efficient communication and data sharing.
Programs are a collection of instructions that tell a computer how to perform a specific task.
Programs can be written in various programming language...read more

Asked in Guardian India

Q. Explain runtime polymorphism with an example.
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'

Asked in EdgeVerve Systems

Q. How do you find the number with the maximum occurrences in an array?
Find the number with the highest frequency in an array of strings.
Create a map to store the frequency of each number in the array.
Iterate through the array and update the frequency in the map.
Find the number with the highest frequency in the map.

Asked in TCS

Q. What are the pillars of OOP?
OOPs pillars are the four main principles of Object-Oriented Programming: Inheritance, Encapsulation, Abstraction, and Polymorphism.
Inheritance: Allows a class to inherit properties and behavior from another class.
Encapsulation: Bundling data and methods that operate on the data into a single unit.
Abstraction: Hiding the complex implementation details and showing only the necessary features of an object.
Polymorphism: Ability to present the same interface for different data ty...read more

Asked in HCLTech

Q. What are the advantages and disadvantages of using default arguments in C++?
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 from right to left; once a parameter has a default value, ...read more

Asked in Broadcom

Q. What is a union in C++?
Union in C++ is a data structure that allows storing different data types in the same memory location.
Unions are similar to structures but all members share the same memory location.
Only one member of a union can be accessed at a time.
Unions are useful when you need to store different data types in the same memory space.
Example: union MyUnion { int i; float f; };
Example: MyUnion u; u.i = 10; // Accessing integer member of the union
Interview Questions of Similar Designations
Interview Experiences of Popular Companies





Top Interview Questions for C Developer Related Skills

Calculate your in-hand salary
Confused about how your in-hand salary is calculated? Enter your annual salary (CTC) and get your in-hand salary


Reviews
Interviews
Salaries
Users

