Software structuring in assembly and high-level languages: A small program unit written once and invoked multiple times from different places in a larger program is commonly called a(n) ________.

Difficulty: Easy

Correct Answer: subroutine

Explanation:


Introduction / Context:
Code reuse and modularity are central to software engineering. In assembly and higher-level languages alike, programmers encapsulate a repeated operation in a callable unit so that it is written once and used many times, reducing duplication and improving maintainability.



Given Data / Assumptions:

  • The construct can be invoked from multiple points in the program.
  • Control returns to the caller after execution (unless specified otherwise).
  • It may use parameters and return values or registers according to calling conventions.


Concept / Approach:
The standard term for such a reusable program unit is “subroutine.” In various languages, equivalent terms include function, procedure, method, or routine. In assembly, CALL transfers control to the subroutine; RET returns to the caller, often using the stack for return addresses and parameters.



Step-by-Step Solution:

Identify the requirement: write once, call many times.Map to terminology: subroutine/function/procedure.Note call/return mechanism via stack or linkage register.Select “subroutine.”


Verification / Alternative check:
Programming texts and ABIs define subroutines with calling conventions (parameter passing, register saving, return values).



Why Other Options Are Wrong:

string: A data structure, not executable code.interrupt: An asynchronous event/handler mechanism triggered by hardware or software, not a normal reusable routine.processor control: A vague phrase; not the standard term here.


Common Pitfalls:
Confusing interrupts with normal calls; mixing “macro” (textual expansion) with subroutines (single copy executed via call).


Final Answer:
subroutine

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion