IndiaBIX
IndiaBIX
Start typing & press "Enter" or "ESC" to close
  • Home
  • Jobs
  • Results
  • Current Affairs
  • GK
  • Online Test
  • HR Interview
  • BLOG

Arrays - General Questions (1)

  • Home
  • Computer Science & Engineering
  • C# Programming Questions and Answers
  • Arrays - General Questions
1. 

What will be the output of the C#.NET code snippet given below?

namespace IndiabixConsoleApplication
{
class SampleProgram
{
static void Main(string[ ] args)
{
int i, j;
int[ , ] arr = new int[ 2, 2 ];
for(i = 0; i < 2; ++i)
{
for(j = 0; j < 2; ++j)
{
arr[i, j] = i * 17 + i * 17;
Console.Write(arr[ i, j ] + " ");
}
}
}
}
}

A. 0 0 34 34
B. 0 0 17 17
C. 0 0 0 0
D. 17 17 0 0
E. 34 34 0 0

Answer: Option A

Explanation:

No answer description available for this question. Let us discuss.
View Answer Discuss Workspace Report

2. 

Which of the following is the correct way to obtain the number of elements present in the array given below?

int[] intMyArr = {25, 30, 45, 15, 60};

1 intMyArr.GetMax;

2 intMyArr.Highest(0);

3 intMyArr.GetUpperBound(0);

4 intMyArr.Length;

5 intMyArr.GetMaxElements(0);

A. 1, 2
B. 3, 4
C. 3, 5
D. 1, 5
E. 4, 5

Answer: Option B

Explanation:

using System;

public class Test
{
public static void Main()
{
int[] intMyArr = { 25, 30, 45, 15, 60, 78, 99 };
Console.WriteLine(intMyArr.Length);
Console.WriteLine(intMyArr.GetUpperBound(0)+1);
}
}
/*
Output :
7
7
*/

View Answer Discuss Workspace Report

3. 

Which of the following is the correct output of the C#.NET code snippet given below?

int[][] a = new int[2][];
a[0] = new int[4]{6, 1, 4, 3};
a[1] = new int[3]{9, 2, 7};
Console.WriteLine(a[1].GetUpperBound(0));

A. 3
B. 4
C. 7
D. 9
E. 2

Answer: Option E

Explanation:

No answer description available for this question. Let us discuss.
View Answer Discuss Workspace Report

4. 

Which of the following is the correct way to define and initialise an array of 4 integers?

1 int[] a = {25, 30, 40, 5};

2 int[] a;
a = new int[3];
a[0] = 25;
a[1] = 30;
a[2] = 40;
a[3] = 5;

3 int[] a;
a = new int{25, 30, 40, 5};

4 int[] a;
a = new int[4]{25, 30, 40, 5};

5 int[] a;
a = new int[4];
a[0] = 25;
a[1] = 30;
a[2] = 40;
a[3] = 5;

A. 1, 2
B. 3, 4
C. 1, 4, 5
D. 2, 4, 5
E. 2, 5

Answer: Option C

Explanation:

No answer description available for this question. Let us discuss.
View Answer Discuss Workspace Report

5. 

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

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

A. intMyArr is a reference to an object of System.Array Class.
B. intMyArr is a reference to an object of a class that the compiler derives from System.Array Class.
C. intMyArr is a reference to an array of integers.
D. intMyArr is a reference to an object created on the stack.
E. intMyArr is a reference to the array created on the stack.

Answer: Option B

Explanation:

No answer description available for this question. Let us discuss.
View Answer Discuss Workspace Report

6. 

Which of the following statements is correct about the array declaration given below?

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

A. intMyArr refers to a 2-D jagged array containing 2 rows.
B. intMyArr refers to a 2-D jagged array containing 3 rows.
C. intMyArr refers to a 3-D jagged array containing 2 2-D jagged arrays.
D. intMyArr refers to a 3-D jagged array containing three 2-D jagged arrays.
E. intMyArr refers to a 3-D jagged array containing 2 2-D rectangular arrays.

Answer: Option C

Explanation:

No answer description available for this question. Let us discuss.
View Answer Discuss Workspace Report

7. 

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}};

A. 1, 2 , 3
B. 1, 3
C. 2, 3
D. 2, 4, 5
E. 4, 5

Answer: Option B

Explanation:

No answer description available for this question. Let us discuss.
View Answer Discuss Workspace Report

8. 

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

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

A. intMyArr is a reference to a 2-D jagged array.
B. The two rows of the jagged array intMyArr are stored in adjacent memory locations.
C. intMyArr[0] refers to the zeroth 1-D array and intMyArr[1] refers to the first 1-D array.
D. intMyArr refers to intMyArr[0] and intMyArr[1].
E. intMyArr refers to intMyArr[1] and intMyArr[2].

Answer: Option C

Explanation:

No answer description available for this question. Let us discuss.
View Answer Discuss Workspace Report

  • 1
  • 2

Questions & Answers

Aptitude Chemical Engineering Civil Engineering Computer Science & Engineering Current Affairs Data Interpretation Electrical & Electronics Engineering Electronics & Communication Engineering General Knowledge Logical Reasoning Mechanical Engineering Non Verbal Reasoning Verbal Ability Verbal Reasoning

Interviews

HR Interview

Jobs

Sarkari Jobs

Results

Rojgar ResultSarkari Result

Admission

Admission 2023

Admit Card

Admit Card 2023

Answer Key

Answer Key 2023
copyright
Privacy Policy
© 2025 IndiaBIX. All Rights Reserved.

Report