Which concept refers to adding new program components while the application is running (rather than at compile/link time)? Pick the term commonly used in C/C++ systems.

Difficulty: Easy

Correct Answer: Dynamic loading

Explanation:


Introduction:
Large systems sometimes need to extend functionality on the fly—for example, by loading plug-ins without stopping the process. This question targets the term for bringing code into a running process image.


Given Data / Assumptions:

  • Runtime extensibility is desired.
  • Context: C/C++ or OS-level facilities (e.g., dlopen/LoadLibrary).
  • We are not changing types or dispatch rules, only adding modules.


Concept / Approach:
Dynamic loading means loading code/data from external modules during execution. On POSIX systems, dlopen/dlsym handle shared objects; on Windows, LoadLibrary/GetProcAddress manage DLLs. This is distinct from dynamic typing (type systems) or dynamic binding (virtual function dispatch); it is about module loading and symbol resolution at runtime.


Step-by-Step Solution:
1) Compile plug-ins as shared libraries.2) At runtime, call the platform loader API to bring the module into memory.3) Resolve function pointers with dlsym/GetProcAddress.4) Invoke newly loaded functionality without restarting the application.


Verification / Alternative check:
Unload and reload modules to confirm swapping behavior; check symbol tables to verify late binding of addresses to function pointers.


Why Other Options Are Wrong:
Data hiding: encapsulation concern, not module loading.Dynamic typing: property of languages like Python, not C++.Dynamic binding: runtime choice among virtual overrides, not loading code.


Common Pitfalls:
Forgetting ABI stability and versioning. Not handling loader errors or symbol name mangling (extern "C" helps for C++ exports).


Final Answer:
Dynamic loading

More Questions from OOPS Concepts

Discussion & Comments

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