C# Arrays Aptitude Questions and Answers | Set 1

C# Arrays Aptitude Questions | Set 1: This section contains aptitude questions and answers on C# Arrays.
Submitted by Nidhi, on April 01, 2020

1) There are following statements are given below, which of them are correct about arrays in C#.NET?
  1. Arrays are not available in C#.NET
  2. An array is a group of similar data elements.
  3. We can create an array for integers, doubles, bytes, strings, etc.
  4. In C#.Net, Array is a predefined class.

Options:

  1. Only A
  2. Only B
  3. B, C, and D
  4. Only C

2) Is it possible to create an array of objects?
  1. Yes
  2. No

3) What is the correct way to declare and initialize an array of characters with 4 elements?
  1. char []ch = { 'A', 'C', 'D', 'E'};
  2. char ch[] = { 'A', 'C', 'D', 'E'};
  3. char ch{} = { 'A', 'C', 'D', 'E'};
  4. char ()ch = { 'A', 'C', 'D', 'E'};

Options:

  1. A
  2. B
  3. C
  4. D

4) There are following statements are given below, which of them are correct about given code snippet in C#.NET?
    int []arr = {5,0,10,20,4};
  1. It is not a proper way to create an array.
  2. Here we are creating an array of 5 integer elements.
  3. Here arr is a reference to the array created on the stack.
  4. We need to use curly braces to create an array in C#.NET.

Options:

  1. Only A
  2. Only B
  3. C and D
  4. A and D

5) Can we create a jagged array in C#.NET?
  1. Yes
  2. No





Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.