31 Programming Languages and Translators • Programming Basics C भाषा में पूर्णांकों के लिए 17 % 5 का परिणाम क्या है? In C, what is the result of 17 % 5 for integer operands? A. 3 3 B. 3.4 3.4 C. 5 5 D. 2 2 उत्तर और व्याख्या देखें Show answer and explanation सही उत्तर: D Correct Answer: D % शेषफल देता है। 17 को 5 से भाग देने पर भागफल 3 और शेषफल 2 मिलता है। The % operator gives the remainder. Dividing 17 by 5 gives a quotient of 3 and a remainder of 2.
32 Programming Languages and Translators • Programming Basics Source code में सामान्य comments लिखने का प्रमुख उद्देश्य क्या है? What is the main purpose of ordinary comments in source code? A. हर गणना का परिणाम बदलना To change the result of every calculation B. प्रोसेसर की clock frequency बढ़ाना To increase processor clock frequency C. प्रोग्राम के उद्देश्य और तर्क को पाठक के लिए समझाना To explain the program purpose and logic to readers D. हर variable को constant में बदलना To convert every variable into a constant उत्तर और व्याख्या देखें Show answer and explanation सही उत्तर: C Correct Answer: C Comments कोड को समझने और बनाए रखने में सहायता करते हैं। सामान्य comments प्रोग्राम के निष्पादन योग्य निर्देश नहीं होते। Comments help readers understand and maintain code. Ordinary comments are not executable program instructions.
33 Programming Languages and Translators • Programming Basics C में एक ही प्रकार के कई मानों को एक नाम के अंतर्गत index से एक्सेस करने के लिए किसका उपयोग किया जाता है? In C, what is used to access multiple values of the same type under one name using an index? A. Array Array B. Comment Comment C. Keyword Keyword D. Operator Operator उत्तर और व्याख्या देखें Show answer and explanation सही उत्तर: A Correct Answer: A Array एक ही प्रकार के तत्वों का संग्रह है। प्रत्येक तत्व को उसके index से संदर्भित किया जा सकता है। An array is a collection of elements of the same type. Each element can be referenced using its index.
34 Programming Languages and Translators • Programming Basics एक ही कार्य करने वाले कोड को बार-बार लिखने के बजाय function में रखने का प्रमुख लाभ क्या है? What is a main benefit of placing code for a repeated task in a function instead of rewriting it each time? A. प्रोग्राम में सभी त्रुटियाँ अपने आप समाप्त हो जाती हैं All program errors are automatically eliminated B. कोड का पुनः उपयोग और रखरखाव आसान होता है Code reuse and maintenance become easier C. कंप्यूटर को ऑपरेटिंग सिस्टम की आवश्यकता नहीं रहती The computer no longer needs an operating system D. हर फ़ाइल का आकार हमेशा आधा हो जाता है Every file always becomes half its original size उत्तर और व्याख्या देखें Show answer and explanation सही उत्तर: B Correct Answer: B Function संबंधित कार्य को एक इकाई में संगठित करता है। आवश्यकता होने पर उसे दोबारा बुलाया जा सकता है, जिससे अनावश्यक दोहराव घटता है। A function organizes a task into a unit that can be called again when needed, reducing unnecessary code duplication.
35 Programming Languages and Translators • Translators and Errors C में जिस statement के अंत में semicolon आवश्यक है, वहाँ उसे छोड़ देना सामान्यतः किस प्रकार की त्रुटि है? In C, omitting a semicolon where one is required at the end of a statement is generally what type of error? A. हार्डवेयर त्रुटि Hardware error B. केवल नेटवर्क त्रुटि Only a network error C. केवल तार्किक त्रुटि Only a logical error D. Syntax error Syntax error उत्तर और व्याख्या देखें Show answer and explanation सही उत्तर: D Correct Answer: D आवश्यक semicolon छोड़ने से भाषा के व्याकरण का उल्लंघन होता है। Compiler सामान्यतः ऐसी syntax त्रुटि का निदान देता है। Omitting a required semicolon violates the language grammar. A compiler generally reports a diagnostic for such a syntax error.
36 Programming Languages and Translators • Translators and Errors Python में 10 / 0 निष्पादित करने पर सामान्यतः क्या होता है? What normally happens when 10 / 0 is executed in Python? A. परिणाम 0 मिलता है The result is 0 B. परिणाम 10 मिलता है The result is 10 C. ZeroDivisionError उत्पन्न होता है A ZeroDivisionError is raised D. यह केवल comment बन जाता है It becomes only a comment उत्तर और व्याख्या देखें Show answer and explanation सही उत्तर: C Correct Answer: C Python में शून्य से भाग देने पर ZeroDivisionError उत्पन्न होता है। यह निष्पादन के समय आने वाला exception है। Division by zero in Python raises ZeroDivisionError. This is an exception occurring during execution.
37 Programming Languages and Translators • Translators and Errors आयत का क्षेत्रफल निकालने वाला प्रोग्राम length × breadth के बजाय length + breadth करता है। यदि वह बिना रुके चलता है, तो मुख्य त्रुटि क्या है? A program calculates rectangle area using length + breadth instead of length × breadth. If it runs without stopping, what is the main error? A. Logical error Logical error B. अनिवार्य syntax error A necessary syntax error C. कीबोर्ड हार्डवेयर त्रुटि A keyboard hardware error D. फ़ाइल एक्सटेंशन त्रुटि A file-extension error उत्तर और व्याख्या देखें Show answer and explanation सही उत्तर: A Correct Answer: A प्रोग्राम चल रहा है, लेकिन सूत्र गलत है। यह logical error है, जिसमें निर्देश वैध हो सकते हैं लेकिन परिणाम अपेक्षित नहीं होता। The program runs but uses an incorrect formula. This is a logical error: instructions may be valid while producing an unintended result.
38 Programming Languages and Translators • Translators and Errors किसी प्रोग्राम का सफलतापूर्वक compile हो जाना क्या सुनिश्चित नहीं करता? What does successful compilation of a program not ensure? A. Compiler ने संबंधित source code को स्वीकार किया The compiler accepted the relevant source code B. उसके परिणाम हर वैध input के लिए सही होंगे Its results will be correct for every valid input C. उस चरण में compilation रोकने वाली त्रुटि रिपोर्ट नहीं हुई No compilation-blocking error was reported at that stage D. Compilation चरण पूरा हुआ The compilation stage completed उत्तर और व्याख्या देखें Show answer and explanation सही उत्तर: B Correct Answer: B Successful compilation सही तर्क या हर स्थिति में सफल निष्पादन की गारंटी नहीं है। Logical errors और runtime समस्याएँ फिर भी हो सकती हैं। Successful compilation does not guarantee correct logic or successful execution in every situation. Logical errors and runtime problems can still occur.
39 Programming Languages and Translators • Programming Basics Flowchart में तीर वाली रेखाएँ मुख्यतः क्या दर्शाती हैं? What do arrowed lines primarily indicate in a flowchart? A. मेमोरी की कुल क्षमता Total memory capacity B. सभी variable के data types The data types of all variables C. प्रोग्राम की फ़ाइल का आकार The program file size D. चरणों के बीच नियंत्रण-प्रवाह की दिशा The direction of control flow between steps उत्तर और व्याख्या देखें Show answer and explanation सही उत्तर: D Correct Answer: D Flow lines चरणों को जोड़ती हैं और बताती हैं कि नियंत्रण किस दिशा में आगे बढ़ता है। निर्णय के बाद अलग शाखाएँ भी इन्हीं से दर्शाई जाती हैं। Flow lines connect steps and show the direction in which control proceeds. They also indicate branches following decisions.
40 Programming Languages and Translators • Programming Basics किसी algorithm का dry run करने का अर्थ क्या है? What does performing a dry run of an algorithm mean? A. बिना बिजली के कंप्यूटर चालू करना Starting a computer without electricity B. सभी comments हटाना Removing all comments C. नमूना input लेकर उसके चरणों और मानों को हाथ से ट्रेस करना Manually tracing its steps and values using sample input D. प्रोग्राम को अनिवार्य रूप से मशीन कोड में बदलना Necessarily converting the program into machine code उत्तर और व्याख्या देखें Show answer and explanation सही उत्तर: C Correct Answer: C Dry run में algorithm को कंप्यूटर पर चलाए बिना उसके चरणों का क्रम और variable के बदलते मान जाँचे जाते हैं। इससे तर्क की त्रुटियाँ खोजने में सहायता मिलती है। A dry run checks the sequence of steps and changing variable values without executing the algorithm on a computer. It helps identify logical mistakes.