24 Lecture
CS410
Midterm & Final Term Short Notes
Dynamic Link Libraries
Dynamic Link Libraries (DLLs) are modular files in Windows OS, containing reusable code and resources that multiple programs can use simultaneously. These external files improve efficiency by reducing redundancy and facilitating updates, ensurin
Important Mcq's
Midterm & Finalterm Prepration
Past papers included
Download PDF
**Question 1:** What does DLL stand for?
a) Dynamic Load Library
b) Dynamic Link Loader
c) Dynamic Link Library
d) Dynamic Language Locator
**Solution:** c) Dynamic Link Library
**Question 2:** Which of the following statements about DLLs is true?
a) DLLs are only used in Windows operating systems.
b) DLLs contain only executable code and no data.
c) DLLs cannot be loaded or unloaded dynamically.
d) DLLs promote code reusability by allowing multiple programs to share the same code.
**Solution:** d) DLLs promote code reusability by allowing multiple programs to share the same code.
**Question 3:** Which programming language is commonly used to create DLLs?
a) Java
b) Python
c) C++
d) HTML
**Solution:** c) C++
**Question 4:** What is the primary advantage of using DLLs?
a) They make the executable files larger.
b) They make the software less modular.
c) They enable code sharing and reduce redundancy.
d) They are platform-independent.
**Solution:** c) They enable code sharing and reduce redundancy.
**Question 5:** How are functions from a DLL accessed by a program?
a) By embedding the DLL code directly into the program.
b) By using a static link to the DLL.
c) By dynamically loading the DLL and calling its functions.
d) By creating a separate copy of the DLL for each program.
**Solution:** c) By dynamically loading the DLL and calling its functions.
**Question 6:** What is the purpose of the "GetProcAddress" function in Windows API?
a) To load the entire DLL into memory.
b) To retrieve the address of a function within a loaded DLL.
c) To compile the DLL source code.
d) To link the DLL statically.
**Solution:** b) To retrieve the address of a function within a loaded DLL.
**Question 7:** Which library is commonly used for dynamic loading of DLLs in C++?
a) libDLL
b) dlfcn
c) loadlib
d) dynamiclink
**Solution:** b) dlfcn
**Question 8:** In which memory space are DLLs loaded?
a) Separate memory space for each program
b) Shared memory space for all programs
c) Virtual memory space only
d) ROM memory space
**Solution:** b) Shared memory space for all programs
**Question 9:** What can be a potential drawback of using DLLs?
a) Increased memory usage for each program using the DLL
b) Reduced code reusability
c) Slower program execution due to dynamic loading
d) Incompatibility with modern operating systems
**Solution:** a) Increased memory usage for each program using the DLL
**Question 10:** Which utility can be used to view the functions and symbols within a DLL?
a) regedit
b) Dependency Walker
c) Disk Cleanup
d) Device Manager
**Solution:** b) Dependency Walker
Subjective Short Notes
Midterm & Finalterm Prepration
Past papers included
Download PDF
**Question 1:** What is a Dynamic Link Library (DLL)?
**Answer:** A DLL is a modular file format used in Windows operating systems to store executable code and resources that multiple programs can share, enabling code reusability and efficient memory usage.
**Question 2:** How does a DLL promote code reusability?
**Answer:** A DLL allows multiple programs to share the same code and resources, reducing redundancy and making it easier to update and maintain the shared functionality.
**Question 3:** Explain the process of dynamically loading a DLL in a program.
**Answer:** Dynamically loading a DLL involves using functions like LoadLibrary and GetProcAddress to load the DLL into memory and retrieve function addresses, enabling the program to call functions from the DLL at runtime.
**Question 4:** What is the difference between static linking and dynamic linking?
**Answer:** Static linking includes all required code in the final executable, while dynamic linking references external DLLs at runtime. DLLs facilitate dynamic linking, leading to smaller executable sizes and more efficient memory usage.
**Question 5:** How can version compatibility issues arise when using DLLs?
**Answer:** Different versions of a DLL might have changes in function signatures or behavior, causing programs to malfunction if they're linked to an incompatible version.
**Question 6:** What is the role of the "GetProcAddress" function in working with DLLs?
**Answer:** GetProcAddress retrieves the memory address of a function within a loaded DLL, allowing the program to call that function dynamically.
**Question 7:** How can memory leaks occur when using DLLs?
**Answer:** If a program does not properly release the resources allocated by a DLL after usage, it can lead to memory leaks as those resources remain allocated.
**Question 8:** Explain the term "DLL Hell."
**Answer:** DLL Hell refers to compatibility issues arising from conflicts between different versions of DLLs, potentially causing errors or crashes in applications that rely on them.
**Question 9:** Can DLLs be used in other operating systems besides Windows?
**Answer:** While DLLs are primarily associated with Windows, similar concepts (e.g., shared libraries) exist in other operating systems like Linux (with .so files) and macOS (with .dylib files).
**Question 10:** What are the advantages of using DLLs over statically linking code?
**Answer:** DLLs promote code reusability, reduce redundancy, and allow for easier updates without recompiling the entire program, resulting in smaller executable sizes and efficient memory usage.