Question 1: Which of the following is a correct way to initialize an array?
Question 2: Which of the following statement(s) are TRUE?
Question 3: Which of the following method returns the highest index of an array?
Question 4: Which of the following array declaration is valid?
Question 5: What will be the output of the following program?
public class Program
{
public static void Main()
{
string[] strArr = {"Hello","World"};
object[] objArr = strArr;
Console.Write(objArr[0]);
}
}
Question 6: What will be the output of the following program?
using System;
using System.Collections.Generic;
public class Program
{
public static void Main()
{
string[] strArr = {"Hello","World"};
IList<string> strList = strArr;
IList<object> objList = strArr;
Console.Write(strList[0] + objList[1]);
}
}
Question 7: What will be the output of the following program?
public class Program
{
public static void Main()
{
int i = 3;
int[] arr = new int[i] {10, 20, 30};
Console.Write(arr[0]);
}
}
Question 8: What will be the output of the following program?
public static void Main(string[] args)
{
int[] arr = {1, 2, 3};
display(arr);
display(4,5,6);
}
static void display(params int[] arr){
foreach(var i in arr)
Console.Write(i);
}
Question 9: Which of the following collection type will you use to hold values of different data types?
Question 10: Which of the following is LIFO (Last In First Out) collection?