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

C# Arrays Aptitude Questions and Answers | Set 5

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

1) There are following options are given below, which is correct way to declare an array with 2 rows and 3 columns?
  1. int arr[2][3] = new int[2][3];
  2. int arr[2,3] = new int[2,3];
  3. int [2,3]arr = new int[2,3];
  4. int [2,3]arr = new [2,3]int;

2) Can we create 4-dimensional arrays in C#.NET?
  1. Yes
  2. No

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

	Console.WriteLine(ARR.Length);
}
  1. 8
  2. 16
  3. 32
  4. Syntax Error

4) What is the correct output of given code snippets?
static void Main(string[] args)
{
	string[] S = new string{ "XXXX", "YYYY" };

	Console.WriteLine(S[0] + " " + S[1]);
}
  1. XXXX YYYY
  2. Syntax Error
  3. xxxx yyyy
  4. Runtime Exception

5) What is the correct output of given code snippets?
static void Main(string[] args)
{
	string[] S = new string[2]{ "XXXX", "YYYY" };

	Console.WriteLine(S[0] + " " + S[1]);
}
  1. XXXX YYYY
  2. Syntax Error
  3. xxxx yyyy
  4. Runtime Exception







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.