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

Why arrays are needed in C Sharp (C#) - Quick Recap

Choose your learning style9 modes available
Recall & Review
beginner
What is an array in C#?
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
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
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
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
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
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.