[C Programming MCQS ]
झारखंड में आयोजित होने वाली JPSC, JSSC, JET, झारखंड पुलिस भर्ती परीक्षा आदि के लिए उपयोगी सामान्य अध्ययन।
[ C Programming MCQS ]
Useful GK for JPSC, JSSC, JET, Jharkhand Police and other exams.
61. निम्न Program में x का मान क्या होगा?
int x,y=10; char z='a'; x=y+z;
[A] Invalid
[B] 17
[C] 107
[D] 10a
61. What would be the value of X after execution?
int x,y=10; char z='a'; x=y+z;
[A] Invalid
[B] 17
[C] 107
[D] 10a
सही उत्तर: 107
व्याख्या: ASCII में a का मान 97 होता है, इसलिए x=10+97=107।
Correct Answer: 107
Explanation: ASCII value of a is 97, so x=107.
62. दिए गए Program का Output क्या होगा?
[A] 93
[B] 92
[C] 91
[D] 90
62. What will be the output of the given program?
[A] 93
[B] 92
[C] 91
[D] 90
सही उत्तर: 92
व्याख्या: Comma Operator के अनुसार अंतिम Expression का मान c में जाता है और Pre-decrement के बाद Output 92 होता है।
Correct Answer: 92
Explanation: After evaluating the comma expression and pre-decrement, the output is 92.
63. Switch Program का Output क्या होगा?
[A] 7
[B] 5
[C] 2
[D] None of above
63. What will be the output of the given switch program?
[A] 7
[B] 5
[C] 2
[D] None of above
सही उत्तर: None of above
व्याख्या: a/a%b = (7/7)%5 = 1। Case 1 से Fall-through होगा: a=2 →7 →35 →7, अंतिम Output 7 है, इसलिए दिए गए विकल्पों में सही उत्तर None of above नहीं बल्कि 7 होना चाहिए। यदि Fall-through माना जाए तो Output 7 है।
Correct Answer: 7
Explanation: The expression evaluates to 1, execution falls through all cases and final output becomes 7.
64. ________ Operator दो Operands पर कार्य करता है, जबकि ________ Operator एक Operand पर कार्य करता है।
[A] Binary, Unary
[B] Ternary, Binary
[C] Unary, Ternary
[D] None of these
64. A ________ operator applies to two operands, while a ________ operator applies to a single operand.
[A] Binary, Unary
[B] Ternary, Binary
[C] Unary, Ternary
[D] None of these
सही उत्तर: Binary, Unary
व्याख्या: Binary Operator दो Operands पर तथा Unary Operator एक Operand पर कार्य करता है।
Correct Answer: Binary, Unary
Explanation: A binary operator works on two operands, whereas a unary operator works on one operand.
65. ________ एक स्थान है जहाँ हम Value Store कर सकते हैं। INT का आकार ________ bits होता है।
[A] int, 2
[B] variable, 2
[C] variable, 16
[D] int, 16
65. A ________ is a place where we can store values. Size of INT is ____________ bits.
[A] int, 2
[B] variable, 2
[C] variable, 16
[D] int, 16
सही उत्तर: variable, 16
व्याख्या: Variable डेटा को Store करने का स्थान है। पारंपरिक C में int का आकार 16 bits माना जाता है।
Correct Answer: variable, 16
Explanation: A variable is a storage location for values. Traditionally, int occupies 16 bits.
66. Variable में Letters, Numbers और __________ का उपयोग किया जा सकता है, लेकिन __________ का उपयोग नहीं किया जा सकता।
[A] Underscore, keyword
[B] Alphabets, underscore
[C] Identifier, keyword
[D] Underscore, identifier
66. Variable consist of letters, numbers and _________________. You can’t use ___________.
[A] Underscore, keyword
[B] Alphabets, underscore
[C] Identifier, keyword
[D] Underscore, identifier
सही उत्तर: Underscore, keyword
व्याख्या: Variable Name में Underscore का उपयोग किया जा सकता है, लेकिन C Keyword का उपयोग नहीं किया जा सकता।
Correct Answer: Underscore, keyword
Explanation: Variables may contain letters, digits and underscores, but keywords cannot be used as variable names.
67. दिए गए Program के Execution के बाद STR1 का मान क्या होगा?
[A] India is my Country!!
[B] India is my !!yrtnuoC
[C] India is my Country
[D] None of these
67. What will be the value of STR1 after execution of the above program?
[A] India is my Country!!
[B] India is my !!yrtnuoC
[C] India is my Country
[D] None of these
सही उत्तर: India is my Country
व्याख्या: strrev("!!yrtnuoC") = "Country!!" तथा strlen("Gujarat") = 7, इसलिए strncat() केवल पहले 7 अक्षर "Country" जोड़ता है।
Correct Answer: India is my Country
Explanation: strrev converts "!!yrtnuoC" to "Country!!". strncat appends only 7 characters, resulting in "India is my Country".
68. दिए गए Program का Output क्या होगा?
[A] 10
[B] 9
[C] 11
[D] 12
68. What will be the output of the given program?
[A] 10
[B] 9
[C] 11
[D] 12
सही उत्तर: 11
व्याख्या: count=1 और digit=0 से शुरू होते हैं। Loop digit=0 से 9 तक कुल 10 बार चलता है, इसलिए count = 11 हो जाता है।
Correct Answer: 11
Explanation: The loop executes 10 times, incrementing count from 1 to 11.
69. दिए गए Program का Output क्या होगा?
[A] i=5, k=5
[B] i=4, k=4
[C] i=5, k=4
[D] i=4, k=5
69. What will be the output of the following program?
[A] i=5, k=5
[B] i=4, k=4
[C] i=5, k=4
[D] i=4, k=5
सही उत्तर: i=5, k=4
व्याख्या: j=5 होने पर i=2*5/2=5 जबकि k=2*(5/2)=2*2=4 होगा।
Correct Answer: i=5, k=4
Explanation: i becomes 5 and k becomes 4 because integer division is evaluated first inside parentheses.
70. दिए गए Program का Output क्या होगा?
[A] b=4,c=6
[B] b=3,c=8
[C] b=3,c=6
[D] b=4,c=8
70. Study the following program. What will be the output?
[A] b=4,c=6
[B] b=3,c=8
[C] b=3,c=6
[D] b=4,c=8
सही उत्तर: b=4,c=8
व्याख्या: a=2 से शुरू होता है। b=2*(a++)=4 तथा a=3 हो जाता है। फिर c=2*(++a)=2*4=8।
Correct Answer: b=4,c=8
Explanation: Post-increment gives b=4 and pre-increment makes c=8.