# Welcome to the Arrays and Strings MCQs Page

Dive deep into the fascinating world of Arrays and Strings with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of Arrays and Strings, a crucial aspect of C# programming. In this section, you will encounter a diverse range of MCQs that cover various aspects of Arrays and Strings, from the basic principles to advanced topics. Each question is thoughtfully crafted to challenge your knowledge and deepen your understanding of this critical subcategory within C# programming.

Check out the MCQs below to embark on an enriching journey through Arrays and Strings. Test your knowledge, expand your horizons, and solidify your grasp on this vital area of C# programming.

Note: Each MCQ comes with multiple answer choices. Select the most appropriate option and test your understanding of Arrays and Strings. You can click on an option to test your knowledge before viewing the solution for a MCQ. Happy learning!

### Arrays and Strings MCQs | Page 1 of 16

Q1.
Which of the following statements are correct about the C#.NET code snippet given below?

int[ , ] intMyArr = {{7, 1, 3}, {2, 9, 6}};

1. intMyArr represents rectangular array of 2 rows and 3 columns.
2. intMyArr.GetUpperBound(1) will yield 2.
3. intMyArr.Length will yield 24.
4. intMyArr represents 1-D array of 5 integers.
5. intMyArr.GetUpperBound(0) will yield 2.
Q2.
Which of the following statements are correct about the C#.NET code snippet given below?

int[] a = {11, 3, 5, 9, 4};

1. The array elements are created on the stack.
2. Refernce a is created on the stack.
3. The array elements are created on the heap.
4. On declaring the array a new array class is created which is derived from System.Array Class.
5. Whether the array elements are stored in the stack or heap depends upon the size of the array.
Q3.
Which one of the following statements is correct?
Answer: (d).The default value of numeric array elements is zero.
Q4.
If a is an array of 5 integers then which of the following is the correct way to increase its size to 10 elements?
Answer: (d).int[] a = new int;
a = new int;
Q5.
How will you complete the foreach loop in the C#.NET code snippet given below such that it correctly prints all elements of the array a?

int[][]a = new int[];
a = new int{6, 1 ,4, 3};
a = new int{9, 2, 7};
foreach (int[ ] i in a)
{
Console.Write(j + " ");
Console.WriteLine();
}
Answer: (d).foreach (int j in i)
Q6.
Which of the following is the correct output of the C#.NET code snippet given below?

int[ , , ] a = new int[ 3, 2, 3 ];
Console.WriteLine(a.Length);
Q7.
Which of the following statements are correct about arrays used in C#.NET?

1. Arrays can be rectangular or jagged.
2. Rectangular arrays have similar rows stored in adjacent memory locations.
3. Jagged arrays do not have an access to the methods of System.Array Class.
4. Rectangular arrays do not have an access to the methods of System.Array Class.
5. Jagged arrays have dissimilar rows stored in non-adjacent memory locations.
Q8.
Which of the following statements are correct about the C#.NET code snippet given below?

int[][]intMyArr = new int[];
intMyArr = new int{6, 1, 4, 3};
intMyArr = new int{9, 2, 7};
Answer: (c).intMyArr refers to the zeroth 1-D array and intMyArr refers to the first 1-D array.
Q9.
Which of the following are the correct ways to define an array of 2 rows and 3 columns?

1.
int[ , ] a;
a = new int[2, 3]{{7, 1, 3},{2, 9, 6}};

2.
int[ , ] a;
a = new int[2, 3]{};

3.
int[ , ] a = {{7, 1, 3}, {2, 9,6 }};

4.
int[ , ] a;
a = new int[1, 2];

5.
int[ , ] a;
a = new int[1, 2]{{7, 1, 3}, {2, 9, 6}};

int[][][] intMyArr = new int[][];