Visual Programming MCQs with Answers
Practice important Visual Programming MCQs with answers and explanations.
Chapter: 20
Q421:
How does the ScrollViewer handle overflow content?
A. It provides scroll bars to navigate through the overflow content.
B. It clips the overflow content to fit within the viewable area.
C. It scales the overflow content to fit the viewable area.
D. It hides the overflow content from view.
Correct Answer:
A
Chapter: 20
Q422:
What attribute ensures multiple columns have the same width in a Grid when resized?
A. SharedSizeGroup
B. Width
C. Height
D. Stretch
Correct Answer:
A
Chapter: 20
Q423:
What happens if ClipToBounds is set to True on a TextBlock?
A. It clips any text that overflows the bounds of the TextBlock.
B. It allows the text to overflow outside the TextBlock bounds.
C. It adjusts the text size to fit within the TextBlock bounds.
D. It makes the TextBlock ignore text size settings.
Correct Answer:
A
Chapter: 21
Q424:
What is the purpose of SharedSizeGroup in a Grid layout?
A. It ensures columns with the same size group remain the same width when resized.
B. It makes all columns in the grid have the same width regardless of content.
C. It automatically adjusts row heights based on content.
D. It hides grid lines of columns in the shared size group.
Correct Answer:
A
Chapter: 21
Q425:
How does a GridSplitter function in a Grid layout?
A. It allows interactive resizing of rows or columns.
B. It sets the alignment of grid cells.
C. It changes the background color of the grid.
D. It adjusts the font size of the grid content.
Correct Answer:
A
Chapter: 21
Q426:
In the provided XAML, what is the role of Grid.ColumnSpan="2"?
A. It makes the element span across two columns.
B. It makes the element span across two rows.
C. It sets the width of the column to twice its default value.
D. It centers the element horizontally in the grid.
Correct Answer:
A
Chapter: 21
Q427:
How does the DockPanel manage its child elements in the provided XAML example?
A. It positions child elements relative to the edges of the panel.
B. It arranges child elements in a horizontal stack.
C. It aligns child elements to the center of the panel.
D. It layers child elements on top of each other.
Correct Answer:
A
Chapter: 21
Q428:
What does the Visibility="Collapsed" attribute do in XAML?
A. It hides the element and does not allocate space for it.
B. It hides the element but still allocates space for it.
C. It shows the element but with reduced opacity.
D. It makes the element visible but not interactive.
Correct Answer:
A
Chapter: 21
Q429:
What does the StackPanel control do in XAML?
A. It arranges child elements in a single line either horizontally or vertically.
B. It allows for complex grid layouts with resizable columns and rows.
C. It provides a container for elements with automatic scrolling.
D. It arranges elements in a circular layout.
Correct Answer:
A
Chapter: 21
Q430:
What is the function of Grid.SetZIndex in the provided code?
A. It controls the rendering order of UI elements.
B. It sets the width of columns in a grid.
C. It aligns elements within a grid cell.
D. It defines the background color of a grid cell.
Correct Answer:
A
Chapter: 21
Q431:
What is the purpose of EventManager.RegisterRoutedEvent in WPF?
A. It registers a routed event so that it can be handled by event handlers.
B. It creates a new UI element in the visual tree.
C. It registers a custom dependency property.
D. It sets the visibility of an event source.
Correct Answer:
A
Chapter: 21
Q432:
What are RoutedEvents in WPF?
A. Events that can traverse up or down the visual or logical tree.
B. Events that are only triggered by user interactions.
C. Events that are specific to a single UI element.
D. Standard .NET events that do not participate in routing.
Correct Answer:
A
Chapter: 21
Q433:
How does the PreviewMouseRightButtonDown event differ from MouseRightButtonDown?
A. PreviewMouseRightButtonDown is a tunneling event that occurs before MouseRightButtonDown.
B. PreviewMouseRightButtonDown occurs after MouseRightButtonDown.
C. PreviewMouseRightButtonDown only applies to text input, not mouse events.
D. MouseRightButtonDown is a bubbling event that occurs before PreviewMouseRightButtonDown.
Correct Answer:
A
Chapter: 21
Q434:
What does the Click event in the Button class do?
A. It is a routed event that handles button click actions.
B. It only handles mouse clicks on the button's border.
C. It manages changes to the button's visual appearance.
D. It handles keyboard input when the button is focused.
Correct Answer:
A
Chapter: 21
Q435:
In the MainWindow code, what does the pane1pin_Click method do?
A. It toggles the visibility of Pane 1 between docked and undocked states.
B. It initializes the size of Pane 1.
C. It changes the background color of Pane 1.
D. It hides Pane 1 when the mouse enters it.
Correct Answer:
A
Chapter: 21
Q436:
How is Layer0 used in the provided XAML and code?
A. It acts as a base layer that adjusts column definitions when panes are docked or undocked.
B. It manages the visibility of the buttons in the StackPanel.
C. It handles the click events for the buttons in the interface.
D. It defines the layout for the Menu in the DockPanel.
Correct Answer:
A
Chapter: 21
Q437:
What does the pane1button_mouseenter event handler do?
A. It shows Pane 1 and hides Pane 2 if Pane 2 is undocked.
B. It changes the text color of Pane 1.
C. It adjusts the alignment of Pane 1 within the DockPanel.
D. It resizes Pane 1 to fit the content.
Correct Answer:
A
Chapter: 21
Q438:
How does Layer1 visibility change when toggling Pane 1?
A. It is set to Collapsed when Pane 1 is docked and Visible when undocked.
B. It is set to Visible when Pane 1 is docked and Collapsed when undocked.
C. It remains always Visible regardless of the docking state.
D. It changes its visibility based on the time of day.
Correct Answer:
B
Chapter: 21
Q439:
What does the pane2pin_Click method do in the MainWindow class?
A. It toggles the visibility of Pane 2 between docked and undocked states.
B. It initializes the size of Pane 2.
C. It sets the color of Pane 2 to white.
D. It hides Pane 2 when the mouse enters it.
Correct Answer:
A
Chapter: 21
Q440:
What does e.Source represent in an event handler?
A. The logical tree element that originally raised the event.
B. The visual tree element that originally raised the event.
C. The source of the event as defined by the system.
D. The UI element that is currently focused.
Correct Answer:
A