Written Test or practical ASP.NET Interview Questions asked in MNC's

All the ASP.NET Interview questions listed in this article are asked in many company interviews. They give you system and ask you to write code to solve these questions. You may have to write programs for 1 or 2 questions not for all the questions in this article.

Question 1:
Please write a sample program that parses the string into a series of substrings where the delimiter between the substrings is ^*!%~ and then reassembles the strings and delimiters into a single new string where each of the substrings is in the reverse order from the original string. The method must return the final string.

Original String
Token A^*!%~Token B^*!%~Token C^*!%~Token D^*!%~Token E

Output String
Token E^*!%~Token D^*!%~Token C^*!%~Token B^*!%~Token A

Click here to get the answer for question 1

Question 2:
How to bind an XML file to dropdownlist. The dropdownlist items should be sorted in ascending order. Click here for the complete question with the answer, Click here to get the answer.

Question 3:
Reading and writing to an XML file. Click here to get the answer.

Question 4:
Write a custom reusable function to populate a dropdownlist, Click here to get the answer.

Question 5:
List all the files in a directory on a web form. The files must be displayed in a gridview control. The name of the file and create date must be displayed, Click here to get the answer.

Question 6:
Give an example to show how to write and read a cookie from a client's computer, Click here to get the answer.

Question 7:
Write a reusable split function that can be used to split any given string with a given delimiter?


  1. can you please post ASP.NET and C#,SQL SERVER 2005 objective type Questions?

  2. how to create a login page using username and password

  3. We want to add xmlfile in two dropdownlist like one dropdownlist contains states of country after that automatically contains all district of selected state of country in another dropdownlist in .net C#
    Please Help Me

  4. hi....
    This is an Interview question asked to me..

    How do you access a web service which is having windows authentication,where do you provide password for such web services.can any one tell me the answer

  5. please post some objectives and oral sort of question asked in the interviews for trainees

  6. Hi,you can use network credentials object and attach that to ur webservice

  7. can you please write a program regarding the use of Captcha???


  9. can u pls mail me all .net related question asked in interviews? pls.
    email id:pratikbhra@gmail.com

  10. Write an algorithm to find non-repeat character from a string i.e. In "total"char "o" would be the result , in "teeter" char "r" would be the result.

  11. Good Evening sir,your blogspot is awesomee.can you please mail me all .net questions and answers which they will asked in an interview,please sir..
    email id: praveen.19.2007@gmail.com

  12. can u pls mail me all .net,c#,sql server related question asked in interviews? pls.
    email id:gpanday60@gmail.com

  13. Hi Venkat,
    This is Gautam Kumar and I am preparing for .net interview and found your tutorials are best for freshers like me. I want a help on the below question that was asked during my interview :

    I was asked to develop a time-card applicaiton. A timecard application is used to keep time logs of work done by the employees in an organization. Requirements are follows:
    -Time card entries from employees are kept in files.
    -Each file contains timecard entries of one division.
    -Each line is one time-record of employee.
    -Some divisions keep their records in comma seprated key-value pair format:
    Empid=xx,day=ddmmyyyy, time=xx xx
    -While others keep their records in the fixed length format
    -time is float, xxxx represents xx.xx
    -First line of file indicates format type, fixedlength(FL)or key valye(KV)and Division ID

    There are 10 divisions of the company, and each divisions has 1000 employees. There are 365 records per employee (that is one year of records).

    1. as a first step, create your own file creation program which crates such files with random data records,
    2. The main exercise is to create an application.

    Your application has to process all the records presents in the files and calculate following things:-
    -Average daily employee time of each division.
    -Highest and Lowest time of each division.
    -Average of Company
    -Highest and Lowest time of company

    This information is to be written to an output file in the following format:

    File will be of the following format. DIV must be passed, DIV is Division name and not ID.


    Considering that the format of the output might change in future, what kind of design would make it pre-prepared for it. include that.

    Can u please publish the solution for this question or you can mail me to my email: gautam.pandit@yahoo.co.in. Also can you please provide some more written program example for common.

    I would be very grateful to you an wish you a good luck for your life for such excellent work.

    Thanks and regards,
    Gautam Kumar

  14. can you plz give me the solution of folloeing program..
    string:Ajay kumar Singh
    output:A. K. Singh

    1. Hey Ajay Singh here is the solution for your output -:

      VB.Net Code -:

      Public Sub replace()
      Dim mstrName As String = "Ajay kumar Singh"
      Literal1.Text = mstrName

      Dim mstrName1 As String = mstrName.Replace("Ajay", "A.").Replace("kumar", "k.")
      Literal1.Text = mstrName1
      End Sub

      Output :
      A. k. Singh

    2. C# Code:

      static void Main(string[] args)
      string inputName = "Ajay Kumar Singh";
      string[] arrName = inputName.Split(' ');
      string outputName = "";// A.K.Singh
      for(int i=0; i<arrName.Length-1;i++)
      outputName = outputName + arrName[i].Substring(0, 1) + ".";
      outputName = outputName + arrName[arrName.Length - 1];

  15. Sir i am new in .net but after watching your vedio,its very easy for programming in .net

  16. Hi Venkat,

    you are superb. it is very easy for the new joiners who can learn .net very easily by looking at your blog.

  17. class Program
    static void Main(string[] args)

    byte a = 10, b = 20;
    byte c = a + b; //error

    short a1 = 10, b1 = 20;
    short c1 = a1 + b1;//error

    sbyte a2 = 10, b2 = 20;
    sbyte c2 = a2 + b2;//error

    ushort a3 = 10, b3 = 20;
    ushort c3 = a3 + b3;//error

    int x = 10, y = 20;
    int z = x + y;//works fine


    could you please explain..why can't we store the sum of two bytes in a byte variable..but we can store sum of two integers in an integer variable?

    how to answer this question?Is it require any internal implementation to answer this question.

    1. This is because, arithmetic expression on the right-hand side of the assignment operator evaluates to int by default.
      (Ref MSDN)
      For more understanding refer the below links


  18. hi sir..
    as a fresher,i need to face C language objective type questions during the written test but m getting diferent o/p with different compilers. so m very much confused and not getting which o/p is to be considered as right one.
    i would like to know which C-COMPILER IS RECOMMENDED.
    though this que is not in this context...I hope i 'll get reply
    thanks in advance

  19. Some interview questions

    How to use transaction in Entity framework
    What is difference between single(), singleOrDefault()
    What are the advantages of WCF over normal web service


If you are aware of any other asp.net 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