पहले 10 प्रश्नों के उत्तर और हल यहीं खुले हैं; बाक़ी 20 के उत्तर और हल FliQi Question Bank app में।
भाषा
प्रश्न 1उत्तर + हल
C में लॉजिकल या रिलेशनल एक्सप्रेशन का परिणाम क्या होता है?
What is the result of a logical or relational expression in C?
A0 या 10 or 1
BTrue या falseTrue or false
Cfalse पर 0 और true पर कोई धनात्मक संख्या0 if false and a positive number if true.
DT या FT or F
सही उत्तर / Answer: (A)
हल / Solution
C में <, ==, &&, ||, ! जैसे ऑपरेटरों का परिणाम int प्रकार का होता है। शर्त झूठी हो तो मान 0 और सच हो तो ठीक 1 मिलता है। जैसे printf("%d", 5 > 3) 1 छापता है। C में true/false या T/F जैसे शब्द परिणाम के रूप में नहीं आते, इसलिए B और D ग़लत हैं। C भी ग़लत है, क्योंकि सच होने पर कोई भी धनात्मक संख्या नहीं, हमेशा 1 ही आता है।
In C the result of operators such as <, ==, &&, || and ! has type int. It is 0 when the condition is false and exactly 1 when it is true. For example, printf("%d", 5 > 3) prints 1. C does not produce words like true/false or T/F as results, so B and D are wrong. C is also wrong because a true result is always 1, not just any positive number.
प्रश्न 2उत्तर + हल
निम्नलिखित में से कौन सा कथन सत्य है?
Which of the following statement is true?
Aसभी अरिथमेटिक ऑपरेटरों की प्रीसीडेन्स का स्तर समान है।All arithmetic operators have the same level of precedence.
Bमॉड्यूलस ऑपरेटर % का उपयोग किसी भी डेटा टाइप के साथ किया जा सकता है।The modulus operator % can be used with any data type.
Cएक यूनरी एक्सप्रेशन में ऑपरेटर के बिना केवल एक ऑपरेंड होता है।A unary expression consists of only one operand without operators.
Dऑपरेटरों <=, >= और != सभी की प्रीसीडेन्स का स्तर समान नहीं है।The operators <=, >=, and != all have not the same level of priority.
सही उत्तर / Answer: (D)
हल / Solution
<= और >= relational ऑपरेटर हैं, जबकि != equality ऑपरेटर है। relational की precedence equality से एक स्तर ऊपर है, इसलिए तीनों का स्तर समान नहीं है। यही कथन सत्य है। A ग़लत है, क्योंकि *, /, % का स्तर +, - से ऊपर है। B ग़लत है, क्योंकि % सिर्फ़ integer पर चलता है, float पर नहीं। C ग़लत है, क्योंकि unary expression में एक ऑपरेटर और एक operand होता है, जैसे -x।
The <= and >= operators are relational, while != is an equality operator. Relational operators are one level above equality operators, so the three are not on the same level, and that statement is true. A is false because *, / and % rank above + and -. B is false because % works only on integers, not on float. C is false because a unary expression has one operator and one operand, as in -x.
प्रश्न 3उत्तर + हल
निम्नलिखित में से किस ऑपरेटर की प्रायोरिटी सबसे अधिक है?
Which among the following operators has the highest priority?
AComma ऑपरेटरComma operator
BConditional ऑपरेटरConditional operator
CRelational ऑपरेटरRelational operator
DUnary plus ऑपरेटरUnary plus operator
सही उत्तर / Answer: (D)
हल / Solution
unary plus (+a) एक unary ऑपरेटर है। C में unary समूह सिर्फ़ postfix से नीचे है, यानी बहुत ऊँचा। relational ऑपरेटर (<, >, <=, >=) arithmetic और shift के बाद आते हैं। conditional ?: logical ऑपरेटरों से भी नीचे है। comma की precedence सभी ऑपरेटरों में सबसे कम है। इसलिए क्रम unary plus > relational > conditional > comma बनता है, और उत्तर unary plus है।
Unary plus (+a) is a unary operator. In C the unary group is below only the postfix group, so it is very high. Relational operators (<, >, <=, >=) come after arithmetic and shift operators. The conditional ?: is even below the logical operators, and the comma has the lowest precedence of all. So the order is unary plus > relational > conditional > comma, and the answer is unary plus.
प्रश्न 4उत्तर + हल
निम्नलिखित में से किस ऑपरेटर की प्रायोरिटी सबसे कम है?
Which of the following operators has the lowest priority?
A&&
B+
C*
D!=
सही उत्तर / Answer: (A)
हल / Solution
दिए गए ऑपरेटरों का क्रम ऊपर से नीचे यह है: * (गुणा) > + (जोड़) > != (equality) > && (logical AND)। arithmetic ऑपरेटर relational और equality से ऊपर हैं, और logical ऑपरेटर उनसे भी नीचे। जैसे a + b * c != 0 && x में पहले b * c, फिर +, फिर !=, और अंत में && लगता है। इसलिए सबसे कम priority && की है, और +, *, != ग़लत हैं।
The given operators rank from top to bottom as * (multiplication) > + (addition) > != (equality) > && (logical AND). Arithmetic operators are above relational and equality operators, and logical operators are below those. In a + b * c != 0 && x, b * c is done first, then +, then !=, and finally &&. So && has the lowest priority, and +, * and != are wrong.
प्रश्न 5उत्तर + हल
निम्नलिखित में से किस ऑपरेटर की अस्सोसिएटिविटी दाएँ से बाएँ है?
Which of the following operators has right to left associativity?
AUnary ऑपरेटरUnary Operators
BAssignment ऑपरेटरAssignment Operators
CTernary ऑपरेटरTernary Operators
Dउपरोक्त सभीAll of the above
सही उत्तर / Answer: (D)
हल / Solution
C में तीन समूह दाएँ से बाएँ जुड़ते हैं। पहला, unary ऑपरेटर: *&p में पहले &p, फिर *। दूसरा, assignment ऑपरेटर: a = b = c को a = (b = c) पढ़ा जाता है। तीसरा, ternary ?: ऑपरेटर: a ? b : c ? d : e को a ? b : (c ? d : e) पढ़ा जाता है। बाक़ी लगभग सभी binary ऑपरेटर बाएँ से दाएँ जुड़ते हैं। तीनों विकल्प सही हैं, इसलिए उत्तर 'उपरोक्त सभी' है।
In C three groups associate right to left. First, unary operators: in *&p, &p is formed first and then * is applied. Second, assignment operators: a = b = c is read as a = (b = c). Third, the ternary ?: operator: a ? b : c ? d : e is read as a ? b : (c ? d : e). All three options are correct, so the answer is all of the above.
प्रश्न 6उत्तर + हल
निम्नलिखित में से किस ऑपरेटर समूह की प्रीसीडेन्स सबसे कम है?
Which of the following operators has lowest precedence?
ALogical ऑपरेटर (&& और ||)Logical Operators (&& and ||)
compound assignment ऑपरेटर (+=, -=, *=, /= आदि) साधारण = के साथ एक ही स्तर पर हैं। C में इनके नीचे सिर्फ़ comma ऑपरेटर आता है। इसलिए x += a && b में पहले a && b निकलता है, फिर += लगता है। दिए गए समूहों का क्रम है: unary > arithmetic > logical > compound assignment। unary सबसे ऊपर हैं, arithmetic बीच में और logical इनसे नीचे, पर assignment से ऊपर।
Compound assignment operators (+=, -=, *=, /= and so on) share the level of the plain = operator. In C only the comma operator lies below them. So in x += a && b, a && b is found first and then += is applied. The order of the given groups is unary > arithmetic > logical > compound assignment. Unary is at the top, arithmetic in the middle, and logical below them but still above assignment.
प्रश्न 7उत्तर + हल
निम्नलिखित में से किस ऑपरेटर समूह की प्रीसीडेन्स सबसे अधिक है?
Which of the following operators has highest precedence?
ALogical ऑपरेटर (&& और ||)Logical Operators (&& and ||)
C की तालिका में ऊपर से नीचे मोटा क्रम यह है: postfix, unary, arithmetic (*, /, % फिर +, -), shift, relational, equality, bitwise, logical (&&, ||), conditional, assignment और अंत में comma। दिए गए चार समूहों में unary ऑपरेटर (!, ++, --, unary -, sizeof आदि) सबसे ऊपर हैं। arithmetic उनसे नीचे, logical और नीचे, और compound assignment लगभग सबसे नीचे आते हैं। इसलिए उत्तर unary ऑपरेटर है।
The C table, from top to bottom, roughly runs: postfix, unary, arithmetic (*, /, % then +, -), shift, relational, equality, bitwise, logical (&&, ||), conditional, assignment and finally comma. Among the four groups given, unary operators (!, ++, --, unary -, sizeof and so on) are the highest. Arithmetic comes below them, logical lower still, and compound assignment near the bottom. So the answer is unary operators.
प्रश्न 8उत्तर + हल
निम्नलिखित में से किस ऑपरेटर की अस्सोसिएटिविटी दाएँ से बाएँ है?
Which of the following operators has right to left associativity?
A!=
B!
C==
D,
सही उत्तर / Answer: (B)
हल / Solution
! (logical NOT) एक unary ऑपरेटर है। C में सभी unary ऑपरेटरों की associativity दाएँ से बाएँ होती है। जैसे !!a में पहले दायाँ ! लगता है, फिर बायाँ। != और == equality ऑपरेटर हैं, जो बाएँ से दाएँ जुड़ते हैं। comma (,) भी बाएँ से दाएँ जुड़ता है, इसलिए a, b, c में पहले a, फिर b, फिर c निकलता है। इसलिए दिए गए विकल्पों में केवल ! सही है।
The ! operator (logical NOT) is a unary operator, and all unary operators in C group right to left. In !!a, the right ! is applied first and then the left one. The != and == operators are equality operators that group left to right. The comma operator also groups left to right, so in a, b, c the parts are evaluated from a to c. So only ! fits among the options.
प्रश्न 9उत्तर + हल
टर्नरी ऑपरेटर के साथ कितने ऑपरेंड का उपयोग किया जाता है?
How many operands are used with ternary operator?
A1
B2
C3
D4
सही उत्तर / Answer: (C)
हल / Solution
ternary का अर्थ ही है तीन। C का ternary ऑपरेटर ?: (conditional operator) है और यह तीन operands लेता है: condition ? exp1 : exp2। पहला operand condition है, दूसरा वह मान जो सच होने पर मिलेगा, और तीसरा वह जो झूठ होने पर मिलेगा। एक operand वाले ऑपरेटर unary कहलाते हैं और दो वाले binary। चार operands वाला कोई ऑपरेटर C में नहीं है।
Ternary simply means three. The ternary operator in C is ?:, the conditional operator, and it takes three operands: condition ? exp1 : exp2. The first operand is the condition, the second is the value used when it is true, and the third is used when it is false. Operators with one operand are unary and those with two are binary. C has no operator with four operands.
प्रश्न 10उत्तर + हल
निम्नलिखित में से किस ऑपरेटर की प्रीसीडेन्स सबसे कम है?
Which of the following operators has the lowest precedence?
A()
B[]
C->
Dसभी ऑपरेटरों की precedence समान हैAll operators have same precedence
सही उत्तर / Answer: (D)
हल / Solution
() (function call), [] (array subscript) और -> (pointer से member) तीनों postfix ऑपरेटर हैं। C की तालिका में ये सब एक ही सबसे ऊँचे स्तर पर हैं और बाएँ से दाएँ जुड़ते हैं। इसलिए इनमें से किसी की precedence दूसरों से कम नहीं है। जैसे a[i]->x में पहले a[i] बनता है, फिर ->, क्योंकि स्तर समान है और क्रम associativity से तय होता है। इसलिए सही उत्तर D है।
The () (function call), [] (array subscript) and -> (member through pointer) operators are all postfix operators. In the C table they share the same top level and group left to right. So none of them has lower precedence than the others. In a[i]->x, a[i] is formed first and then -> is applied, only because of left-to-right associativity. So the answer is D.
आगे के 20 प्रश्नों के उत्तर और हल app मेंFliQi Question Bank — अभ्यास, हल और आपकी प्रगति
निम्नलिखित C कोड का आउटपुट क्या होगा? #include <stdio.h> int main(){ int p = 10, q = 20, r; if (r = p = 5 || q > 20) printf("%d", r); else printf("No Output\n"); }
What will be the output of the following C code? #include <stdio.h> int main(){ int p = 10, q = 20, r; if (r = p = 5 || q > 20) printf("%d", r); else printf("No Output\n"); }
निम्नलिखित C कोड का आउटपुट क्या होगा? #include <stdio.h> int main(){ int a = -1, b = 4, c = 1, d; d = ++a && ++b || ++c; printf("%d, %d, %d, %d\n", a, b, c, d); return 0; }
What will be the output of the following C code? #include <stdio.h> int main(){ int a = -1, b = 4, c = 1, d; d = ++a && ++b || ++c; printf("%d, %d, %d, %d\n", a, b, c, d); return 0; }
निम्नलिखित C कोड का आउटपुट क्या होगा? #include<stdio.h> int main(){ int a = 1, b = 2, c = 3, d = 4, e; e = c + d = b * a; printf("%d, %d\n", e, d); }
What will be the output of the following C code? #include<stdio.h> int main(){ int a = 1, b = 2, c = 3, d = 4, e; e = c + d = b * a; printf("%d, %d\n", e, d); }