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

Single-dimensional array declaration in C Sharp (C#) - Interactive Code Practice

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

Complete the code to declare an integer array named numbers with 5 elements.

C Sharp (C#)
int[] numbers = new int[[1]];
Drag options to blanks, or click blank then click option'
A3
B5
C7
D10
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong number for the array size.
Forgetting to specify the size in the brackets.
2fill in blank
medium

Complete the code to declare a string array named fruits with 4 elements.

C Sharp (C#)
string[] fruits = new string[[1]];
Drag options to blanks, or click blank then click option'
A4
B2
C6
D8
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing a wrong size number.
Not matching the array size with the intended number of elements.
3fill in blank
hard

Fix the error in the code to declare a double array named values with 3 elements.

C Sharp (C#)
double[] values = new double[[1]];
Drag options to blanks, or click blank then click option'
A3
B0
C5
D-1
Attempts:
3 left
💡 Hint
Common Mistakes
Using zero or negative numbers for array size.
Using a size different from the intended number of elements.
4fill in blank
hard

Fill both blanks to declare a char array named letters with 6 elements and initialize it with default values.

C Sharp (C#)
char[] letters = new char[[1]] [2];
Drag options to blanks, or click blank then click option'
A6
B{}
C[]
D()
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong brackets for initialization.
Not specifying the correct array size.
5fill in blank
hard

Complete the code to declare a boolean array named flags with 4 elements and initialize all elements to false.

C Sharp (C#)
bool[] flags = new bool[[1]] { };
Drag options to blanks, or click blank then click option'
A4
B{
Cfalse, false, false, false
D}
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting to close the braces.
Not matching the number of values with the array size.