Visual Programming MCQs with Answers
Practice important Visual Programming MCQs with answers and explanations.
Chapter: 27
Q521:
Which XAML property should be used to display images from local resources in a WPF application?
A. Source
B. ImageSource
C. PackUri
D. ResourceUri
Correct Answer:
A
Chapter: 27
Q522:
How do you embed a binary resource in a WPF application?
A. Add the file to the project and set its Build Action to Resource
B. Add the file to the project and set its Build Action to Content
C. Use the EmbeddedResource build action in the file properties
D. Place the file in the Resources folder and load it using ResourceLoader
Correct Answer:
A
Chapter: 27
Q523:
What does the ApplicationDeployment.CurrentDeployment.DownloadFileGroupAsync method do in a WPF XBAP?
A. It initiates the download of a file group and allows monitoring the download progress
B. It synchronously downloads a single file from a URL
C. It downloads a single file from the local file system
D. It clears the application cache
Correct Answer:
A
Chapter: 27
Q524:
What is the purpose of the BrowserInteropHelper.Source property in XBAP?
A. To retrieve the complete URL of the currently hosted page
B. To set the URL for navigation in the application
C. To get the local file path of a resource
D. To retrieve browser cookies
Correct Answer:
A
Chapter: 27
Q525:
Which of the following is a valid way to handle file open dialogs in a XBAP application?
A. By using the OpenFileDialog class and its ShowDialog method
B. By using the SaveFileDialog class and its ShowDialog method
C. By using the FilePicker class and its Open method
D. By directly accessing file paths without dialogs
Correct Answer:
A
Chapter: 27
Q526:
What XAML attribute should be used to display an image stored in a loose file?
A. Source="pack://siteoforigin:,,,/image.gif"
B. Source="pack://application:,,,/image.gif"
C. Source="/images/image.gif"
D. Source="images/image.gif"
Correct Answer:
A
Chapter: 27
Q527:
How do you set up a full-trust XBAP application in the project file?
A. By changing <targetzone>Internet</targetzone> to <targetzone>Custom</targetzone>
B. By setting <targetzone>Custom</targetzone> in the Application settings
C. By adding a new Custom target zone in the project properties
D. By configuring the ClickOnce manifest with custom permissions
Correct Answer:
A
Chapter: 27
Q528:
What should be used to handle progress notifications during file downloads in XBAP?
A. System.Deployment.Application.ApplicationDeployment.DownloadFileGroupCompleted event
B. System.Deployment.Application.ApplicationDeployment.DownloadProgressChanged event
C. System.Windows.Controls.ProgressBar
D. System.Windows.Threading.Dispatcher
Correct Answer:
A
Chapter: 27
Q529:
How should you manage resources like images and fonts in a WPF application?
A. Add them as Resource or Content and refer to them using pack://application:,,, URIs
B. Add them as EmbeddedResource and access them directly using file paths
C. Use ResourceManager class to load resources at runtime
D. Load resources using Assembly.GetManifestResourceStream
Correct Answer:
A
Chapter: 27
Q530:
What is the purpose of the AllowPartiallyTrustedCallers attribute in WPF applications?
A. It allows partially trusted code to call the assembly marked with this attribute
B. It ensures that the assembly can only be called by fully trusted code
C. It restricts the assembly to be used only in a local context
D. It grants unrestricted access to all resources in the assembly
Correct Answer:
A
Chapter: 27
Q531:
What is the significance of the pack://application:,,,/ URI scheme in WPF?
A. It is used to reference embedded resources in a WPF application
B. It is used to access external web resources
C. It is used to navigate between pages in a WPF application
D. It is used to reference loose XAML files on the local disk
Correct Answer:
A
Chapter: 28
Q532:
What is the purpose of partitioning resources into satellite assemblies?
A. To manage and update resources for different cultures separately
B. To increase the size of the main assembly
C. To reduce the performance overhead of the application
D. To simplify the build process for the main assembly
Correct Answer:
A
Chapter: 28
Q533:
Which tool is used to parse and generate localized resources for WPF applications?
A. LocBAML
B. MSBuild
C. ResourceManager
D. ResGen
Correct Answer:
A
Chapter: 28
Q534:
How do you specify the default culture for localization in a WPF project?
A. By setting <uiculture> in the project file
B. By configuring System.Globalization.CultureInfo in code
C. By setting the NeutralResourcesLanguage attribute in the assembly's AssemblyInfo file
D. By modifying the CultureInfo in the XAML file
Correct Answer:
C
Chapter: 28
Q535:
What does the StaticResource markup extension do in XAML?
A. It retrieves a resource from the application-level resource dictionary
B. It creates a new instance of a resource each time it is referenced
C. It binds the resource to a dynamic property in the application
D. It updates the resource value dynamically as it changes
Correct Answer:
A
Chapter: 28
Q536:
How can you change a resource dynamically in WPF?
A. By using DynamicResource markup extension
B. By using StaticResource markup extension
C. By using ResourceDictionary only
D. By directly modifying the resource file
Correct Answer:
A
Chapter: 28
Q537:
What is the role of the x:Shared attribute in XAML?
A. It controls whether a resource is shared across multiple elements or not
B. It specifies the default resource for the application
C. It sets the localization culture for the resource
D. It defines the resource's scope within the XAML file
Correct Answer:
A
Chapter: 28
Q538:
How do you localize string resources using LocBAML?
A. By parsing and generating resource files using CSV format
B. By embedding string resources directly in the XAML file
C. By creating separate assemblies for each locale and adding them to the project
D. By modifying the application manifest to include localization settings
Correct Answer:
A
Chapter: 28
Q539:
How would you access a resource named backgroundbrush from C# code in a WPF application?
A. Brush)window.Resources["backgroundbrush"]
B. Brush)FindResource("backgroundbrush")
C. Button.Background = (Brush)FindResource("backgroundbrush")
D. Button.Background = (Brush)window.FindResource("backgroundbrush")
Correct Answer:
B
Chapter: 28
Q540:
What is the primary difference between StaticResource and DynamicResource in WPF?
A. StaticResource does not update if the resource changes, while DynamicResource does
B. DynamicResource is used for application-wide resources, while StaticResource is local
C. StaticResource loads resources on demand, while DynamicResource loads them at application start
D. DynamicResource is used for resources in code-behind only
Correct Answer:
A