C Sharp Arrays Questions and Answers
Arrays are fundamental to programming in C#. This comprehensive set of C Sharp arrays programming questions with answers covers array declaration, initialization, multidimensional arrays, and looping concepts. Used widely in Infosys, TCS, and Wipro placement exams, these programming questions and answers help learners understand efficient data management in C#. Each question is accompanied by explanations and sample code, allowing candidates to master key array-handling techniques and perform well in technical interviews.
C Sharp Arrays
Showing 10 of
30 questions
11. In C#, what is the index of the first element in an array?
- 0
- 1
- -1
- Depends on array declaration
12. Which of the following correctly declares an array in C#?
- int array[];
- int[] array;
- array int[];
- array[] int;
13. How do you get the number of elements in an array in C#?
- array.Length
- array.Count()
- array.Size
- array.Elements
14. What is the default value of numeric array elements in C#?
- 0
- 1
- null
- random value
15. Which method is used to sort an array in C#?
- Array.Sort()
- array.Sort()
- Sort(array)
- array.Order()
16. How do you declare a multidimensional array in C#?
- int[,] array;
- int[][] array;
- int[[]] array;
- int{} array;
17. What is a jagged array in C#?
- Array of arrays with different sizes
- Single dimensional array
- Fixed size multidimensional array
- Array with jagged edges
18. Which of the following copies elements from one array to another?
- Array.Copy()
- array.Copy()
- Array.Clone()
- array.Duplicate()
19. How do you reverse the order of elements in an array?
- Array.Reverse()
- array.Reverse()
- Reverse(array)
- array.Flip()
20. What happens when you try to access an array element with an index beyond its bounds?
- IndexOutOfRangeException
- NullReferenceException
- ArrayException
- No error, returns default value