Home » Aptitude Questions and Answers » C# Aptitude Questions and Answers

C# Arrays Aptitude Questions and Answers | Set 4

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

1) What is the correct output of given code snippets?
static void Main(string[] args)
{
	int[] ARR = {1,2,3,4,5};

	Console.WriteLine(ARR.GetLength(1));
}
  1. 5
  2. 6
  3. Syntax Error
  4. Runtime Error

2) What is the correct output of given code snippets?
static void Main(string[] args)
{
	int[] ARR = {1,2,3,4,5};

	Console.WriteLine(ARR.GetLength(0));
}
  1. 5
  2. 6
  3. Syntax Error
  4. Runtime Error

3) What is the correct output of given code snippets?
static void Main(string[] args)
{
	int[] ARR = {1,2,3,4,5};

	Console.WriteLine(ARR.MAX());
}
  1. 5
  2. 6
  3. Syntax Error
  4. Runtime Error

4) What is the correct output of given code snippets?
static void Main(string[] args)
{
	int[] ARR = {1,2,3,4,5};

	int X = 0;
	int i = 0;

	X = ARR[0];
	for (i = 1; i < ARR.Length; i++)
	{
		if (X < ARR[i])
			X = ARR[i];
	}

	Console.WriteLine(X);
}
  1. 5
  2. 6
  3. Syntax Error
  4. Runtime Error

5) What is the correct output of given code snippets?
static void Main(string[] args)
{
	int[,] ARR = {{1,2},{3,4}};

	Console.WriteLine(ARR.GetLength(1));
}
  1. 5
  2. 2
  3. Syntax Error
  4. Runtime Error






Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.





Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates


© https://www.includehelp.com some rights reserved.