Visual Programming MCQs with Answers
Practice important Visual Programming MCQs with answers and explanations.
Multiple Choice Questions
Q561: How do you define a custom converter for a binding in XAML?
- A: Use the Converter property in the binding
- B: Define the converter class in the code-behind
- C: Set the Converter property in the DataTemplate
- D: Specify the converter in the resource dictionary and reference it in the binding
View Answer
A
Q562: What does setting IsSynchronizedWithCurrentItem="True" do in a collection view?
- A: It ensures the current item is synchronized across multiple controls bound to the same collection
- B: It allows the current item to be updated independently from other controls
- C: It enables sorting and grouping of the collection
- D: It automatically filters the collection based on current item
View Answer
A
Q563: How do you specify sorting criteria in a collection view in WPF?
- A: Use SortDescriptions to define the fields and order of sorting
- B: Use FilterDescriptions to define the sorting order
- C: Use GroupDescriptions to set the sorting criteria
- D: Use SortOrder to specify sorting order
View Answer
A
Q564: Which method clears all existing sort descriptions in a collection view?
- A: ClearSortDescriptions()
- B: RemoveSortDescriptions()
- C: SortDescriptions.Clear()
- D: ResetSort()
View Answer
C
Q565: How do you group items in a collection view by a specific property?
- A: Add a PropertyGroupDescription to the GroupDescriptions collection
- B: Add a SortDescription to the SortDescriptions collection
- C: Set the GroupBy property on the ItemsSource
- D: Use SetGrouping method on the collection view
View Answer
A
Q566: What is the purpose of a DataTemplate in WPF?
- A: To define how data objects should be visually represented
- B: To bind a property to a specific data source
- C: To provide custom sorting logic for data objects
- D: To filter data objects based on specific criteria
View Answer
A
Q567: How does the Filter property of ICollectionView work?
- A: It allows specifying a predicate to include or exclude items from the view
- B: It sorts the items in the view based on specified criteria
- C: It groups items in the view based on a specified property
- D: It sets the default value for items in the view
View Answer
A
Q568: What is the effect of using SortDescriptions.Add(new SortDescription("Name", ListSortDirection.Ascending))?
- A: It sorts the collection by the "Name" property in ascending order
- B: It groups the collection items by the "Name" property in ascending order
- C: It filters the collection to include only items with the "Name" property in ascending order
- D: It sets the default sorting direction for all properties
View Answer
A
Q569: How do you filter items in a collection view to include only those from the last 7 days?
- A: Use a predicate in the Filter property of ICollectionView
- B: Apply SortDescriptions to include only recent items
- C: Group items by date and filter by the current date
- D: Use DataTemplate to filter items based on date
View Answer
A
Q570: Which property is used to set the visual representation of grouped items in a ListBox?
- A: GroupStyle
- B: ItemTemplate
- C: DisplayMemberPath
- D: SortDescriptions
View Answer
A