C Sharp Arrays Questions and Answers

Take Exam

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
Show Answer Report

12. Which of the following correctly declares an array in C#?

  • int array[];
  • int[] array;
  • array int[];
  • array[] int;
Show Answer Report

13. How do you get the number of elements in an array in C#?

  • array.Length
  • array.Count()
  • array.Size
  • array.Elements
Show Answer Report

14. What is the default value of numeric array elements in C#?

  • 0
  • 1
  • null
  • random value
Show Answer Report

15. Which method is used to sort an array in C#?

  • Array.Sort()
  • array.Sort()
  • Sort(array)
  • array.Order()
Show Answer Report

16. How do you declare a multidimensional array in C#?

  • int[,] array;
  • int[][] array;
  • int[[]] array;
  • int{} array;
Show Answer Report

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
Show Answer Report

18. Which of the following copies elements from one array to another?

  • Array.Copy()
  • array.Copy()
  • Array.Clone()
  • array.Duplicate()
Show Answer Report

19. How do you reverse the order of elements in an array?

  • Array.Reverse()
  • array.Reverse()
  • Reverse(array)
  • array.Flip()
Show Answer Report

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
Show Answer Report
Questions and Answers for Competitive Exams Various Entrance Test