0
0
C Sharp (C#)programming~10 mins

Why arrays are needed in C Sharp (C#) - Test Your Understanding

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to declare an array of integers.

C Sharp (C#)
int[] numbers = new int[[1]];
Drag options to blanks, or click blank then click option'
Aarray
Bnumber
Cint
D5
Attempts:
3 left
💡 Hint
Common Mistakes
Using a variable name instead of a number for the size.
Using the type name instead of a number.
2fill in blank
medium

Complete the code to access the first element of the array.

C Sharp (C#)
int firstNumber = numbers[1];
Drag options to blanks, or click blank then click option'
A[0]
B(0)
C{0}
D<0>
Attempts:
3 left
💡 Hint
Common Mistakes
Using parentheses instead of square brackets.
Using curly braces or angle brackets.
3fill in blank
hard

Fix the error in the code to assign a value to the second element of the array.

C Sharp (C#)
numbers[1] = 10;
Drag options to blanks, or click blank then click option'
A[1]
B(1)
C<1>
D{1}
Attempts:
3 left
💡 Hint
Common Mistakes
Using parentheses or other brackets instead of square brackets.
4fill in blank
hard

Fill both blanks to create an array of strings with 3 elements.

C Sharp (C#)
string[] fruits = new string[[1]] {"apple", "banana", [2];
Drag options to blanks, or click blank then click option'
A3
B"orange"
C"grape"
D2
Attempts:
3 left
💡 Hint
Common Mistakes
Mismatch between array size and number of elements.
Missing quotes around string elements.
5fill in blank
hard

Fill all three blanks to create an array of doubles and assign values.

C Sharp (C#)
double[] temperatures = new double[[1]] { [2], [3], 23.5 };
Drag options to blanks, or click blank then click option'
A3
B20.0
C18.7
D2
Attempts:
3 left
💡 Hint
Common Mistakes
Using integer values without decimal points.
Mismatch between size and number of elements.