C Developer

80+ C Developer Interview Questions and Answers

Updated 6 Jul 2025

Asked in Tietoevry

3d ago

Q. OOP'S concepts, reference vs pointer, malloc() vs new, PL SQL questions, simple snippets output

Ans.

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

3d ago

Q. Puzzle 4 tier and one spare tier

Ans.

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.

2w ago

Q. How would you store 12 bytes of character data into 6 bytes by reversing each byte?

Ans.

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

2w ago

Q. Describe your experience implementing STL libraries, specifically container classes like Vector.

Ans.

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};

Are these interview questions helpful?

Asked in TCS iON

2w ago

Q. How do you delete the middle element of a linked list?

Ans.

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

2d ago

Q. Have you used any Windows APIs?

Ans.

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

IBM India Pvt. Limited logo
Open BMC developer 2-7 years
IBM India Pvt. Limited
4.0
Bangalore / Bengaluru
IBM India Pvt. Limited logo
Open BMC Developer 2-7 years
IBM India Pvt. Limited
4.0
Bangalore / Bengaluru
Capgemini Technology Services India Limited logo
IBM ACE +APIC Developer | 5 To 12 year | Pan India 4-6 years
Capgemini Technology Services India Limited
3.7
Bangalore / Bengaluru

Asked in Vyrazu Labs

2w ago

Q. What is the difference between stack memory and heap memory?

Ans.

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

Q. What is IPC?
Ans.

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 🌟

man-with-laptop
1w ago

Q. What is function overloading and overriding in C++?

Ans.

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

5d ago

Q. Write a program to copy one string to another without using any standard library function.

Ans.

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

Q. Write a program to find the second largest element in an array.

Ans.

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

2d ago

Q. What design patterns have you used in your projects?

Ans.

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.

Q. How do you add an external API to a project?

Ans.

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

2w ago

Q. Which version of C++ do you use?

Ans.

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

1w ago

Q. Overload the + operator to add two complex numbers.

Ans.

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

6d ago

Q. Write code to delete a node from a linked list.

Ans.

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

Q. What is compile-time polymorphism?

Ans.

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

Q. What is the difference between ordered and unordered maps?

Ans.

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

1w ago

Q. What is the use of Mutex?

Ans.

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

1w ago

Q. What is the difference between multiprogramming and multitasking?

Ans.

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

2w ago

Q. What is the difference between multi-programming and multi-tasking?

Ans.

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

1w ago

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 more
Ans.

Maximize 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

2w ago

Q. How do you bit shift 1 by 4 positions from the LSB?

Ans.

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

Q. What are the four pillars of object-oriented programming?

Ans.

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

6d ago

Q. What are threads and programs?

Ans.

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

2w ago

Q. Explain runtime polymorphism with an example.

Ans.

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'

2w ago

Q. How do you find the number with the maximum occurrences in an array?

Ans.

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

1w ago

Q. What are the pillars of OOP?

Ans.

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

3d ago

Q. What are the advantages and disadvantages of using default arguments in C++?

Ans.

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

2w ago

Q. What is a union in C++?

Ans.

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

Previous
1
2
3
Next

Interview Experiences of Popular Companies

TCS Logo
3.6
 • 11.1k Interviews
HCLTech Logo
3.5
 • 4.1k Interviews
TCS iON Logo
3.9
 • 385 Interviews
View all
interview tips and stories logo
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

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

C Developer Interview Questions
Share an Interview
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+

Reviews

10L+

Interviews

4 Cr+

Salaries

1.5 Cr+

Users

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2025 Info Edge (India) Ltd.

Follow Us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter
Profile Image
Hello, Guest
AmbitionBox Employee Choice Awards 2025
Winners announced!
awards-icon
Contribute to help millions!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos
Add office benefits
Add office benefits