a) Declaring array in C# the square bracket([]) comes after the type but not after identifier
b) It is necessary to declare size of an array with its type
c) No difference between declaration of array in c# as well as in other programming languages
d) all of the mentioned
Answer: a
Explanation: i. When declaring an array in C#, the square brackets ([]) come after the type, not the identifier. Brackets after the identifier are not legal syntax in C#.
example :
int[] IntegerArray;
ii. The size of the array is not part of its type as it is in the C language. This allows to declare an array and assign any array of int objects to it, regardless of the array’s length.
int[] IntegerArray;
IntegerArray = new int[10];
IntegerArray = new int[50];
Related Posts
What is the output of the given code?
counter=1
if counter<=5
puts (counter)
counter=counter+1What is the output of the given code?
if(a==10 && b=9)
print “true”
else
print “false”
endWhich of the following are used for comparison?
What is the output of the given code?
a=10
b=9
if(a>b)
print (“a greater than b”)
else
print “Not greater”
endAssignment operator is also known as relational operator.
What is the output of the given code?
a=”string”
b=”strings”
if(a==b)
print (“a and b are same”)
else
print “Not same”
endWhat is the output of the given code?
test_1 = 17 > 16
puts(test_1)
test_2 = 21 <= 30
puts(test_2)
test_3 = 9 >= 9
puts(test_3)
test_4 = -11 > 4
puts(test_4)
Join The Discussion