C Developer

10+ C Developer Interview Questions and Answers for Freshers

Updated 12 Jul 2025
search-icon

Asked in Amazon

3d ago

Q. String Transformation Problem

Given a string (STR) of length N, you are tasked to create a new string through the following method:

Select the smallest character from the first K characters of STR, remove it fr...read more

Ans.

Given a string and an integer, create a new string by selecting the smallest character from the first K characters of the input string and repeating the process until the input string is empty.

  • Iterate through the input string, selecting the smallest character from the first K characters each time.

  • Remove the selected character from the input string and append it to the new string.

  • Continue this process until the input string is empty.

  • Return the final new string formed.

Asked in Oracle

4d ago

Q. Merge K Sorted Arrays Problem Statement

Given 'K' different arrays that are individually sorted in ascending order, merge all these arrays into a single array that is also sorted in ascending order.

Input

The f...read more
Ans.

Merge K sorted arrays into a single sorted array.

  • Create a min heap to store the first element of each array along with the array index.

  • Pop the top element from the heap, add it to the result array, and push the next element from the same array back to the heap.

  • Continue this process until all elements are processed.

  • Time complexity can be optimized using a priority queue or merge sort technique.

Asked in MAQ Software

2d ago

Q. Sort 0 1 2 Problem Statement

Given an integer array arr of size 'N' containing only 0s, 1s, and 2s, write an algorithm to sort the array.

Input:

The first line contains an integer 'T' representing the number of...read more
Ans.

Sort an array of 0s, 1s, and 2s in linear time complexity.

  • Use three pointers to keep track of 0s, 1s, and 2s while iterating through the array.

  • Swap elements based on the values encountered to sort the array in-place.

  • Ensure to handle edge cases like all 0s, all 1s, and all 2s in the array.

Asked in UBS

5d ago

Q. Find Maximum Number by At-most K Swaps

Given an array of non-negative integers representing the digits of a number and an integer 'K', calculate the maximum possible number by swapping its digits up to 'K' time...read more

Ans.

Given an array of digits and an integer K, find the maximum number by swapping digits up to K times.

  • Sort the digits in non-increasing order to maximize the number.

  • Swap the digits to achieve the maximum number within the given number of swaps.

  • Handle cases where there are repeating digits and leading zeros.

Are these interview questions helpful?

Asked in UBS

1d ago

Q. BST Node Deletion Problem

Given a binary search tree (BST) and a key value K, your task is to delete the node with value K. It is guaranteed that a node with value K exists in the BST.

Explanation:

A binary sea...read more

Ans.

Delete a node with a given value from a binary search tree (BST).

  • Traverse the BST to find the node with the value K to be deleted.

  • Handle different cases like node with no children, one child, or two children.

  • Update the pointers of the parent node and child nodes accordingly.

  • Recursively delete the node and adjust the tree structure.

  • Return the root of the modified BST after deletion.

Asked in SAP

2d ago

Q. Move Zeroes to End Problem Statement

Given an unsorted array of integers, modify the array such that all the zeroes are moved to the end, while maintaining the order of non-zero elements as they appear original...read more

Ans.

Move all zeroes to the end of an unsorted array while maintaining the order of non-zero elements.

  • Iterate through the array and keep track of the index to place non-zero elements.

  • Once all non-zero elements are placed, fill the rest of the array with zeroes.

  • Ensure to maintain the relative order of non-zero elements.

  • Example: Input: [0, 1, -2, 3, 4, 0, 5, -27, 9, 0], Output: [1, -2, 3, 4, 5, -27, 9, 0, 0, 0]

C Developer Jobs

Robert Bosch Engineering and Business Solutions Private Limited logo
SAP SAC Developer_SDS/BSV-ES 5-8 years
Robert Bosch Engineering and Business Solutions Private Limited
4.1
Hyderabad / Secunderabad
Robert Bosch Engineering and Business Solutions Private Limited logo
SAP SAC Developer 5-10 years
Robert Bosch Engineering and Business Solutions Private Limited
4.1
Hyderabad / Secunderabad
IBM India Pvt. Limited logo
Open BMC Developer 2-5 years
IBM India Pvt. Limited
3.9
Bangalore / Bengaluru

Asked in CGI Group

4d ago

Q. Preorder Traversal of a BST Problem Statement

Given an array PREORDER representing the preorder traversal of a Binary Search Tree (BST) with N nodes, construct the original BST.

Each element in the given array ...read more

Ans.

Given a preorder traversal of a BST, construct the BST and return its inorder traversal.

  • Create a binary search tree from the preorder traversal array

  • Return the inorder traversal of the constructed BST

  • Ensure each element in the array is distinct

Asked in TCS iON

2d 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 skip the middle element and connect the surrounding nodes

  • Free the memory of the deleted node

Share interview questions and help millions of jobseekers 🌟

man-with-laptop

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 TCS iON

6d 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

Q. What is the difference between a class and a struct?

Ans.

Classes and structs are both user-defined types in C++, differing mainly in default access levels and intended use cases.

  • Default access level: Classes default to private, while structs default to public.

  • Inheritance: Classes can be used for encapsulation and inheritance, whereas structs are typically used for plain data structures.

  • Use case: Classes are often used for complex data types with behavior, while structs are used for simple data aggregates.

  • Example: class MyClass { pr...read more

Q. Explain the high-level concepts of OOP.

Ans.

Object-Oriented Programming (OOP) is a programming paradigm based on objects and classes, promoting code reusability and modularity.

  • Encapsulation: Bundling data and methods that operate on the data within one unit (class). Example: A class 'Car' with properties like 'speed' and methods like 'accelerate()'.

  • Inheritance: Mechanism to create a new class from an existing class, inheriting its properties and methods. Example: 'ElectricCar' inherits from 'Car'.

  • Polymorphism: Ability ...read more

Interview Experiences of Popular Companies

TCS Logo
3.6
 • 11.1k Interviews
HCLTech Logo
3.5
 • 4.1k Interviews
TCS iON Logo
3.8
 • 386 Interviews
View all
interview tips and stories logo
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories
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