Dynamic Linking and Loading MCQs December 19, 2025December 14, 2024 by u930973931_answers 30 min Score: 0 Attempted: 0/30 Subscribe 1. What is dynamic linking? (A) Linking libraries at runtime (B) Linking libraries at compile time (C) Copying source code into the main program (D) Ignoring library calls 2. Which of the following is an advantage of dynamic linking? (A) Eliminates all runtime errors (B) Increases compile time (C) Reduces executable size (D) Requires all libraries to be static 3. What is the main purpose of dynamic loading? (A) To convert source code into machine code (B) To link all libraries at compile time (C) To optimize disk usage during compilation (D) To load code into memory only when needed 4. Which file format is commonly used for dynamic libraries in Windows? (A) lib (B) dll (C) exe (D) obj 5. Which file format is commonly used for shared libraries in Linux/Unix? (A) exe (B) dll (C) so (D) lib 6. When does the linker resolve external symbols in dynamic linking? (A) At load time or runtime (B) At compile time (C) Before compilation (D) During optimization 7. Which of the following is a risk of dynamic linking? (A) Executable size increases (B) Faster program start (C) Reduced memory usage (D) Version conflicts of shared libraries (DLL hell) 8. What is a stub in dynamic linking? (A) A static variable (B) The full implementation of a library function (C) A temporary placeholder for a function call resolved at runtime (D) The entry point of the main program 9. Which of the following is true about static linking compared to dynamic linking? (A) Both A and C (B) Static linking resolves symbols at runtime (C) Static linking reduces program independence (D) Static linking increases executable size 10. What is “lazy binding” in dynamic linking? (A) Resolving all library addresses at program start (B) Linking libraries statically (C) Resolving library addresses only when a function is first called (D) Loading code in the background 11. Which component is responsible for loading dynamic libraries at runtime? (A) Compiler (B) Linker (C) Loader/Runtime linker (D) Assembler 12. What is the main disadvantage of dynamic linking? (A) Increased executable size (B) Slower program startup due to runtime symbol resolution (C) Reduced modularity (D) Incompatibility with shared libraries 13. Which function is used in C to dynamically load a library in Unix/Linux? (A) fopen() (B) LoadLibrary() (C) dlopen() (D) malloc() 14. Which function is used in Windows to dynamically load a library? (A) fopen() (B) dlopen() (C) malloc() (D) LoadLibrary() 15. What is the purpose of dlsym() in dynamic loading? (A) To open a shared library (B) To allocate memory (C) To close a library (D) To obtain the address of a symbol (function or variable) from a shared library 16. Which of the following functions is used to close a dynamically loaded library in Unix/Linux? (A) LoadLibrary() (B) dlclose() (C) free() (D) fclose() 17. What is the term for conflicts caused by multiple versions of a dynamic library? (A) Library collision (B) Runtime exception (C) Linker error (D) DLL hell 18. Which technique helps avoid “DLL hell”? (A) Statically linking everything (B) Versioning libraries (C) Removing shared libraries (D) Ignoring updates 19. Which of the following is true about position-independent code (PIC)? (A) Can be loaded at any memory address (B) Requires static linking (C) Cannot be used in shared libraries (D) Must always be loaded at a fixed address 20. What is the main advantage of position-independent code in dynamic linking? (A) Reduces runtime overhead (B) Increases executable size (C) Eliminates all runtime errors (D) Allows multiple processes to share a single copy of the library in memory 21. Which type of binding resolves all addresses at program load time? (A) Static binding (B) Run-time binding (C) Lazy binding (D) Early dynamic binding 22. What happens if a required dynamic library is missing at runtime? (A) The program runs normally (B) Runtime error or failure to start (C) The compiler automatically links it (D) The loader ignores it 23. Which of the following is NOT a component of dynamic linking? (A) Loader (B) Source code editor (C) Symbol table (D) Stub 24. What is the main benefit of shared libraries over static libraries? (A) Faster compilation (B) Guaranteed version compatibility (C) Reduced memory and disk usage by sharing code among programs (D) Eliminates runtime errors 25. Which linker resolves undefined symbols in dynamic linking? (A) Static linker (B) Assembler (C) Runtime linker (dynamic linker) (D) Compiler 26. What is an import table in dynamic linking? (A) A list of all local variables (B) A table of external functions and symbols that a program needs from shared libraries (C) A memory allocation table (D) A table of compiler errors 27. Which of the following is true about early binding? (A) Resolves addresses at runtime only when functions are called (B) Is slower than lazy binding in all cases (C) Cannot be used with shared libraries (D) Resolves addresses at load time 28. Which of the following can reduce the startup overhead of dynamically linked programs? (A) Lazy binding (B) Loading all libraries at compile time (C) Removing shared libraries (D) Linking statically 29. What is a relocation in dynamic linking? (A) Moving source code files (B) Copying libraries to another folder (C) Adjusting memory addresses of functions and variables when a library is loaded (D) Optimizing execution speed 30. Which of the following best describes the difference between dynamic linking and dynamic loading? (A) Both are the same (B) Dynamic linking loads code on demand; dynamic loading resolves symbols at runtime (C) Dynamic linking resolves symbols at runtime; dynamic loading loads code on demand (D) Dynamic linking happens only in Unix, dynamic loading only in Windows