C# Interview Questions by topic


On this page you can see list of all C# Interview Questions by topic. In most of the interviews, these questions are very frequently asked. If you have an asp.net question that is asked in a previous interview, please post it here.

Free C# Video Tutorial

What's the difference between IEnumerable and List?

New features in c# 4.0

Give an example for explicit interface implementation

Difference between EXE and DLL

Unit Testing a private static method

Unit Testing a private method

What are the problems of multiple class inheritance.

Difference between an abstract class and an interface

Where did you use delegates in your project

Delegates


Advantages of Interfaces

Advantages and disadvantages of using generics

What are the advantages and disadvantages of using collection classes present in System.Collections namespace

What are the advantages and disadvantages of using arrays


Remoting

Interfaces

Partial classes, structs and methods

Nested Types

Destructors

Constructors

Methods / Functions

Properties

Constants

Fields

Access Modifiers

Why should you override the ToString() method

Polymorphism

Abstract and Sealed class members

Inheritance

Structs

Classes and structs

Data Types

Value types and reference types

Data type casting

Boxing and Unboxing

Arrays

Basic C# Interview Questions on strings

Strings

43 comments:

  1. Explain what is override

    ReplyDelete
    Replies
    1. Override is keyword which is used to override the methods, that are declared as virtual in base class
      ex: Class Base
      {
      Public virtual void M1()
      {
      // Some logic
      }
      }
      Class Child:Base
      {
      Public override void M1()
      {
      // Redefine user logic
      }
      }

      Delete
  2. What is Reflection in .NET?

    ReplyDelete
  3. Reflection is a mechanism in .NET using which we can dynamically find information about assemblies, modules and types at runtime. In short, reflection is used to inspect assembly, module and types metadata at runtime. Reflection can be used to achieve late binding.

    ReplyDelete
  4. reflection is that which people do when things backfire, blowback, blowup, breakup... i guess u get it... :-)

    ReplyDelete
  5. Thanks a lot Ventak

    ReplyDelete
  6. What do you mean by Generic Class ?

    ReplyDelete
    Replies
    1. Generics are similar to ―templates in C++.
       Def: A generic is an identifier, which automatically identifies the data type of a variable. This is designed to represent a particular data type, during an object life time or a method execution.

      Delete
  7. now i m vry cmfrtble wth basics of csharp thanks alot venkat it helped me sersly

    ReplyDelete
  8. Awesome blog for last moment revision

    ReplyDelete
  9. Thanks a lot. You are a great help

    ReplyDelete
  10. Sir, Thank you very much, please post some videos on asp.net.

    ReplyDelete
  11. Sir,ur videos are nice. please upload the video for Extension method. Thanks in advance. Sukumar M.....

    ReplyDelete
  12. thank you venkat for all efforts you've done, and we expect more

    ReplyDelete
  13. thank you venkat sir. You videos are really good to understand basic concepts. Please post videos on WCF and WPF and design patterns.

    ReplyDelete
  14. How to learn WPF ? Do I need learn C# first ? Is there any good tutorial video for WPF ? Please advise.

    ReplyDelete
  15. Your Videos are great and educational. Can you do Questions or Exercises for each C# lessons if you have the time and a video where explain how to program a whole project. Thank you in advance.

    ReplyDelete
  16. Hi Venkat,
    Your Videos are great and helped to understand .net Framework in deep.

    I do not understand the proper procedure to use the DLL assembly in Excel which was created in Visual Studio2010 . Let me explain what I am doing.

    I created an assembly ThermoData in Visual Studio with its classes as COM visible. Similarly, I created a demonstration program, Demo (windows App) with using the assembly. So, when I install the demonstration program on a machine, the assembly gets registered automatically.

    I can use the assembly in Excel with making the reference to ThermoData.tlb. It works perfectly.

    Now, I created another workbook. I followed the same procedure of referencing the library. It does not work. Of course, the Intellisence in Excel sees all the properties and methods of the assembly. But when I run the excel function in a Worksheet, it does not work. Similarly, it stops working in the first excel workbook, too.

    If I create another assembly with other name, it works again but with same problem.

    I will appreciate your help to resolve it. Similarly, I would like to read more on DLL and TLB.

    Best regards

    Mahendra

    ReplyDelete
  17. why to use interface when the same can be achieved by using abstract class or base class. Explain with example?

    ReplyDelete
  18. Hi Venkat ,
    Your videos are excellent training material . Can we have a video on serialization .

    ReplyDelete
  19. Hi
    I have some interview questions, venkat i request you please record the videos in simple terms , i would like to hear when you explain these in simple terms.

    1.what is the different between private constructor and static constructor.
    2.what is destructor, finalize, and dispose()
    3.how to restrcit the wcf methods to only specific users.
    4.what is the difference between gridivew and datagrid.

    Thanks in advance.

    ReplyDelete
  20. Hi Venkat ,
    I have some Question that is asked one month ago pleased record it.
    1. what is covariant and contravariant? why we used.
    2. How Entity Frame Work support multiple databases.
    3. How to implement ThreadPooling and when.

    ReplyDelete
  21. how we can print ..
    * * *
    * *
    *
    *
    if an array contain [1,2,4]

    ReplyDelete
  22. What are the advantages of using static class in c#.net????????????

    ReplyDelete
  23. Hi Venkat

    Currently I am working in HCL and Yesterday, I had an interview in Microsoft. Unfortunately, I could not clear it. As I am going through Venkat Series so I know one day I will definitely clear it.

    Please do a favor if you can add below topics in your series, I could not find it. May be it comes later in your videos, as I am going through it one by one.
    1. there were two questions on Binary Search Tree which I could not understand. One question was like there was tree and what is the type of this tree.
    2. Also there was a question on Dynamic binding, now I come to know that it is actually method Overriding concept. But I could not understand in your C# series. Please add these things in your series.
    3. How CLR is configured.
    4. How to keep an object always alive.

    Thanks
    Divya

    ReplyDelete
  24. what is the advantage of method hiding?

    ReplyDelete
  25. I have been asked a question, Would you or would you rather not use "Static Class" to achieve a single instance purpose instead of using Singleton Design Pattern ?

    ReplyDelete
  26. Hello Everyone,

    in most of the interviews(Tcs,Broadridge) asking about multiple inheritence.

    when we say its not possible to create in .net but we can achieve the same using interfaces.

    next cross question by interviewer

    intead of interfaces cant we make use of abstract classes ?and can go with multiple inhertence?

    cant say anything.


    its oops concept can anybody suggest me to clear on this.


    thanks

    ReplyDelete
    Replies
    1. No we cant make use of Abstract classes for multiple inheritance. When we say classes multiple inheritance is not at possible it always lead to diamond problem. To avoid Diamond problem we go for interfaces. Always we have to bear in mind that if Type is of a class we cant go multiple inheritance.
      abstract class customer
      {

      }
      abstract class customer1
      {

      }
      class customer2:customer,customer1
      {

      }
      Error 1 Class 'mostimpproj.customer2' cannot have multiple base classes: 'mostimpproj.customer' and 'customer1'

      Delete
  27. HI venkat..
    I had faced a question in an interview...
    why we need to publish our website...?

    is there any special reason...?


    Answer me As soon as possible....

    ReplyDelete
  28. Hello:

    i have a questions about from print in web form.
    i have an gridview with SqlDataSource and i need a buttom for print the data but i can´t
    can you help me please.
    my code is:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.IO;
    using System.Text;
    using System.Configuration;
    using System.Web.UI.WebControls;
    using System.Drawing.Printing;



    public partial class Fallas : System.Web.UI.Page
    {
    protected void Page_Load(object sender, EventArgs e)
    {
    Proxy.Operaciones servicio = new Proxy.Operaciones();
    Proxy.Usuario Objeto = new Proxy.Usuario();
    string userid = (string)Session["Userid"];
    if (userid == "" || userid == null)
    {
    Response.Redirect("Default.aspx");
    }

    }
    protected void Volver_Click(object sender, EventArgs e)
    {
    String testfalla = (string)Session["reportefallas"];

    if (testfalla == null)
    {
    Response.Redirect("Reportes.aspx");
    }
    else
    {
    Response.Redirect((string)Session["reportefallas"]);
    }
    }
    protected void Salir_Click(object sender, EventArgs e)
    {
    Session.Clear();
    Session.Abandon();
    Response.Redirect("Default.aspx");
    }

    protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
    {

    }
    protected void Imprimir_Click(object sender, EventArgs e)
    {
    try
    {

    }
    catch (Exception ex)
    {
    Label1.Text = ex.ToString();
    Label1.Visible = true;
    }
    }

    }

    Best Regards

    ReplyDelete
  29. Write a C# console application which builds a single list of vehicles from any appropriate source and then prints the details of all the vehicles in the list out to the console. A vehicle can be one of 3 types: Car, Motorbike, Boat All 3 types have the following, common properties: Engine, Manufacturer, Model Each vehicle also has properties which are unique to each vehicle type. For example, a car has 4 wheels, a motorbike has 2 and a boat has a propeller

    Should i use Enum For car manifacturer if yes how can i do so with properties?
    Should i make the base class as an abstract Class?
    Should i override My properties?
    Should i use Interfaces or properties for Engine ?
    Can someone please provide a code sample, i would be very thankful

    ReplyDelete
  30. how to create a table under stored procedure and insert data into created table through stored procedure in asp.net

    ReplyDelete
  31. Hi Venkat,
    Your are doing great work, I have been using your tutorial for one month, I am glad to see your tutorials and I am winforms application developer, Can you upload some winforms and WPF tutorials?
    Your videos are very clean and understandable.
    Thanks for sharing these types of tutorials.

    ReplyDelete
  32. how to make organization chart using C# or ASP.net

    ReplyDelete
  33. hi venkat, can you please explain how to handle concurrency issue in a web application ?

    ReplyDelete
  34. Hi sir,I have given an interview he asked me,
    How to avoid boxing and unboxing in your application?

    ReplyDelete
  35. Where can i find the live scenario for interface and abstract class?

    ReplyDelete
  36. Hi Venkat,

    Please help me
    How can i read Files from ASW S3 Bucket to DB tables using C# in Script Task (SSIS).
    And What are the References i have to add?

    ReplyDelete
  37. Where and why we use Action?

    ReplyDelete
  38. I am working in a Windows application using SQL Server database and I am connecting with Integrated Security. IT area don't permit to use Sql Server accounts, we must use Windows Active Directory account to retrieve data from database. We must use a generic account created in active directory. Could you share a short video where you show how make it?

    ReplyDelete
  39. Use of Garbage collector

    ReplyDelete

If you are aware of any other C# questions asked in an interview, please post them below. If you find anything missing or wrong, please feel free to correct by submitting the form below.

 
Disclaimer - Terms of use - Contact Us