Desktop Application Ultimate Desktop Application 4 — Questions and Answers
Question 1: In a desktop application, what is the typical purpose of the application's configuration file (e.g., app.config or settings.json)?
- To store the compiled binary
- To persist user preferences and environment-specific settings without recompiling (Correct answer)
- To log runtime errors
- To define the UI layout
Correct answer: To persist user preferences and environment-specific settings without recompiling
Configuration files store settings like connection strings and feature flags that can be changed without modifying or recompiling the application code.
Question 2: Which design pattern is most commonly used to implement undo/redo functionality in desktop applications?
- Singleton
- Observer
- Command (Correct answer)
- Decorator
Correct answer: Command
The Command pattern encapsulates actions as objects, allowing them to be stored, undone, and redone by maintaining a history stack.
Question 3: What is a manifest file in the context of a Windows desktop application?
- A list of third-party licenses
- An XML file that declares required runtime version, DPI awareness, and privilege level (Correct answer)
- A binary resource file
- A configuration for the build system
Correct answer: An XML file that declares required runtime version, DPI awareness, and privilege level
A Windows application manifest is an XML file that specifies metadata like the required .NET version, DPI awareness mode, and UAC execution level.
Question 4: Which approach best handles crash reporting in a production desktop application?
- Show an error code and exit silently
- Integrate a crash reporting SDK (e.g., Sentry, Crashpad) to capture and upload crash dumps automatically (Correct answer)
- Write errors only to the console
- Ask the user to email a screenshot
Correct answer: Integrate a crash reporting SDK (e.g., Sentry, Crashpad) to capture and upload crash dumps automatically
Crash reporting SDKs automatically capture stack traces and crash dumps and upload them so developers can diagnose and fix issues.
Question 5: What is the difference between modal and modeless dialogs in desktop applications?
- Modal dialogs are resizable; modeless are fixed size
- Modal dialogs block interaction with the parent window; modeless dialogs allow it (Correct answer)
- Modal dialogs are invisible; modeless are visible
- Modal dialogs close automatically; modeless require user action
Correct answer: Modal dialogs block interaction with the parent window; modeless dialogs allow it
A modal dialog blocks all input to the parent window until dismissed, while a modeless dialog can coexist with other windows simultaneously.
Question 6: In cross-platform desktop development with Qt, what is the build system file used to define project structure?
- .vcxproj
- .xcodeproj
- .pro or CMakeLists.txt (Correct answer)
- Makefile only
Correct answer: .pro or CMakeLists.txt
Qt projects traditionally use .pro files with qmake, but CMakeLists.txt with CMake is now the recommended build system for Qt 6 projects.
Question 7: What is lazy loading in the context of a large desktop application?
- Loading all modules at startup for speed
- Deferring the loading of modules or resources until they are actually needed (Correct answer)
- Caching data permanently in memory
- Skipping validation checks to speed up loading
Correct answer: Deferring the loading of modules or resources until they are actually needed
Lazy loading defers loading of non-critical modules or resources until they are needed, reducing startup time and initial memory usage.
In a desktop application, what is the typical purpose of the application's configuration file (e.g., app.config or settings.json)?