## Sunday, February 13, 2022

Most of the companies check the coding skills and problem-solving skills as well along with the theoretical interview questions.

Sometimes you are free to write the pseudo code and sometimes you are asked to write the complete program either on any paper or any editor.

In this article, we will walk through some common coding-based interview questions and problems. You can run and check the result for each and every program here.

Watch our videos here

### Introduction

There are a large variety of coding questions but the most common topics are String, Array, and Number. Sometimes the questions are from the LINQ and TPL as well. In LINQ interviewer can ask to write the LINQ query to achieve the required result.

In this article, you can run and test each and every program live. For some questions, there are different ways to achieve the same result, so I have included all of them in different methods and called them from the main method. Please use only that method that is asked in the interview.

Below are some Common C# Programming and Coding Interview Questions with Answers:

### 1. String Based Coding Interview Questions

Q01. How can you reverse a given string without using any library function? Write a program to reverse a given string.

Please visit here for the C# Program To Reverse a String.

Q02. How can you reverse each word in a given sentence? Write a program to reverse each word of a given sentence.

Please visit here for the C# Program To Reverse Each Word of String.

Q03. How can you reverse the order of each word in a given sentence? Write a program to reverse the order of each word in a given sentence.

Please visit here for the C# Program To Reverse Each Word Order.

Q04. How can you find the total number of characters in a given string? Write a program to find the no of characters in a given string.

Please visit here for the C# Program To Get No of Characters of a String.

Q05. How can you find the total number of words in a given sentence? Write a program to find the no of words in a given sentence.

Please visit here for the C# Program To Find No of Words.

Q06. How can you find the total number of vowels and consonants in a given string? Write a program to find the number of vowels and consonants in a string.

Please visit here for the C# Program To Find Vowels and Consonants Counts.

Q07. How can you find the character having maximum occurrence in a given string? Write a program to find the character having max count in a given string.

Please visit here for the C# Program To Find Character With Max Occurrence.

Q08. How can you find the maximum occurrence of each character in a given string? Write a program to find the count of each character in a given string.

Please visit here for the C# Program To Find Max Occurance of Each Character.

Q09. How can you find the total number of occurrences of a given string or word in a paragraph or sentence? Write a program to find the total number of occurrences of a given string or word in a paragraph or sentence.

Please visit here for the C# Program To Find the Count of a Word.

Q10. How can you find the total number of occurrences of a given character in a string? Write a program to find the total number of occurrences of a given character in a string.

Please visit here for the C# Program To Find the Occurrence of a Character.

Q11. How can you find the non-repeated characters or unique characters in a given string? Write a program to find the unique characters in a string.

Please visit here for the C# Program To Find the Unique Characters in a String.

Q12. How can you find and remove the duplicate characters from a string? Write a program to remove the duplicate characters from a string.

Please visit here for the C# Program To Remove Duplicate Characters From String.

Q13. How can you find and remove the special characters from a string? Write a program to remove the special characters from a string.

Please visit here for the C# Program To Remove Special Characters.

Q14. How can you find and return the first character of each word in the capital letter for a given sentence? Write a program to return the first character of each word in the capital letter.

Please visit here for the C# Program To Find the First Character of Each Word.

Q15. How can you find the total number of numeric characters in a string? Write a program to find the numeric characters in a string.

Please visit here for the C# Program To Find the Numeric Characters Count.

Q16. How can you check whether the given string is a palindrome or not? Write a program for checking palindrome.

Please visit here for the C# Program for Palindrome Checking.

Q17. How can you find the consecutive characters (consecutive sequential letters as in alphabet) in a given string? Write a program for the same.

### 2. Array-Based Coding Interview Questions

Q01. How can you merge two sorted arrays into one sorted array? Write a program to merge two sorted arrays.

Please visit here for the C# Program for Merging Two Sorted Array.

Q02. How can you sort an array in descending order? Write a program to sort an array in descending.

Please visit here for the C# Program To Sort Array in Descending.

Q03. How can you sort an array without using any array library function? Write a program to sort an array.

Please visit here for the C# Program For Sorting Array Without Library Function.

Q04. How can you remove the duplicate elements from an integer array without using any library function? Write a program to remove the duplicate elements from an integer array.

Please visit here for the C# Program To Remove Duplicate Numbers from Array.

Q05. How can you remove the even (or odd) elements (numbers) from an integer array? Write a program to delete the even numbers from an array.

Please visit here for the C# Program To Remove Even Numbers from Array.

Q06. How can you reverse an unsorted array without using and library function or sorting? Write a program to reverse an array.

Please visit here for the C# Program To Reverse an Array.

Q07. How can you find the second largest element in an array using only a single loop? Write a program to find the second largest element in an array.

Please visit here for the C# Program To Find the Second Largest Element in Array.

Q08. How can you find the third largest element in an array? Write a program to find the 3rd max element in an array.

Please visit here for the C# Program To Find the Third Largest Array Element.

Q09. How can you find the largest and smallest element of a given unsorted array? Write a program to find the largest and smallest element of a given unsorted array.

Please visit here for the C# Program to Find Largest and Smallest Array Element.

Q10. How can you find the majority element in an unsorted array? Write a program to find the majority element in an array.

Please visit here for the C# Program to Find Majority Array Element.

Q11. How can you swap max and min elements in an integer array? Write a program to swap max and min array elements.

Please visit here for the C# Program To Swap Max and Min Array Element.

Q12. How can you find the frequency of each element of an array? Write a program to count the frequency of each element of an array?

Please visit here for the C# Program to Check the Frequency of ArrayElements.

Q13. Write a program to find the sum of the diagonal of a 2D array. or Write a program to print only the diagonal elements of an array.

Please visit here for the C# Program to find the Sum of Diagonal of Array.

Q14. How can you rotate an array to the right to a given pivot? Write a program to rotate an array.

Please visit here for the C# Program to Rotate an Array to Pivot.

Q15. How can you check whether an array contains duplicate values or not? Write a program to check if an array contains duplicates.

Please visit here for the C# Program to Check Duplicate Array Elements.

### 3. Number Based Coding Interview Questions

Q01. How can you find the sum of digits of a given positive integer? Write a program for finding the sum of digits of a given number using recursion.

Please visit here for the C# Program To Find the Sum of Digits of the Number.

Q02. How can you find the sum of digits of a number? Write a program to find the sum of digits of a number using Recursion.

Please visit here for the C# Program To Find the Sum of Digits using Recursion.

Q03. How can you swap two numbers without using a temp variable? Write a program that is free from the IntegerOverflow exception as well.

Please visit here for the C# Program To Swap Two Numbers.

Q04. How can you reverse a given number? Write a program to reverse a given number using recursion.

Please visit here for the C# Program To Reverse a Number.

Q05. How can you find the angle between the hour and minute hand (needle) of a clock at any given time? Write a program for the same.

Please visit here for the C# Program to find the Clock Angle.

Q06. How can you get the second-highest mark for each student using LINQ? or How can you find the second-highest salary for each department using LINQ?

Please visit here for the C# Program To Find the Second Highest Record in LINQ.