Bird
0
0
DSA Cprogramming~10 mins

Array Declaration and Initialization in DSA C - Interactive 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' of size 5.

DSA C
int numbers[[1]];
Drag options to blanks, or click blank then click option'
A10
B5
C0
Dsize
Attempts:
3 left
💡 Hint
Common Mistakes
Using 0 as size which is invalid.
Using a variable name instead of a number without declaration.
2fill in blank
medium

Complete the code to initialize the array 'scores' with values 10, 20, 30.

DSA C
int scores[] = { [1] };
Drag options to blanks, or click blank then click option'
A10, 20, 30
B10 20 30
C"10, 20, 30"
D10; 20; 30
Attempts:
3 left
💡 Hint
Common Mistakes
Using spaces instead of commas between values.
Putting values inside quotes making it a string.
3fill in blank
hard

Fix the error in the array declaration to create an array 'data' of size 4.

DSA C
int data[[1]];
Drag options to blanks, or click blank then click option'
Afour
B0
C4
D-4
Attempts:
3 left
💡 Hint
Common Mistakes
Using a word instead of a number.
Using negative or zero size.
4fill in blank
hard

Fill both blanks to declare and initialize an array 'ages' with 3 elements: 18, 21, 25.

DSA C
int ages[[1]] = { [2] };
Drag options to blanks, or click blank then click option'
A3
B18, 21, 25
C18 21 25
D4
Attempts:
3 left
💡 Hint
Common Mistakes
Mismatch between size and number of values.
Using spaces instead of commas between values.
5fill in blank
hard

Fill all three blanks to declare an array 'temps' of size 4 and initialize with 15, 20, 25, 30.

DSA C
int temps[[1]] = { [2] , [3] };
Drag options to blanks, or click blank then click option'
A4
B15, 20
C25, 30
D3
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong size for the array.
Not separating all values with commas.