C Arrays: 30 flashcards
All 30 flashcards from this kit, free and with no sign-up.
1. C में array क्या है?
Show the answer
Array एक ही data type के elements का संग्रह है जो memory में लगातार (contiguous) स्थानों पर संग्रहीत होते हैं।
2. C में array declare करने का सामान्य सिंटैक्स क्या है?
Show the answer
`data_type array_name[array_size];`
3. C में array को initialize करने के दो तरीके क्या हैं?
Show the answer
1. Declaration के समय: `int arr[5] = {1,2,3,4,5};` 2. Declaration के बाद अलग-अलग assign करके।
4. यदि array के कुछ elements initialize नहीं किए जाते, तो उनका default मान क्या होता है?
Show the answer
Static storage duration वाले arrays में बाकी elements स्वतः 0 हो जाते हैं। Automatic (local) arrays में वे अनिश्चित (garbage) होते हैं।
5. C में array का पहला element किस index पर होता है?
Show the answer
Index 0 पर।
6. यदि `int arr[5];` घोषित है, तो valid indices कौन-से हैं?
Show the answer
0, 1, 2, 3, 4
7. C में array के element को कैसे access करते हैं?
Show the answer
`array_name[index]` सिंटैक्स से, जैसे `arr[2]`।
8. C में array bounds checking होती है या नहीं?
Show the answer
नहीं, C में automatic bounds checking नहीं होती; सीमा से बाहर access करने पर undefined behavior हो सकता है।
9. Array का नाम क्या represent करता है?
Show the answer
Array का नाम पहले element के address (pointer) को represent करता है, जो constant pointer की तरह व्यवहार करता है।
10. `arr[i]` और `*(arr + i)` में क्या संबंध है?
Show the answer
दोनों बराबर हैं: `arr[i]` ≡ `*(arr + i)`
11. C में array का size कैसे ज्ञात करते हैं?
Show the answer
`sizeof(arr) / sizeof(arr[0])` से elements की संख्या मिलती है।
12. क्या C में array का size runtime पर बदला जा सकता है?
Show the answer
नहीं, standard C में array का size compile-time constant होना चाहिए। (C99 में VLA का प्रावधान है, पर सामान्यतः fixed size होता है।)
13. C में 2D array को कैसे declare करते हैं?
Show the answer
`data_type array_name[rows][cols];` जैसे `int matrix[3][4];`
14. 2D array के element को कैसे access करते हैं?
Show the answer
`array_name[row_index][col_index]` से, जैसे `matrix[1][2]`।
15. C में 2D array memory में किस order में संग्रहीत होता है?
Show the answer
Row-major order में: पहले पूरी पहली row, फिर दूसरी row, आदि।
16. क्या C में array को function को pass करने पर पूरा array copy होता है?
Show the answer
नहीं, array का address (pointer) pass होता है, इसलिए function में किए गए परिवर्तन original array में दिखते हैं।
17. Array को function parameter के रूप में कैसे declare करते हैं?
Show the answer
`void func(int arr[], int size)` या `void func(int *arr, int size)`
18. C में string किस प्रकार का array है?
Show the answer
String characters का array है जो null character `'\0'` पर समाप्त होता है।
19. Array initialization में `int arr[] = {1,2,3};` से array का size क्या होगा?
Show the answer
Size 3 होगा, क्योंकि compiler elements की संख्या से size निर्धारित करता है।
20. Array के elements को कैसे traverse (iterate) करते हैं?
Show the answer
Loop (जैसे `for` loop) का उपयोग करके index 0 से n-1 तक।
21. Array में insertion और deletion की time complexity क्या होती है (सामान्यतः)?
Show the answer
O(n), क्योंकि elements को shift करना पड़ सकता है।
22. Array में किसी index पर access करने की time complexity क्या है?
Show the answer
O(1) — constant time, क्योंकि address calculation सीधे होती है।
23. Array के क्या लाभ हैं?
Show the answer
1. Random access O(1) 2. Memory में contiguous allocation 3. आसान traversal 4. कम memory overhead
24. Array की क्या सीमाएँ हैं?
Show the answer
1. Fixed size 2. Insertion/deletion महँगा 3. Bounds checking नहीं 4. Heterogeneous data संभव नहीं
25. C में array के लिए `sizeof` operator क्या देता है?
Show the answer
Array द्वारा occupied कुल bytes (size × sizeof(element))।
26. यदि `int arr[5] = {1,2};` है, तो arr[2], arr[3], arr[4] का मान क्या होगा?
Show the answer
0 (यदि static/global है), अन्यथा garbage (local automatic के लिए)।
27. C में array के elements को initialize करते समय यदि size से अधिक values दी जाएँ तो क्या होता है?
Show the answer
Compile-time error आता है।
28. क्या C में array का size 0 हो सकता है?
Show the answer
Standard C में size 0 वाला array allowed नहीं है (undefined behavior)।
29. Array of pointers और pointer to array में क्या अंतर है?
Show the answer
Array of pointers: pointers का संग्रह, जैसे `int *arr[5];` Pointer to array: पूरे array का pointer, जैसे `int (*ptr)[5];`
30. C में array को कैसे copy करते हैं?
Show the answer
Assignment operator से सीधे copy नहीं होता; loop या `memcpy` का उपयोग करना होता है।
Your notes can be a kit like these
Every kit here was made from real study material. Point Veda at a chapter, a PDF, a photo or a link and get notes, flashcards, practice MCQs, games and a scored test — free, in 42 languages.
- Chapter notes
- Flashcards
- Practice MCQs
- Scored tests
- Exam prep
Get Veda free See what students get
Free to start · No ads · Works in 42 languages