Visual Programming MCQs with Answers
Practice important Visual Programming MCQs with answers and explanations.
Multiple Choice Questions
Q481: What does the Execute method of an ICommand do?
- A: Executes the logic associated with the command
- B: Checks if the command can be executed
- C: Changes the appearance of the UI element
- D: Updates the command's status
View Answer
A
Q482: In the provided XAML example, how is the Help command bound to the button?
- A: By setting the Command property to Help
- B: By adding a CommandBinding for Help
- C: By defining the Help command in the InputBindings section
- D: By using the Command property in the code-behind
View Answer
A
Q483: How can you handle multiple commands in a single CommandBinding?
- A: By specifying different Executed and CanExecute event handlers for each command
- B: By using multiple CommandBindings for different commands
- C: By defining a single Executed event handler that switches between commands
- D: By creating custom command logic within the CommandBinding event handlers
View Answer
A
Q484: What is the purpose of ApplicationCommands in WPF?
- A: To provide a set of predefined commands for common operations
- B: To create custom commands for specific controls
- C: To handle application-wide events
- D: To define custom input gestures for commands
View Answer
A
Q485: How do CommandBindings and InputBindings differ in WPF?
- A: CommandBindings are used for defining command logic, while InputBindings handle input gestures
- B: CommandBindings handle input gestures, while InputBindings define command logic
- C: CommandBindings are for keyboard input, while InputBindings are for mouse input
- D: CommandBindings manage application-level commands, while InputBindings are for control-specific commands
View Answer
A
Q486: In the provided code example, what will the helpexecuted method do?
- A: Open a URL in the default web browser
- B: Change the window title
- C: Update the status bar text
- D: Show a message box to the user
View Answer
A
Q487: What is the default behavior of Help command in the aboutdialog XAML if not properly bound?
- A: The command will be disabled
- B: The command will not execute
- C: The command will execute but with no effect
- D: The command will throw an exception
View Answer
A
Q488: What property can be used to center a WPF window on the screen when it starts?
- A: Left and Top
- B: WindowStartupLocation
- C: Topmost
- D: ShowInTaskbar
View Answer
B
Q489: What event is triggered when a WPF window is about to be closed?
- A: OnClosing
- B: OnClosed
- C: OnActivated
- D: OnDeactivated
View Answer
A
Q490: How can you ensure a WPF application always starts with a specific window?
- A: By setting the StartupUri property in App.xaml
- B: By calling Show on the main window in the Main method
- C: By setting the MainWindow property in App.xaml.cs
- D: By using Application.Run method in Main
View Answer
A