Visual Programming MCQs with Answers
Practice important Visual Programming MCQs with answers and explanations.
Chapter: 17
Q361:
In the XAML example, which property is used to set the font size of a TextElement?
A. FontSize
B. TextSize
C. Size
D. TextElementFontSize
Correct Answer:
A
Chapter: 17
Q362:
What is the equivalent C# code to set the FontSize of a TextElement?
A. TextElement.SetFontSize(element, 30);
B. TextElement.SetFontSize(30);
C. TextElement.SetFontSize(element, value);
D. TextElement.FontSizeProperty.SetValue(element, 30);
Correct Answer:
C
Chapter: 17
Q363:
How do you register an attached property in WPF?
A. DependencyProperty.RegisterAttached
B. DependencyProperty.AddOwner
C. DependencyProperty.Register
D. DependencyProperty.Create
Correct Answer:
A
Chapter: 17
Q364:
Which method is used to set the value of an attached property in WPF?
A. SetValue
B. SetAttachedValue
C. UpdateValue
D. AssignValue
Correct Answer:
A
Chapter: 17
Q365:
What does the FrameworkPropertyMetadataOptions.Inherits option specify for a dependency property?
A. The property value is inherited by child elements.
B. The property value is static and cannot be changed.
C. The property value is read-only.
D. The property value can only be set programmatically.
Correct Answer:
A
Chapter: 17
Q366:
What is the purpose of the Tag property in WPF elements?
A. To store arbitrary custom data.
B. To set the visibility of an element.
C. To determine the type of the element.
D. To define default property values.
Correct Answer:
A
Chapter: 17
Q367:
How does the Visibility property differ between Collapsed and Hidden in WPF?
A. Collapsed does not participate in layout; Hidden does participate in layout.
B. Collapsed is visible; Hidden is invisible.
C. Collapsed means the element is not rendered; Hidden means the element is rendered but invisible.
D. Collapsed means the element is invisible but still takes up space; Hidden means the element is not rendered and does not take up space.
Correct Answer:
A
Chapter: 17
Q368:
What is the default value for HorizontalAlignment in a Button control?
A. Left
B. Center
C. Stretch
D. Right
Correct Answer:
A
Chapter: 17
Q369:
Which property is used to control the space inside the edges of a Control element?
A. Padding
B. Margin
C. Spacing
D. Inset
Correct Answer:
A
Chapter: 17
Q370:
What does the FlowDirection property affect in WPF?
A. The direction in which text and layout flow.
B. The size of the layout containers.
C. The visibility of elements in the layout.
D. The rendering quality of elements.
Correct Answer:
A
Chapter: 17
Q371:
Which class provides the RenderTransform and LayoutTransform properties?
A. FrameworkElement
B. Transform
C. UIElement
D. Visual
Correct Answer:
A
Chapter: 17
Q372:
What is the primary difference between RenderTransform and LayoutTransform in WPF?
A. RenderTransform affects how the element is rendered; LayoutTransform affects the element's layout size and position.
B. RenderTransform affects the layout only; LayoutTransform affects rendering quality.
C. RenderTransform affects the layout and rendering; LayoutTransform affects only rendering quality.
D. RenderTransform affects visual appearance; LayoutTransform affects data binding.
Correct Answer:
A
Chapter: 17
Q373:
What does Thickness represent in WPF layout properties?
A. The space around an element, which can be set to one, two, or four values.
B. The maximum height of an element.
C. The amount of space inside the edges of an element.
D. The distance from the element to its container's border.
Correct Answer:
A
Chapter: 17
Q374:
How do you specify a margin in XAML that represents 10 pixels on all sides?
A. <Element Margin="10"/>
B. <Element Margin="10, 10, 10, 10"/>
C. <Element Margin="10,10"/>
D. <Element Margin="10,10,10"/>
Correct Answer:
A
Chapter: 17
Q375:
Which WPF property affects how a control's content fills the space inside the control?
A. HorizontalContentAlignment
B. HorizontalAlignment
C. VerticalAlignment
D. ContentAlignment
Correct Answer:
A
Chapter: 17
Q376:
What method is used to get the value of an attached property in WPF?
A. GetValue
B. RetrieveValue
C. FetchValue
D. AccessValue
Correct Answer:
A
Chapter: 17
Q377:
What value of Visibility makes an element invisible and not participate in layout?
A. Collapsed
B. Hidden
C. Visible
D. None
Correct Answer:
A
Chapter: 17
Q378:
How is the FlowDirection property used for right-to-left languages in WPF?
A. Set FlowDirection to RightToLeft.
B. Set FlowDirection to LeftToRight.
C. Set FlowDirection to TopToBottom.
D. Set FlowDirection to BottomToTop.
Correct Answer:
A
Chapter: 18
Q379:
What is the difference between LayoutTransform and RenderTransform in WPF?
A. LayoutTransform is applied before rendering, RenderTransform is applied after rendering.
B. LayoutTransform affects size and position; RenderTransform affects only appearance.
C. RenderTransform affects layout; LayoutTransform affects appearance.
D. LayoutTransform is applied after rendering, RenderTransform is applied before rendering.
Correct Answer:
A
Chapter: 18
Q380:
Which property is used to specify the origin for rendering transforms?
A. RenderTransformOrigin
B. TransformOrigin
C. TransformPosition
D. RenderingOrigin
Correct Answer:
A