You can’t miss these 50 questions if you are preparing for interviews.
Last month I was preparing for the interviews and I have collated all the questions from different companies. Although there were many questions but I have picked top 50 that are asked regularly and are highly important for DotNet developer.
- What is the purpose of the "static" keyword in C#?
- Explain the difference between a static class and a non-static class in C#.
- What is Dependency Injection? How it is implemented in ASP.NET Core?
- What is the purpose of ‘new’ keyword in c# and in what scenarios you can use it?
- In what scenarios would you use a static class in your C# application?
- Can you declare a static method within a non-static class? If yes, what does it imply?
- What is the difference between Interface and Abstract class? (most important)
- Explain the role of a static constructor in a C# class. When is it invoked?
- What are Generics in C# & Why we need Generics?
- Discuss the advantages and disadvantages of using static members in a class.
- What is a static variable? How is it different from an instance variable?
- Can you use the "this" keyword inside a static method? Why or why not?
- Explain the concept of thread safety in the context of static members. How can you make a static method thread-safe?
- What is a static property, and when would you use it? Provide an example.
- How would you enforce that a particular method in a non-static class can only be called once in the application lifetime?
- Discuss the Singleton design pattern and its relationship with static classes.
- Explain the difference between a readonly field and a const field in C#.
- When should you use a static class versus a singleton pattern?
- How can you prevent inheritance of a static class in C#?
- Can you define a non-static method in a static class? If yes, what implications does it have?
- What is reflection in C#?
- Explain the purpose of the "System.Reflection" namespace.
- How do you obtain the type information of a class at runtime using reflection?
- What is the difference between early binding and late binding? How does reflection facilitate late binding?
- Can you dynamically create an instance of a class using reflection? If so, how?
- Explain what a "Type" object represents in C# and how it is related to reflection.
- How do you get the list of all methods of a class using reflection?
- What is the purpose of the "typeof" operator in C#?
- How can you invoke a method dynamically using reflection?
- Difference Between ViewData, ViewBag and TempData. (most important)
- What is the difference between "GetType()" and "typeof()" in C#?
- What is difference between ‘String’ and ‘StringBuilder’ in C#?
- How do you enumerate and access properties of a class dynamically through reflection?
- What is the purpose of the "Activator" class in relation?
- How does reflection deal with performance compared to direct method calls?
- Explain the difference between ‘ref’ and ‘out’ in C#?
- What is late-bound object creation, and how is it achieved using reflection?
- How Garbage Collection works?
- What are custom attributes, and how can they be used with reflection?
- Explain the security considerations when using reflection in C#.
- How can you retrieve the type of an object at runtime using reflection in .NET Core?
- Explain the purpose of the "Assembly" class in .NET Core and how it is used with reflection.
- Explain Middleware? How it works? Can i make application with no Middleware?
- Can you dynamically invoke a private method of a class using reflection in .NET Core? If so, how?
- What is the purpose of the "MemberInfo" class in .NET Core reflection?
- Explain the difference between "GetType()" and "typeof()" methods in .NET Core.
- Explain how can you implement Caching in asp.net core application?
- What is the purpose of the "Activator.CreateInstance" method in .NET Core, and how is it used?
- What are Areas in MVC?
- Explain the role of the "MethodInfo" class in .NET Core reflection.
I Advise everybody to please prepare these questions thoroghly. I am sure these will help you a lot during interviews as well as while working.