Question
Download Solution PDFC में if-else कथन के बारे में निम्नलिखित में से कौन सा कथन सत्य नहीं है?
Answer (Detailed Solution Below)
Detailed Solution
Download Solution PDFव्याख्या:
दिया गया कथन, "एक if-else कथन को दूसरे if-else कथन के अंदर नेस्ट नहीं किया जा सकता है," C में if-else कथन के बारे में सत्य नहीं है। ऐसा इसलिए है क्योंकि C प्रोग्रामिंग भाषा में, if-else कथनों को वास्तव में एक दूसरे के अंदर नेस्ट किया जा सकता है। if-else कथनों को नेस्ट करने का मतलब है कि दूसरे if-else कथन के कोड ब्लॉक के अंदर एक या अधिक if-else कथन रखना। यह कई शर्तों को प्रभावी ढंग से संभालने के लिए अधिक जटिल सशर्त तर्क संरचनाओं के निर्माण की अनुमति देता है।
सही विकल्प: विकल्प 1
C प्रोग्रामिंग में, नेस्टेड if-else कथनों का उपयोग पदानुक्रमित तरीके से कई शर्तों का मूल्यांकन करने के लिए किया जाता है। यहाँ एक विस्तृत व्याख्या दी गई है:
नेस्टेड if-else कथन:
एक नेस्टेड if-else कथन एक if-else कथन है जो दूसरे if-else कथन में निहित है। यह संरचना प्रोग्रामर को कई शर्तों की जांच करने और इन शर्तों के परिणामों के आधार पर कोड के विभिन्न ब्लॉक को निष्पादित करने की अनुमति देती है।
उदाहरण:
#include
int main() {
int x = 10;
int y = 20;
if (x == 10) {
if (y == 20) {
printf("x is 10 and y is 20\n");
} else {
printf("x is 10 but y is not 20\n");
}
} else {
if (y == 20) {
printf("x is not 10 but y is 20\n");
} else {
printf("x is not 10 and y is not 20\n");
}
}
return 0;
}
उपरोक्त उदाहरण में, नेस्टेड if-else कथन प्रोग्राम को x और y दोनों के मानों की जांच करने और उनके मानों के आधार पर उपयुक्त संदेश प्रिंट करने की अनुमति देते हैं।
Last updated on Jun 16, 2025
-> RRB JE CBT 2 answer key 2025 for June 4 exam has been released at the official website.
-> Check Your Marks via RRB JE CBT 2 Rank Calculator 2025
-> RRB JE CBT 2 admit card 2025 has been released.
-> RRB JE CBT 2 city intimation slip 2025 for June 4 exam has been released at the official website.
-> RRB JE CBT 2 Cancelled Shift Exam 2025 will be conducted on June 4, 2025 in offline mode.
-> RRB JE CBT 2 Exam Analysis 2025 is Out, Candidates analysis their exam according to Shift 1 and 2 Questions and Answers.
-> The RRB JE Notification 2024 was released for 7951 vacancies for various posts of Junior Engineer, Depot Material Superintendent, Chemical & Metallurgical Assistant, Chemical Supervisor (Research) and Metallurgical Supervisor (Research).
-> The selection process includes CBT 1, CBT 2, and Document Verification & Medical Test.
-> The candidates who will be selected will get an approximate salary range between Rs. 13,500 to Rs. 38,425.
-> Attempt RRB JE Free Current Affairs Mock Test here
-> Enhance your preparation with the RRB JE Previous Year Papers.