Friday, May 23, 2014

Arrays of C#.Net Interview Questions(20)

Arrays of C#.Net Interview Questions(20)





1.What is an Array?
A)Array is a collection of homogenous types under a single named instance.Array is a user defined data type.Each value location is identified using the index.Index start with 0 and ends with size-1.

2.Array belongs to which types?
A)Array belongs to reference types.

3.List the different types of Arrays?
A)Arrays can be classified into four Broad categories.They are
         1.      According To Physical Size
Ø  Single Dimensional Array
Ø  Multi Dimensional Array

        2.      According to Memory Size
Ø  Normal Array
Ø  Huge Array
       3.      According to nature of physical size
Ø  Dynamic Array
       4.      Special type
Ø  Jagged Array

4.Define Single Dimensional Array?
A)An array which contains one row or one column is known as single dimensional array.
   E.G: int [] a=new int[]{1,2,3};

5.Define Multi Dimensional Array?
A)An array which contains more than one row and more than one column is known as multi dimensional array.
   E.G: int [,] a=new int[2,3]{{1,2,3}{4,5,6}};

6.What is Normal Array?
A)An array which occupies a memory size of less than 64 KB is known as a normal array.

7.What is Huge Array?
A)An array which occupies a memory size of more than 64 KB is known as a huge array.

8.What is static Array?
A)An array whose physical size is fixed and cannot be changed at runtime is known as static array.

9.What is Dynamic Array?
A)An array whose physical size is not fixed throughout the program execution and can be changed at runtime is known as dynamic array.

10.How can we change size of an array?
A)Array size can be changed during the program execution using Resize() function of array class.

11.What is Jagged Array?
A)An Array  of Arrays is known as jagged array.
  E.G:  int[,] a=new int[,];
Note:In Jagged Arrays we can’t declare the size of the column.

12.What is the name space used for Array Class?
A)Using System.Array

13.Can you use foreach iteration on arrays in C#?
A)Yes,Since array type implements IEnumerable, you can use foreach iteration on all arrays in C#.

14.List Some of Methods under Array Class?
A)Methods in an Array class are.Listed Below
Ø  Array.Copy(Source Array,Destination Array,length)
Ø  Array.Reverse(ArrayName)
Ø  Array.Sort(ArrayName)
Ø  Array.BinarySearch(ArrayName,object value)
Ø  Array.Clear()
Ø  Array.Resize(ref variablename,ArrayName)

15.What is the return type of an Array.BinarySearch() Method?
A)Integer

16.What is an array object?
A)When we create any array with any name then array is treated as an object.
Array objevt consists of some methods and properties

17.List the properties of an array object?
A)Properties of an Array can be listed below.They are
                           Ø  Array.Length
                           Ø  Array.Rank

18.What are the methods in Array object?
A)Array objects consists of following methods.They are
                      Ø  CopyTo(DetinationArray,index)
                      Ø  Clone()

19.What is the purpose of GetLength(0) method?
A)This method is used to find number of rows of an multidimensional or jagged array

20.What is the purpose of GetLength(1) method?
A)This method is used to find number of columns of an multidimensional or jagged array

0 comments:

Post a Comment