C# Interview Questions

Q1: What is an object?

Q2: What is the difference between continue and break statements in C#?

Q3: What is C#?

Q4: What are Property Accessors?

Q5: What are Nullable types in C#?

Q6: What are Reference Types in C#?

Q7: What are generics in C#?

Q8: What is an Abstract Class?

Q9: What is namespace in C#?

Q10: What is Serialization?

Q11: What are dynamic type variables in C#?

Q12: Can this be used within a static method?

Q13: In how many ways you can pass parameters to a method?


Q14: What is the difference between a struct and a class in C#?

Q15: What are the different types of classes in C#?

Q16: What is Boxing and Unboxing? Related To: .NET Core

Q17: What is the difference between string and StringBuilder in C#?

Q18: How is Exception Handling implemented in C#?

Q19: What is LINQ in C#? Related To: LINQ

Q20: Can multiple catch blocks be executed?

Q21: What is Enum in C#?

Q22: What are partial classes?

Q23: Why to use finally block in C#?

Q24: What you understand by Value types and Reference types in .NET? Provide some comparison. Related To:. NET Core

Q25: What is Managed or Unmanaged Code?

Q26: What is the difference between a class and a structure? Related To: OOP

Q27: What is the difference between ref and out keywords?

Q28: Is there a difference between throw and throw ex ?

Q29: Why can't you specify the accessibility modifier for methods inside the Interface?

Q30: What is the difference between Virtual method and Abstract method? Related To: OOP

Q31: What is the use of Null Coalescing Operator (??) in C#?

Q32: What is Virtual Method in C#?

Q33: What is the difference between Interface and Abstract Class? Related To: OOP

Q34: What is lambda expressions in C#?

Q35: Explain Anonymous type in C#

Q36: What is the difference between dynamic type variables and object type variables?

Q37: What is the difference between Equality Operator ( == ) and Equals() Method in C#? 

Q38: What are the uses of using in C#

Q39: How encapsulation is implemented in C#?

Q40: What is the difference between overloading and overriding?

Q41: How can you prevent a class from overriding in C#? Related To: OOP

Q42: Explain Code Compilation in C#

Q43: What is an anonymous function in C#?

Q44: What is difference between constant and readonly?

Q45: What is Reflection in C#.Net?

Q46: What is a Destructor in C# and when shall I create one?

Q47: What is scope of a Internal member variable of a C# class?

Q48: What is Extension Method in C# and how to use them?

Q49: What is sealed Class in C#?

Q50: Is there a way to catch multiple exceptions at once and without code duplication? Related To: .NET Core

Q51: What is the use of the IDisposable interface? Related To: .NET Core

Q52: Explain the difference between Task and Thread in .NET Related To: .NET Core

Q53: What is Record in C#?

Q54: When to use Record vs Class vs Struct in C#?

Q55: Explain assignment vs shallow copy vs deep copy for a Record in C#

Q56: Test if a Number belongs to the Fibonacci Series CS PY Related To: Fibonacci Series

Q57: Explain what is Ternary Search?cs Java Related To: Searching

Q58: What interface should your data structure implement to make the where method work?

Q59: What is difference between late binding and early binding in C#?

Q60: Is operator overloading supported in C#?

Q61: Why to use lock statement in C#?

Q62: What is the Constructor Chaining in C#?

Q63: What is the difference between dispose and finalize methods in C#?

Q64: What is the difference between is and as operators in C#?

Q65: What is Marshalling and why do we need it?

Q66: Can you create a function in C# which can accept varying number of arguments?

Q67: What are the different ways a method can be overloaded?

Q68: When to use ArrayList over array[] in C#?

Q69: When would you use delegates in C#?

Q70: What is the best practice to have best performance using Lazy objects?

Q71: What is scope of a Protected Internal member variable of a C# class?

Q72: What is Indexer in C#?

Q73: Explain what is Short-Circuit Evaluation in C#

Q74: What are pointer types in C#?

Q75: What is the yield keyword used for in C#?

Q76: IEnumerable Vs List - What to Use? How do they work?

Q77: What's the difference between StackOverflowError and OutOfMemoryError?

Q78: What is the difference between System.ApplicationException class and System.SystemException class?

Q79: Explain the difference between select and where Related To: LINQ

Q80: What is the difference between Func<string, string> and delegate ?

Q81: Can Multiple Inheritance implemented in C# ?

Q82: What is the use of conditional preprocessor directive in C#?

Q83: What is a static constructor? Related To: OOP

Q84: Explain how does Asynchronous tasks Async/Await work in .NET? Related To: .NET Core

Q85: What happens when we Box or Unbox Nullable types?

Q86: Can you explain the difference between Interface, abstract class, sealed class, static class and partial class in C#?

Q87: How to solve Circular Reference? Related To: OOP

Q88: What's the difference between the system.Array.CopyTo() and System.Array.clone() ?

Q89: What is jagged array in C# and when to prefer jagged arrays over multi-dimensional arrays?

Q90: What is the volatile keyword used for?

Q91: What is the method MemberwiseClone() doing?

Q92: Can you add extension methods to an existing static class?

Q93: Explain the difference between IQueryable, ICollection, IList & IDictionary interfaces?

Q94: What is the use of static constructors?

Q95: Implement the where method in C#. Explain.

Q96: What is the difference between Lambdas and Delegates?

Q97: What is a preprocessor directives in C#?

Q98: Could you explain the difference between Func Vs. Action VS. Predicate?

Q99: What is Multicast Delegate in C#?

Q100: Why Abstract class can not be sealed or static?

Q101: What are the differences between IEnumerable and IQueryable ?

Q102: in C#, when should we use abstract classes instead of interfaces with extension methods?

Q103: Could you explain the difference between destructor, dispose and finalize method?

Q104: What are Circular References in C#?

Q105: What is deep or shallow copy concept in C#?

Q106: Explain what is Weak Reference in C#?

Q107: What are the benefits of a Deferred Execution in LINQ? Related To: LINQ

Q108: List some different ways for equality check in .NET

Q109: You have defined a destructor in a class that you have developed by using the C#, but the destructor never executed. Why? Related To: OOP

Q110: Why doesn't C# allow static methods to implement an interface? Related To: OOP

Q111: Explain when to use Finalize VS Dispose? Related To: .NET Core


Code Challenges

Q1: Implement a Queue using two Stacks [cs JS Java PY Related To: Queues, Stacks, Java, JavaScript

Q2: Filter out the first 3 even numbers from the list using LINQ Related To: LINQ

Q3: How to check if two Strings (words) are Anagrams? cs Java Py Related To: Strings, Data Structures, Java

Q4: Reverse the ordering of words in a String cs Related To: Strings

Q5: Explain how does the Sentinel Search work? CS PY Related To: Searching

Q6: Refactor the code

Q7: Can you return multiple values from a function in C#? Provide some examples.

Q8: What is the output of the program below? Explain.

Q9: Given an array of ints, write a C# method to total all the values that are even numbers.

Q10: Can you do Iterative Pre-order Traversal of a Binary Tree without Recursion? cs PY Related To: Binary Tree, Data Structures

Q11: Binet's formula: How to calculate Fibonacci numbers without Recursion or Iteration?


Q12: Explain what is Fibonacci Search technique? [cs

Data Structures, JavaScript

JS Java PY Related To: Divide & Conquer, Fibonacci Series, Searching,

Q13: Find Merge (Intersection) Point of Two Linked Lists CS Java PY Related To: Linked Lists

Q14: What is the output of the short program below? Explain your answer.

Q15: What is the output of the program below? Explain your answer.

Q16: Is the comparison of time and null in the if statement below valid or not? Why or why not?

Q17: What is the output of the program below?

Q18: Is relying on && short-circuiting safe in .NET?

Q19: Calculate the circumference of the circle

Comments