An array is a collection that holds multiple values of the same type in a single variable. It helps organize data in a list format.
Click to reveal answer
beginner
Why do we need arrays instead of separate variables?
Arrays let us store many related values together, so we don't need many separate variables. This makes code simpler and easier to manage.
Click to reveal answer
beginner
How do arrays help when working with many items?
Arrays allow us to use loops to process all items easily, like checking or changing each value without writing repetitive code.
Click to reveal answer
beginner
What problem does an array solve in real life?
Imagine you want to store scores of 10 players. Instead of 10 separate score variables, an array stores all scores in one place, making it easy to find and update any score.
Click to reveal answer
intermediate
Can arrays change size after creation in C#?
No, arrays have a fixed size once created. If you need a flexible size, you use other collections like List<T>.
Click to reveal answer
What is the main reason to use an array?
ATo make the program run faster
BTo store only one value
CTo store values of different types in one variable
DTo store multiple values of the same type together
✗ Incorrect
Arrays store many values of the same type in one variable, making data management easier.
Which of these is true about arrays in C#?
AArrays have a fixed size after creation
BArrays store values of different types
CArrays can change size anytime
DArrays cannot be used with loops
✗ Incorrect
In C#, arrays have a fixed size once created.
How do arrays help when processing many items?
AThey automatically sort items
BThey prevent using loops
CThey allow using loops to handle all items easily
DThey store only one item
✗ Incorrect
Arrays let you use loops to process each item without repeating code.
If you want to store 5 names, what is better than 5 separate variables?
AUse an array of 5 strings
BUse 5 different variables
CUse a single integer variable
DUse a boolean variable
✗ Incorrect
An array groups all 5 names in one variable, making code simpler.
What happens if you try to add more items than an array's size?
AThe array automatically grows
BYou get an error or exception
CThe extra items are ignored silently
DThe array deletes old items
✗ Incorrect
Arrays have fixed size; adding beyond that causes errors.
Explain why arrays are useful when you have many related values to store.
Think about how you would keep track of scores for many players.
You got /3 concepts.
Describe the limitation of arrays in C# regarding their size.
Consider what happens if you want to add more items than the array can hold.
You got /3 concepts.
Practice
(1/5)
1. Why do we need arrays in C# programming?
easy
A. To avoid using variables
B. To store only one item at a time
C. To store multiple items of the same type together
D. To make the program run slower
Solution
Step 1: Understand the purpose of arrays
Arrays allow storing many items of the same type in one place, making data management easier.
Step 2: Compare options
To store multiple items of the same type together correctly states the main reason for arrays. Other options are incorrect or unrelated.
Final Answer:
To store multiple items of the same type together -> Option C
Quick Check:
Arrays store many items = D [OK]
Hint: Arrays hold many same-type items together [OK]
Common Mistakes:
Thinking arrays store different types together
Believing arrays hold only one item
Confusing arrays with variables
2. Which of the following is the correct way to declare an array of integers in C#?
easy
A. int[] numbers = new int[5];
B. int numbers = new int[5];
C. array numbers = int[5];
D. int numbers[] = new int;
Solution
Step 1: Recall C# array declaration syntax
In C#, arrays are declared with the type followed by square brackets, then the variable name and size.
Step 2: Check each option
int[] numbers = new int[5]; matches correct syntax. Options B, C, and D have syntax errors or wrong order.
Final Answer:
int[] numbers = new int[5]; -> Option A
Quick Check:
Correct array syntax = A [OK]
Hint: Use type[] name = new type[size]; for arrays [OK]