×

C# Tutorial

Basics of .Net

C# Basics

C# Fundamentals

C# Operators

C# Loops

C# Type Conversions

C# Exception Handling

C# String Class

C# Arrays

C# List

C# Stack

C# Queue

C# Collections

C# Character Class

C# Class and Object

C# Namespaces

C# Delegates

C# Constructors

C# Inheritance

C# Operator Overloading

C# Structures

C# File Handling

C# Convert.ToInt32()

C# Int32 (int) Struct

C# DateTime Class

C# Uri Class

C# Database Connectivity

C# Windows

C# Other Topics

C# Q & A

C# Programs

C# Find O/P

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



Advertisement
Advertisement


Comments and Discussions!

Load comments ↻


Advertisement
Advertisement
Advertisement

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