SSC IMD SA 2017 – Question 154

Question:

Which of the following statements is true?

निम्न में से कौन-सा कथन सत्य है?

Options:

  • While dealing with branching code, the assembler replaces the target with its address.
  • When dealing with branch code, the assembler does not replace until the test condition is satisfied.
  • While dealing with branching code, the assembler finds the branch offset and replaces the branch target with it.
  • While dealing with branch code, the assembler replaces the target with the value specified by the DATAWORD directive.
  • ब्रांांचिंंग कोड से निपटने के दौरान, तो ऐसेंब्लर टारगेट को उसके एड्रेेस के साथ बदल देता है।
  • जब शाखा के कोड के साथ काम करते हैं, तो कोडांतरक परीक्षण स्थिति संतुष्ट नहींं होने तक प्रतिस्थापित नहींं करता है।
  • ब्रांांचिंंग कोड के साथ काम करते समय, असेम्बलर शाखा ऑफसेट खोजता है और उसके साथ शाखा लक्ष्य को बदल देता है।
  • शाखा कोड के साथ काम करते समय, एसेम्ब्लेर डेटावर्ड निर्देश द्वारा निर्दिष्ट मान के साथ लक्ष्य को बदल देता है।’

Correct Answer: c)

Explanation:

Detailed Explanation:

The correct answer is c) While dealing with branching code, the assembler finds the branch offset and replaces the branch target with it (ब्रांचिंग कोड के साथ काम करते समय, असेम्बलर शाखा ऑफसेट खोजता है और उसके साथ शाखा लक्ष्य को बदल देता है।).

When handling branch instructions (such as conditional jumps BEQ, BNE, or unconditional jumps JMP):

  • In modern architectures, most branch instructions use PC-relative addressing rather than absolute addressing.
  • The source code specifies a symbolic label as the target of the branch (e.g., BEQ LOOP).
  • During assembly, the assembler computes the relative distance or branch offset:$$\text{Offset} = \text{Address}(\text{Target Label}) – \text{Address}(\text{Updated PC})$$
  • The assembler replaces the symbolic target label in the machine code format with this computed numerical offset field. This allows position-independent code (PIC) execution.

विस्तृत व्याख्या:

सही उत्तर c) ब्रांचिंग कोड के साथ काम करते समय, असेम्बलर शाखा ऑफसेट खोजता है और उसके साथ शाखा लक्ष्य को बदल देता है। है।

जब कोई एसेम्बलर ब्रांचिंग (जंप) निर्देशों (जैसे JMP, BEQ, BNE आदि) को प्रोसेस करता है:

  • कंप्यूटर आर्किटेक्चर में अधिकांश ब्रांच निर्देश PC-रिलेटिव एड्रेसिंग मोड का उपयोग करते हैं।
  • सोर्स प्रोग्राम में ब्रांच के गंतव्य को एक लेबल (Label) द्वारा दर्शाया जाता है।
  • एसेम्बलर लक्ष्य लेबल के वास्तविक पते और वर्तमान प्रोग्राम काउंटर (PC) के पते के बीच के अंतर यानी शाखा ऑफसेट (Branch Offset) की गणना करता है।
  • इसके बाद एसेम्बलर मशीन कोड में लक्ष्य लेबल को उस परिकलित ऑफसेट मान से बदल देता है।

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top