Desktop Application Desktop Application MCQ 2 — Questions and Answers
Question 1: Which Windows API function is used to create a new process from a desktop application?
- SpawnProcess()
- CreateProcess() (Correct answer)
- NewProcess()
- StartProcess()
Correct answer: CreateProcess()
CreateProcess() is the Windows API function used to create a new process and its primary thread.
Question 2: In a desktop application, what is the purpose of a message loop (also called a message pump)?
- To send emails from the application
- To continuously retrieve and dispatch window messages from the queue (Correct answer)
- To handle network socket messages
- To log application errors to a file
Correct answer: To continuously retrieve and dispatch window messages from the queue
A message loop continuously retrieves messages from the thread's message queue and dispatches them to the appropriate window procedure.
Question 3: What does the term 'DPI awareness' mean in the context of desktop applications?
- The application can detect printer dots per inch
- The application correctly scales its UI for high-resolution displays (Correct answer)
- The application supports data processing instructions
- The application monitors CPU usage
Correct answer: The application correctly scales its UI for high-resolution displays
DPI awareness means the application is designed to scale its UI elements correctly on high-DPI (dots per inch) displays to avoid blurry or oversized rendering.
Question 4: Which pattern is commonly used in desktop GUI frameworks to separate business logic from the user interface?
- Singleton
- Observer
- MVC (Model-View-Controller) (Correct answer)
- Factory
Correct answer: MVC (Model-View-Controller)
MVC separates an application into three components — Model (data/logic), View (UI), and Controller (input handling) — to keep concerns separate.
Question 5: In Windows desktop development, what is a 'handle' (HWND, HANDLE, etc.)?
- A pointer to a physical device
- An opaque reference used by the OS to identify a resource (Correct answer)
- A callback function pointer
- A string identifier for a window class
Correct answer: An opaque reference used by the OS to identify a resource
A handle is an opaque, OS-managed reference (integer or pointer) that identifies a resource such as a window, file, or process.
Question 6: What is the main advantage of using an installer (e.g., MSI, NSIS) for distributing a desktop application?
- It compresses source code for faster downloads
- It handles dependency installation, registry entries, and shortcuts automatically (Correct answer)
- It converts the app to a web application
- It prevents reverse engineering of the binary
Correct answer: It handles dependency installation, registry entries, and shortcuts automatically
Installers automate placing files in correct directories, writing registry keys, installing dependencies, and creating shortcuts during setup.
Question 7: Which technology allows a .NET desktop application to run on both Windows and macOS?
- .NET Framework 4.8
- .NET Core / .NET 5+ (Correct answer)
- COM Interop
- WinForms only
Correct answer: .NET Core / .NET 5+
.NET Core (and its successors .NET 5, 6, 7, 8+) is cross-platform, enabling apps to run on Windows, macOS, and Linux.
Which Windows API function is used to create a new process from a desktop application?