Skip to main content

Visual Programming MCQs with Answers

Practice important Visual Programming MCQs with answers and explanations.

Multiple Choice Questions

Q301: What does the XAML <Button xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" Content="OK"/> correspond to in C#?
  • A: System.Windows.Controls.Button b = new System.Windows.Controls.Button(); b.Content = "OK";
  • B: System.Windows.Controls.Button b = new System.Windows.Controls.Button(); b.Content = "OK"; b.Click += new System.Windows.RoutedEventHandler(button_Click);
  • C: System.Windows.Controls.Button b = new System.Windows.Controls.Button(); b.Content = "OK";
  • D: System.Windows.Controls.Button b = new System.Windows.Controls.Button(); b.Click += new System.Windows.RoutedEventHandler(button_Click); b.Content = "OK";
View Answer
A

Q302: What is the purpose of the xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" declaration in XAML?
  • A: To define the XAML language namespace for special directives
  • B: To map .NET types to XML namespaces
  • C: To set the background color of an element
  • D: To specify a default constructor for an object
View Answer
A

Q303: How does an object element in XAML differ from a property element?
  • A: An object element has attributes; a property element does not
  • B: A property element can contain child elements; an object element cannot
  • C: An object element initializes .NET objects; a property element sets properties
  • D: A property element initializes .NET objects; an object element sets properties
View Answer
C

Q304: What does the <Button.Background><SolidColorBrush Color="White"/></Button.Background> XAML code represent?
  • A: Setting the button's background color using a brush converter
  • B: Setting the button's background color directly in C#
  • C: Setting the button's background using a markup extension
  • D: Defining a type converter for the button's background color
View Answer
A

Q305: What does the XAML <Button Content="{Binding Path=Height, RelativeSource={RelativeSource Mode=Self}}"/> do?
  • A: Binds the button's content to its own height property
  • B: Sets the button's content to a static value
  • C: Applies a custom markup extension to the button's content
  • D: Sets the button's content to the height of another control
View Answer
A

Q306: How are property elements in XAML typically identified?
  • A: By the period (.) in their syntax
  • B: By using x: prefix for attributes
  • C: By being wrapped in curly braces ({})
  • D: By not having attributes except x:uid
View Answer
A

Q307: What is a primary use of type converters in XAML?
  • A: To convert string values to corresponding data types
  • B: To define the layout of XAML elements
  • C: To bind data from external sources
  • D: To add custom attributes to XAML elements
View Answer
A

Q308: How does a markup extension differ from a type converter in XAML?
  • A: Markup extensions are invoked with explicit syntax and can be used in property element syntax
  • B: Type converters are used for converting string values to types
  • C: Markup extensions are used only in XML namespaces
  • D: Type converters provide built-in conversions only
View Answer
A

Q309: What is the result of using the XAML <ListBox><ListBoxItem Content="Item 1"/><ListBoxItem Content="Item 2"/></ListBox>?
  • A: A ListBox with two items: "Item 1" and "Item 2"
  • B: A ListBox with a single item: "Item 1"
  • C: A ListBox with two items added programmatically in C#
  • D: A ListBox with one item containing two strings
View Answer
A

Q310: What does the XAML <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"><Color x:Key="1" A="255" R="255" G="255" B="255"/><Color x:Key="2" A="0" R="0" G="0" B="0"/></ResourceDictionary> define?
  • A: A dictionary of color resources with specified keys and values
  • B: A collection of items in a ListBox
  • C: A dictionary of font resources with specified keys and values
  • D: A set of style definitions for XAML elements
View Answer
A

Test Your Knowledge

Take a timed quiz on Visual Programming

🚀 Start Quiz Now