Desktop Application Ultimate Desktop Application 5 — Questions and Answers
Question 1: Which approach is recommended for storing sensitive credentials (e.g., API keys) in a desktop application?
- Hardcode them in source code
- Store them in a plain text config file
- Use the OS credential store (e.g., Windows Credential Manager, macOS Keychain) (Correct answer)
- Encode them in Base64 in the binary
Correct answer: Use the OS credential store (e.g., Windows Credential Manager, macOS Keychain)
OS credential stores are encrypted and access-controlled, making them the secure option for storing sensitive credentials in desktop apps.
Question 2: What is the primary advantage of using a virtual DOM in Electron or web-based desktop applications?
- It directly manipulates hardware memory
- It minimizes actual DOM updates by diffing the virtual and real DOM, improving rendering performance (Correct answer)
- It stores the DOM on disk for persistence
- It allows offline rendering without a GPU
Correct answer: It minimizes actual DOM updates by diffing the virtual and real DOM, improving rendering performance
The virtual DOM computes a diff between old and new states and only updates the changed real DOM nodes, reducing expensive reflows and repaints.
Question 3: When implementing auto-update functionality in a desktop application, which protocol is most commonly used to check for and download updates?
- FTP
- SMTP
- HTTPS (Correct answer)
- Bluetooth
Correct answer: HTTPS
HTTPS is used for auto-update checks and downloads because it provides encryption and server authentication, preventing man-in-the-middle attacks.
Question 4: What is the purpose of the Windows Registry in relation to desktop applications?
- To store executable binaries
- To provide a hierarchical database for system and application configuration settings (Correct answer)
- To manage active processes
- To cache downloaded files
Correct answer: To provide a hierarchical database for system and application configuration settings
The Windows Registry is a hierarchical database that stores configuration settings for both the OS and installed applications.
Question 5: In a .NET desktop application, what is the difference between Application.Exit() and Environment.Exit()?
- They are identical
- Application.Exit() gracefully shuts down the message loop; Environment.Exit() terminates the process immediately (Correct answer)
- Environment.Exit() only works on Linux
- Application.Exit() restarts the application
Correct answer: Application.Exit() gracefully shuts down the message loop; Environment.Exit() terminates the process immediately
Application.Exit() posts a quit message to the message loop for a clean shutdown, while Environment.Exit() forcefully terminates the process and can skip cleanup code.
Question 6: What is a system tray (notification area) application, and what is its primary use case?
- A full-screen application without a taskbar
- A background application with a small icon in the OS notification area for quick access (Correct answer)
- An application that only shows notifications
- A widget embedded in the desktop wallpaper
Correct answer: A background application with a small icon in the OS notification area for quick access
System tray applications run in the background and display a small icon in the OS notification area, allowing users to access settings or status without a full window.
Question 7: Which accessibility API is used on Windows to allow assistive technologies like screen readers to interact with desktop application UI elements?
- WinSock
- DirectX Accessibility Layer
- UI Automation (UIA) (Correct answer)
- DXGI
Correct answer: UI Automation (UIA)
UI Automation (UIA) is the Windows accessibility framework that exposes UI elements to assistive technologies such as Narrator and NVDA.
Which approach is recommended for storing sensitive credentials (e.g., API keys) in a desktop application?