C#.NET Interview Question on OOPS, Arrays and Strings -Part 2/2

Let’s look at some much asked and a comprehensive set of questions on C#. Below enlisted are not just a set of most frequently asked questions of C# but also some very important topics to be understood to stand out from the crowd in .net interviews

C# interview Question : 1

What is an Array?

         Arrays are used to store multiple values of same type in a single variable, instead of declaring separate, it is faster as it doesn’t have unboxing, by default size of members are initially defined;

           int[] intArray1 = new int[5];

C# interview Question : 2

 What is one dimensional array?

In this array contains only one row for storing the values. All values of this array are stored contiguously starting from 0 to the array size

                                int[] myNum = {10, 20, 30, 40};

C# interview Question : 3

What is Multi-dimensional array?

The multi-dimensional array contains more than one row to store the values. It is also known as a Rectangular Arrayin C#  because it’s each row length is same. It can be a 2D-array or 3D-array or more


int[,] array2D = new int[,] { { 1, 2 }, { 3, 4 }, { 5, 6 }, { 7, 8 } };


C# interview Question : 4

 What are collections in .net?

Collections are specialized classes that stores series of values or objects

C# interview Question : 5

What are two types of Collection in .net?

              Generic Collection

              Non-Generic Collection

C# interview Question : 6

 What is Generic Collection in C#?

Generic collections are collection where the type of the values or objects are mentioned at initialization

  • List<T>
  • SortedList<TKey,TValue>
  • Dictionary<TKey,TValue>
  • Stack<T>
  • Queue<T>
  • Hashset<T>

C# interview Question : 7

 What is non-Generic Collection in C#?

  • ArrayList
  • SortedList
  • Stack
  • Queue
  • Hashtable
  • BitArray

C# interview Question : 8

 What is Array list?

              Array list is non generic collection of objects, whose size can be increased dynamically, it is same as array except dynamic size and not strongly typed.

         Arraylist aar= new ArrayList();


        Console.writeline(Aar[0]); //output “sree”

C# interview Question : 9

  What is Dictionary in C#?

The Dictionary<TKey, TValue> is a generic collection that stores key-value pairs in no order. Keys must be unique.

               Dictionary<int,string> mydictionary= new Dictionary<int,string>();

                Mydictionary.add(1,”c# interview Questions”);

                Mydictionary.add(2,”.net interview Questions”);


                  Console.writeline(Mydictionary [1]); //output “c# interview Questions”.

C# interview Question : 10

 What is Sorted List in C#?

         Sorted list is a generic collection that stores key value pair and is sorted based on the key. Keys must be not null and unique, if key is primitive datatype sorting is in ascending order

C# interview Question : 11

 What is Queue in C#?

Queue<T> stores the values in FIFO style (First In First Out). It keeps the order in which the values were added. It provides an Enqueue () method to add values and a Dequeue() method to retrieve values from the collection

It provides a Enqueue () method to add a value

It provides a Dequeue () to retrieve and remove a value

It Provide a Peek () retrieve values without removing.


Queue<int> callerIds = new Queue<int>();callerIds.Enqueue(1);


C# interview Question : 12

What is Stack in C#?

  Stack<T> stores the values as LIFO (Last In First Out).

It provides a Push () method to add a value

It provides a Pop () to retrieve and remove a value

It Provide a Peek () retrieve values without removing.


Show All Cards



Commented by : {{x.userName}} {{new Date( x.addedDate).toString().split(' ').splice(0, 5).join(' ') }}


Other Free Training Materials Available

Free Kerala PSC Exam Training Online
Way4job - Free Kerala PSC training online with previous question papers and free mock exams

Free Kerala PSC training provide notes, Free Online daily Mock test, Previous Questions and answers in english and malayalam. Practice previous years question answers in exam mode will help you success.

Study Now
Free DHA Training
Free DHA Training for Nurses ,Doctors and other medical persons. Sample Questions and Mock test

Study and Practise DHA

Study Now
Free Online PMP Training based on PMBOK
Best Free Online PMP Training based on PMBOK

Best Free Online PMP Training based on PMBOK and PMI guidelines,Sample questions,Exam Simulators and PMP Notes and Flashcards makes you understand the concepts clearly and pass PMP exam at first attempt

Study Now
Free Microsoft Certification Trainings Material
Free Microsoft Training

Study Now
Currently viewing : 468