पहले 10 प्रश्नों के उत्तर और हल यहीं खुले हैं; बाक़ी 20 के उत्तर और हल FliQi Question Bank app में।
भाषा
प्रश्न 1उत्तर + हल
_______ एक समांगी संरचना है जो _______ सूचकांक से शुरू होता है।
An _______ is a homogenous structure and starts with _______ index number.
Aस्ट्रिंग, एकStrings, one
Bशब्दकोष, शून्यDictionary, zero
Cव्यूह, शून्यArray, zero
Dव्यूह, एकArray, one
सही उत्तर / Answer: (C)
हल / Solution
व्यूह यानी ऐरे (array) एक समांगी (homogeneous) संरचना है — उसके सारे सदस्य एक ही डेटा प्रकार के होते हैं। C में उसका सूचकांक (index) शून्य से शुरू होता है, इसलिए n सदस्यों वाले ऐरे के सूचकांक शून्य से n−1 तक चलते हैं। स्ट्रिंग भी भीतर से अक्षरों का ऐरे ही है, पर उसका सूचकांक एक से शुरू नहीं होता; और शब्दकोष C की कोई संरचना ही नहीं है। इसलिए «व्यूह, शून्य» सही जोड़ा है।
An array is a homogeneous structure, which means every element in it has the same data type. In C its index starts at zero, so an array of n elements uses the indexes zero to n−1 and its last element is reached as a[n-1]. A string is itself an array of characters, but its index does not begin at one, and a dictionary is not a C structure at all. Hence Array, zero is the correct pair.
प्रश्न 2उत्तर + हल
N आयाम वाला बहुआयामी ऐरे किसका संग्रह होता है?
A multidimensional array of dimension N is a collection of?
Aएक आयाम वाले ऐरेSingle Dimensional Arrays
BN आयाम वाले ऐरेN dimensional arrays
CN-1 आयाम वाले ऐरेN-1 dimension arrays
DN-2 आयाम वाले ऐरेN-2 dimension arrays
सही उत्तर / Answer: (C)
हल / Solution
बहुआयामी ऐरे में ऐरे के भीतर ऐरे रखे होते हैं। इसलिए N आयाम वाला ऐरे हमेशा एक आयाम कम, यानी N-1 आयाम वाले ऐरों का संग्रह होता है। जैसे int a[3][4]; दो आयाम वाला है और उसे एक आयाम वाले तीन ऐरों का संग्रह मान सकते हैं। इसी तरह त्रिआयामी ऐरे द्विआयामी ऐरों का संग्रह है। पहला विकल्प सिर्फ़ द्विआयामी हाल में ठीक बैठता है, और बाक़ी दो विकल्प गिनती ही ग़लत बताते हैं।
A multidimensional array stores arrays inside arrays. So an array of dimension N is always a collection of arrays whose dimension is one less, that is N-1. For example int a[3][4]; is two dimensional and can be seen as three one dimensional arrays. In the same way a three dimensional array is a collection of two dimensional arrays. The first choice holds only for the two dimensional case, while the last two simply get the count wrong.
प्रश्न 3उत्तर + हल
C मल्टीडायमेंशनल ऐरे के बारे में सही कथन चुनिए।
Choose a correct statement about a C multidimensional array.
Aऐरे को उसी समय इनिसियलाईज करते समय फर्स्ट डायमेंशन का साइज़ वैकल्पिक होता है।First Dimension size is optional when initializing the array at the same time.
Bऐरे को उसी समय इनिसियलाईज करते समय अंतिम डायमेंशन का साइज़ वैकल्पिक होता है।Last Dimension size is optional when initializing the array at the same time.
Cमल्टीडायमेंशनल ऐरे के सभी डायमेंशंस निर्दिष्ट करना आवश्यक है।It is a must to specify all dimensions of a multidimensional array.
Dमल्टीडायमेंशनल ऐरे के एलीमेंट्स की मेमोरी लोकेशन अनुक्रमिक नहीं होती।Memory locations of elements of a multidimensional array is not sequential.
सही उत्तर / Answer: (A)
हल / Solution
घोषणा के साथ ही ऐरे भर दिया जाए तो compiler पहले आयाम की गिनती ख़ुद कर लेता है, इसलिए वही एक आकार छोड़ा जा सकता है। जैसे int arr[][3] = {{1,2,3},{4,5,6}}; में दो पंक्तियाँ अपने-आप तय होती हैं। अंतिम आयाम छोड़ना मना है, क्योंकि उसके बिना जगह का हिसाब नहीं बनता, सो दूसरा विकल्प ग़लत है। तीसरा भी ग़लत है, और चौथा भी, क्योंकि बहुआयामी ऐरे मेमोरी में क्रम से ही रखे जाते हैं।
When an array is initialised in the same statement in which it is declared, the compiler can count the first dimension itself, so only that one size may be omitted. For example int arr[][3] = {{1,2,3},{4,5,6}}; fixes two rows automatically. Leaving out the last dimension is not allowed, because then the memory layout cannot be worked out, so the second choice is wrong. The third is wrong too, and so is the fourth, since such arrays are stored sequentially.
प्रश्न 4उत्तर + हल
Arrays वाले इस C प्रोग्राम का आउटपुट क्या होगा?
#include<stdio.h>
int main()
{
int ary[][2][3] = {
{{1,2,3},{4,5,6}},
{{7,8,9},{10,11,12}}
};
printf("%d %d", ary[0][0][0], ary[1][1][1]);
return 0;
}
What is the output of this C program with arrays?
#include<stdio.h>
int main()
{
int ary[][2][3] = {
{{1,2,3},{4,5,6}},
{{7,8,9},{10,11,12}}
};
printf("%d %d", ary[0][0][0], ary[1][1][1]);
return 0;
}
A1 12
B1 11
C7 12
D1 6
सही उत्तर / Answer: (B)
हल / Solution
यह त्रिआयामी ऐरे है, जिसमें दो खंड हैं और हर खंड में दो पंक्तियाँ तथा तीन स्तंभ। सो ary[0][0] में {1,2,3}, ary[0][1] में {4,5,6}, ary[1][0] में {7,8,9} और ary[1][1] में {10,11,12} बैठता है। पहला व्यंजक ary[0][0][0] सबसे पहला मान यानी एक देता है। दूसरा व्यंजक ary[1][1][1] अंतिम गुच्छे का index एक यानी ग्यारह देता है; बारह तो index दो पर है। इसलिए 1 11 छपता है।
This is a three dimensional array with two blocks, each holding two rows of three columns. So ary[0][0] is {1,2,3}, ary[0][1] is {4,5,6}, ary[1][0] is {7,8,9} and ary[1][1] is {10,11,12}. The first expression ary[0][0][0] picks the very first value, one. The second, ary[1][1][1], picks index one of the last group, which is eleven, since twelve sits at index two. Hence the output is 1 11.
प्रश्न 5उत्तर + हल
नीचे दिए गए C मल्टीडायमेंशनल ऐरे की वैकल्पिक परिभाषा कौन-सी है?
int ary[][3] = {6,5,4,3,2,1};
Choose an alternative definition of this C multidimensional array.
int ary[][3] = {6,5,4,3,2,1};
Aint ary[2][3] = {6,5,4,3,2,1};
Bint ary[2][3] = {{6,5,4},{3,2,1}};
Cint ary[][3] = {{6,5,4},{3,2,1}};
Dउपरोक्त सभीAll the above.
सही उत्तर / Answer: (D)
हल / Solution
दी हुई घोषणा में स्तंभ तीन हैं और मान छह, सो compiler दो पंक्तियाँ गिन लेता है और असल ऐरे int ary[2][3] बनता है। पहला विकल्प वही आकार खोलकर लिख देता है। दूसरा उन्हीं मानों को पंक्ति-वार कोष्ठक में बाँटता है, जिससे संचय का ढाँचा नहीं बदलता। तीसरे में पहला आयाम फिर छोड़ा गया है, पर पंक्तियाँ दो ही बनती हैं। तीनों एक ही ऐरे खड़ा करते हैं, इसलिए उत्तर उपरोक्त सभी है।
In the given declaration the column size is three and six values are supplied, so the compiler counts two rows and the real array is int ary[2][3]. The first choice simply writes that size out. The second groups the same values row by row in braces, which does not change the stored layout. The third leaves the first dimension out again, yet it still yields two rows. All three build exactly the same array, so all of them are correct.
प्रश्न 6उत्तर + हल
मल्टीडायमेंशनल ऐरे वाले इस C प्रोग्राम का आउटपुट क्या होगा?
#include<stdio.h>
int main()
{
int ary[][3] = {6,5,4,3,2,1};
printf("%d %d", ary[0][0], ary[1][0]);
return 0;
}
What is the output of this C program with multidimensional arrays?
#include<stdio.h>
int main()
{
int ary[][3] = {6,5,4,3,2,1};
printf("%d %d", ary[0][0], ary[1][0]);
return 0;
}
A6 2
B6 3
C6 1
Dकम्पाइलर एररCompiler error
सही उत्तर / Answer: (B)
हल / Solution
int ary[][3] में स्तंभ तीन दिए हैं और कुल छह मान हैं, इसलिए compiler पंक्तियाँ ख़ुद गिन लेता है — छह बटा तीन यानी दो पंक्तियाँ। मान row-major क्रम में भरते हैं, सो ary[0] में {6,5,4} और ary[1] में {3,2,1} जाता है। अब ary[0][0] का मान छह और ary[1][0] का मान तीन है, इसलिए 6 3 छपता है। घोषणा पूरी तरह वैध है, सो कम्पाइलर एरर वाला विकल्प ग़लत है।
In int ary[][3] the column size is given as three and six values are supplied, so the compiler counts the rows itself, six divided by three giving two rows. The values fill the array in row major order, so ary[0] holds {6,5,4} and ary[1] holds {3,2,1}. Now ary[0][0] is six and ary[1][0] is three, so the program prints 6 3. The declaration is perfectly legal, so the compiler error choice is wrong.
प्रश्न 7उत्तर + हल
मल्टीडायमेंशनल ऐरे वाले इस C प्रोग्राम का आउटपुट क्या होगा?
#include<stdio.h>
int main()
{
int ary[3][] = {6,5,4,3,2,1};
printf("%d %d", ary[0][0], ary[2][1]);
return 0;
}
What is the output of this C program with multidimensional arrays?
#include<stdio.h>
int main()
{
int ary[3][] = {6,5,4,3,2,1};
printf("%d %d", ary[0][0], ary[2][1]);
return 0;
}
A6 1
B6 2
C5 1
Dकम्पाइलर एररCompiler error
सही उत्तर / Answer: (D)
हल / Solution
बहुआयामी ऐरे बनाते समय सिर्फ़ पहला आयाम छोड़ा जा सकता है, बाक़ी हर आयाम का आकार देना ज़रूरी है। यहाँ int ary[3][] लिखा है, यानी स्तंभों की संख्या ग़ायब है। स्तंभ पता न होने पर compiler तय ही नहीं कर सकता कि ary[i][j] मेमोरी में कहाँ बैठेगा, सो वह अपूर्ण प्रकार (incomplete type) की त्रुटि देता है। सही रूप int ary[][3] होता। प्रोग्राम बनता ही नहीं, इसलिए 6 1 जैसा कोई आउटपुट नहीं आएगा।
While declaring a multidimensional array only the first dimension may be left out; every other size must be given. Here int ary[3][] leaves out the number of columns, so the compiler cannot work out where ary[i][j] should sit in memory. It therefore reports an incomplete type error. The valid form would have been int ary[][3]. Since the program never compiles, none of the printed outputs such as 6 1 can appear.
प्रश्न 8उत्तर + हल
मल्टीडायमेंशनल ऐरे वाले इस C प्रोग्राम का आउटपुट क्या होगा?
#include<stdio.h>
int main()
{
int ary[3][2] = {1,2,3,4,5,6};
printf("%d %d", ary[0][0], ary[2][1]);
return 0;
}
What is the output of this C program with a multidimensional array?
#include<stdio.h>
int main()
{
int ary[3][2] = {1,2,3,4,5,6};
printf("%d %d", ary[0][0], ary[2][1]);
return 0;
}
A2 5
B1 6
C1 5
D2 6
सही उत्तर / Answer: (B)
हल / Solution
ary[3][2] में तीन पंक्तियाँ और दो स्तंभ हैं, और मान row-major क्रम में भरते हैं। इसलिए ary[0] में {1,2}, ary[1] में {3,4} और ary[2] में {5,6} जाता है। अब ary[0][0] पहली पंक्ति का पहला मान यानी एक है, और ary[2][1] तीसरी पंक्ति का दूसरा मान यानी छह। सो प्रोग्राम छापेगा 1 6। बाक़ी तीनों विकल्प तब बनते हैं जब कोई index एक क़दम खिसका कर गिना जाए।
ary[3][2] has three rows and two columns, and the values fill it in row major order. So ary[0] gets {1,2}, ary[1] gets {3,4} and ary[2] gets {5,6}. Now ary[0][0] is the first value of the first row, that is one, and ary[2][1] is the second value of the third row, that is six. The program therefore prints 1 6. The other choices come from counting some index one step off.
प्रश्न 9उत्तर + हल
ऐरे ऑफ ऐरे (Array of Arrays) को और किस नाम से जाना जाता है?
Array of Arrays is also called?
Aमल्टी डेटा ऐरेMulti Data Array
Bमल्टी साइज ऐरेMulti Size Array
Cमल्टी डायमेंशनल ऐरेMulti Dimensional Array
Dमल्टी बाइट ऐरेMulti Byte Array
सही उत्तर / Answer: (C)
हल / Solution
जिस ऐरे का हर element ख़ुद एक ऐरे हो उसे बहुआयामी ऐरे (Multi Dimensional Array) कहते हैं। जैसे int ary[2][3]; में दो ऐरे हैं और हर ऐरे में तीन element। इसी तरह द्विआयामी ऐरे एक-आयामी ऐरों का संग्रह है और त्रिआयामी ऐरे द्विआयामी ऐरों का। मल्टी डेटा और मल्टी साइज ऐरे C की शब्दावली में हैं ही नहीं। मल्टी बाइट byte से जुड़ा शब्द है, आयाम से नहीं। इसलिए सही उत्तर तीसरा विकल्प है।
An array whose every element is itself an array is called a multi dimensional array. For example int ary[2][3]; holds two arrays, and each of them holds three elements. In the same way a 2D array is a collection of 1D arrays and a 3D array is a collection of 2D arrays. Multi data array and multi size array are not C terms at all, and multi byte refers to bytes rather than to dimensions.
प्रश्न 10उत्तर + हल
C ऐरे ary[10] और ary[10][10] के बीच अंतर क्या है?
What is the difference between C Arrays ary[10] and ary[10][10]?
Aary[10] एक सिंगल डायमेंशनल ऐरे है; ary[10][10] एक मल्टीडायमेंशनल ऐरे है।ary[10] is a single dimensional array. ary[10][10] is a Multidimensional array.
Bary[10] एक मल्टीडायमेंशनल ऐरे है; ary[10][10] एक सिंगल डायमेंशनल ऐरे है।ary[10] is a multidimensional array. ary[10][10] is a single dimensional array.
Cary[10] का आकार sizeof(10* int) है और ary[10][10] का आकार भी sizeof(10*int) है।Size of ary[10] is sizeof(10* int). Size of ary[10][10] is sizeof(10*int).
Dउपरोक्त में से कोई नहींNone of the above
सही उत्तर / Answer: (A)
हल / Solution
एक कोष्ठक वाला पहला रूप एकल आयामी ऐरे है — दस सदस्यों की सीधी पंक्ति। दो कोष्ठक वाला दूसरा रूप बहु-आयामी है, यानी दस पंक्ति और दस स्तंभ की तालिका, कुल सौ सदस्य। इसलिए पहला कथन ही सही बैठता है। दोनों का आकार बराबर भी नहीं होता: पहला दस सदस्यों की जगह लेता है और दूसरा उसका दस गुना, सो तीसरा कथन ग़लत है और उसे बताने वाला विकल्प भी।
The first form, with one bracket, is a single dimensional array, a plain row of ten elements. The second form, with two brackets, is multidimensional, a table of ten rows and ten columns holding a hundred elements. So the first statement is the fitting one. Their sizes are not equal either: the first takes room for ten elements and the second ten times as much, which makes the third statement wrong.
आगे के 20 प्रश्नों के उत्तर और हल app मेंFliQi Question Bank — अभ्यास, हल और आपकी प्रगति
C लैंग्वेज में मल्टीडायमेंशनल ऐरे के बारे में कौन सा कथन ग़लत है?
Which statement is incorrect about multidimensional array in C Language?
Aयह पंक्तियों (rows) और स्तंभों (columns) के साथ एक मैट्रिक्स या तालिका की तरह है।It is like a matrix or table with rows and columns
Bयह ऐरे का एक ऐरे है।It is an array of arrays
Cतीसरी पंक्ति के दूसरे एलीमेंट तक पहुँचने के लिए ary[3][2] का उपयोग करें, क्योंकि इंडेक्स 0 पंक्ति या स्तंभ से शुरू होता है।To access 3rd row 2nd element use ary[3][2] as the index starts from 0 row or column
Dमल्टीडायमेंशनल ऐरे में हम पंक्तियों और स्तंभों का प्रबंधन करते हैं।In multidimensional array we manage rows and columns.
What is the incorrect statement about the need of C arrays?
Aआपको इतने सारे अलग-अलग वैरिएबल बनाने की आवश्यकता नहीं है और उपयोग करते समय भ्रमित होने की आवश्यकता नहीं है।You need not create so many separate variables and get confused while using.
Bएक सिंगल ऐरे वैरिएबल का उपयोग करके, आप ऐरे के सभी एलीमेंट्स को आसानी से एक्सेस कर सकते हैं।Using a single Array variable, you can access all elements of the array easily.
Cप्रोग्रामर और मेंटेनर के लिए कोड मेंटेन करना आसान है।Code maintainability is easy for programmers and maintainers.
Dयदि हम विभिन्न प्रकार के अनेक मानों को स्टोर करना चाहते हैं तो हमें एक ऐरे का उपयोग करने की आवश्यकता है।If we want to store multiple values of different types then we need to use an array.