Recently Updated WPF Multiple choice Questions
1) The TextBox control shows a default context menu with options to Cut, Copy and Paste. Can we override this context menu by defining our own in the TextBox control?
A. True
B. False
Ans: A
2) Can we store the ContextMenu in Resource so that we can reuse it for various control on a form?
A. True
B. False
Ans: A
3) In WPF Padding controls how much extra space gets placed around the inside edges of the element.
A. True
B. False
Ans: A
4) Visibility (defined on UIElement) might sound like a strange property to talk about in the context of layout, but it is indeed relevant. An element’s Visibility property actually isn’t Boolean, but rather a three-state System.Windows.Visibility enumeration. One of Its value is “Collapsed” What is the meaning of this value
A. The element is invisible yet still participates in layout.
B. The element is invisible and does not participate in layout
C. The element gets rendered and participates in layout.
D. None of the above
Ans: B
5) BAML can’t be decompiled back into XAML
A. True
B. False
Ans: B
6) the .NET Framework 4.0 introduces a handful of new features for the XAML language. This second generation of the XAML language is referred to as
A. XAML2006
B. XAML2008
C. XAML2009
D. None of these
Ans: C
7) FrameworkElement is derived from
A. UIElement
B. ContentControl
C. Application
D. Control
Ans: A
8.WPF separates the appearance of an user interface from its behavior. The appearance is generally specified in the_______.
A. HTML
B. XAML
C. XML
D. XSLT
Ans: B
9. Which of the following layout is not available in WPF?
A. StackPanel
B. Canvas
C. Grid
D. Table
Ans: D
10.x:Static and data binding markup extensions are same.True or false?
A. True
B. False
Ans: B
11.WPF is a replacement to DirectX.True or False?
A. True
B. False
Ans: B
12.which is dependency property in this code:
A. Width
B. Canvas.Left
C. Canvas
D. None of above
Ans: B
13. Transformations are available in which namespace?
A. System.Windows.UIElement
B. System.Windows.FrameworkElement
C. System.Windows.Media
D. None of above
Ans: C
14.Which tool(s)is/are used to develop WPF applications?
A. Visual Studio
B. Expression Blend
C. Both a & b
D. Only a
Ans: C
15.WrapPanel Class comes under___________ assembly.
A. PresentationCore
B. PresentationFramework
C. milcore
D. None of above
Ans: B
16.Development is more efficient because designers can implement an application’s appearance simultaneously with developers who are implementing the application’s behavior.True or false?
A. True
B. False
Ans: A
17.A key element of the Trustworthy Computing initiative in WPF is_______.
A. XAML
B. SDL
C. XAP
D. None of above
Ans: B
18.Which of the following is routing strategy of Routed events?
A. Bubbling
B. Direct
C. Tunneling
D. All of above
Ans: D
19. Child controls are virtualized and arranged on a single line that is either horizontally or vertically oriented. Is true about?
A. DockPanel
B. VirtualizingStackPanel
C. WrapPanel
D. StackPanel
Ans: B
20.Child controls are positioned in left-to-right order and wrapped to the next line when there are more controls on the current line than space allows.Is true about?
A. WrapPanel
B. StackPanel
C. VirtualizingStackPanel
D. DockPanel
Ans: A
21.In DockPanel Child controls are aligned to the edges of the panel.True or False?>
A. True
B. False
Ans: A
22.Which of the following is not WPF model(used to create a new control/custom control)?
A. User Control Model
B. Control Model
C. Framework Element Model
D. Element Model
Ans: D
23.One of the primary architectural philosophies used in building WPF was a preference for properties over methods or events.
A. True
B. False
Ans: A
24.Which of the following class is used to implement Trees in WPF?
A. LogicalTreeHelper
B. VisualTreeHelper
C. AbstractTreeHelper
D. a & b
Ans: D
25._______class provides the GetChildren, GetParent, and FindLogicalNode methods for logical tree traversal.
A. LogicalTreeHelper
B. VisualTreeHelper
C. AbstractTreeHelper
D. a & b
Ans:A
26. ________ is a DependencyProperty instance, which is obtained as a return value when registering a dependency property, and then stored as a static member of a class.
A. Dependency property
B. Dependency property identifier
C. CLR “wrapper”
D. None of above
Ans: B
27. Windows Presentation Foundation (WPF) introduces _______ events that can invoke handlers that exist on various listeners in the element tree of an application.
A. routed
B. bubbled
C. child
D. None of above
Ans: A
31.The________attribute works for FrameworkElement and FrameworkContentElement used for consistency.
A. Class
B. Name
C. Key
D. Value
Ans: B
32.All XAML resources should have an________attribute in WPF.
A. x:Name
B. x:Class
C. x:Value
D. x:Key
Ans: D
33. x:Null specifies null as a value for a property and can be used either for attributes or property element values.True or False?
A. True
B. False
Ans: A
34.__________provides a value for a property by deferring that value to be a run-time reference to a resource.
A. StaticResource
B. DynamicResource
C. RelativeSource
D. Binding
Ans: B
35.___________provides a value for a property by substituting the value of an already defined resource.
A. StaticResource
B. DynamicResource
C. RelativeSource
D. Binding
Ans: A
36.____________provides source information for a Binding that can navigate several possible relationships in the run-time object tree.
A. StaticResource
B. DynamicResource
C. RelativeSource
D. Binding
Ans: C
37._________provides a data bound value for a property, using the data context that applies to the parent object at run time.
A. StaticResource
B. DynamicResource
C. RelativeSource
D. Binding
Ans: D
38. What is full form of WPF?
a)Windows Presentation FoundationClass
b)Windows Precomputed FoundationClass
c)Windows Presentation Functions
d)None of These
Ans: A
39. What is XAML?
a)Extensible and Markup Language
b)Extensible Application Markup Language
c)Xtra Application Markup Language
d)None of These
Ans: B
40. Does that mean WPF has replaced DirectX?
a)Yes
b)No
Ans: B
41. Is XAML meant only for WPF ?
a)Yes
b)No
Ans: B
42. What is the stand for is XBAP?
A. extensible based application
B. XAML Browser Application
C. XAML Based Application
D. none
Ans: B
43. Which of the following have two states of Freezable object?
A. Fix and Unfix
B. Frozen and unfrozen.
C. Static and Dynamic
D. None
Ans: B
44. Which layout control would be the best choice for a user interface that requires evenly spaced controls laid out?
A. Grid
B. Canvas
C. UniformGrid
D. EvenlyGrid
Ans: C
45. Events Supported by WPF is are?
A. Direct Event
B. Bubbling Event
C. Tunneling Event
D. All of the above
Ans: D
46. WPF transformations can be used for
A. Only rotaion
B. Only scaling
C. Only skewing
D. rotation, scaling, and skewing
Ans: D
47. Which object can be used share the variable across pages in WPF?
A. Application
B. Session
C. Cookies
D. Viewstate
Ans: A
48. Which of the following is true regarding XAML?
A. Separation of designer code and logic
B. Tools like Expression Blend do not support XAML.
C. XAML is platform independent.
D. All of the above
Ans: A
49. How you can set a working mnemonic key for a label?
A. Set the Target property to the target control. Precede the letter for the mnemonic key with an underscore symbol in the Content property of the Label control.
B. You must place both the Label control and the Target property in the same container.
C. Set the Mnemonic Key property on the Label control.
D. None
Ans: A
50. In WPF which language is used to express user interface?
A. XML
B. XAML
C. WSDL
D. C#
Ans: B
51. WPF supports which type of application
A. Windows Application
B. Navigation Application
C. XBAP
D. All of the above
Ans: D
52. What are the different Data Binding Modes available in WPF?
1)OneWay
2)TwoWay
3)OneWayToSource
4)OneTime
A. Only 1,2
B. Only 2,3
C. Only 3,4
D. 1,2,3,4
Ans: D
53. Which class is used for data binding in WPF?
A. Data
B. DataReader
C. Binding
D. System.Data
Ans: C
54. Which Two types of Logical Resources available in WPF?
A. StaticResource and Dynamic Resource
B. StaticResource and CompileResource
C. WPF does not support Logical Resources
D. None of the above
Ans: A
55. By using which control you can set the property of control at run time?
A. Grid
B. PropertyGrid
C. ChangePropertyGrid
D. DynamicPropertyGrid
Ans: B
56. WPF application can be deployed by?
A. ClickOnce
B. ClickTwice
C. ClickThrice
D. None
Ans: A
57. How many child controls can a content control contain?
A. 1
B. 2
C. 3
D. No Limit
Ans: A
58. For Showing the dialog box modally which method is used?
A. Show
B. ShowDialog
C. Show modally
D. OpenDialog
Ans: B
59. Which of the following is TRUE?
1. Tunneling Event is raised first by the topmost container
2. PreviewMouseDown is Tunneling Event
3. PreviewKeyDown is Tunneling Event
4. MouseDown is Bubbling Event
A. Only 1,2
B. Only 2,4
C. Only 1,2,3
D. 1,2,3,4
Ans: D
60. In WPF for Drag and Drop facility which class is used?
A. DragDrop
B. DoDragDrop
C. WPF Does not support Drag and Drop facility
D. None of the above
Ans: A
61. What is full form of WPF?
a)Windows Presentation FoundationClass
b)Windows Precomputed FoundationClass
c)Windows Presentation Functions
d)None of These
Ans: a
62. What is XAML?
a)Extensible and Markup Language
b)Extensible Application Markup Language
c)Xtra Application Markup Language
d)None of These
Ans: b
63. Does that mean WPF has replaced DirectX?
a)Yes
b)No
Ans: b
64. Is XAML meant only for WPF ?
a)Yes
b)No
Ans: b
65. What is the stand for is XBAP?
a) extensible based application
b) XAML Browser Application
c) XAML Based Application
d) none
Ans: b
66. You are creating a Windows Presentation Foundation application by using Microsoft .NETFramework 3.5. The application uses several asynchronous operations to calculate data that isdisplayed to the user. An operation named tommorowsWeather performs calculations that will be usedby other operations.You need to ensure that tommorowsWeather runs at the highest possible priority.Which code segment should you use?
A. tomorrowsWeather.Dispatcher.BeginInvoke( _ System.Windows.Threading.DispatcherPriority.Normal, _ New OneArgDelegate(AddressOf UpdateUserInterface), weather)
B. tomorrowsWeather.Dispatcher.BeginInvoke( _ System.Windows.Threading.DispatcherPriority.DataBind, _ New OneArgDelegate(AddressOf UpdateUserInterface), weather)
C. tomorrowsWeather.Dispatcher.BeginInvoke( _ System.Windows.Threading.DispatcherPriority.Send, _ New OneArgDelegate(AddressOf UpdateUserInterface), weather)
D. tomorrowsWeather.Dispatcher.BeginInvoke( _ System.Windows.Threading.DispatcherPriority.Render, _ New OneArgDelegate(AddressOf UpdateUserInterface), weather)
Ans: C
67. You create a form by using Windows Presentation Foundation and Microsoft .NET Framework 3.5.The form contains astatus bar.You plan to add a ProgressBar control to the status bar.You need to ensure that the ProgressBar control displays the progress of a task for which you cannotpredict the completion time.Which code segment should you use?
A. progbar.IsIndeterminate = True
B. progbar.IsIndeterminate = False
C. progbar.HasAnimatedProperties = True
D. progbar.HasAnimatedProperties = False
Ans: a
68. You create a form by using Windows Presentation Foundation and Microsoft .NET Framework 3.5.The form contains a status bar.You plan to add a ProgressBar control to the status bar.You need to ensure that the ProgressBar control displays the progress of a task for which you cannotpredict the completion time.Which code segment should you use?
A. progbar.IsIndeterminate = true;
B. progbar.IsIndeterminate = false;
C. progbar.HasAnimatedProperties = true;
D. progbar.HasAnimatedProperties = false;
Ans: A
69. You are creating a Windows Presentation Foundation application by using Microsoft .NETFramework 3.5. The application uses several asynchronous operations to calculate data that isdisplayed to the user. An operation named tommorowsWeather performs calculations that will be usedby other operations.You need to ensure that tommorowsWeather runs at the highest possible priority.Which code segment should you use?
A. tomorrowsWeather.Dispatcher.BeginInvoke( _ System.Windows.Threading.DispatcherPriority.Normal, _ New OneArgDelegate(AddressOf UpdateUserInterface), weather)
B. tomorrowsWeather.Dispatcher.BeginInvoke( _ System.Windows.Threading.DispatcherPriority.DataBind, _ New OneArgDelegate(AddressOf UpdateUserInterface), weather)
C. tomorrowsWeather.Dispatcher.BeginInvoke( _ System.Windows.Threading.DispatcherPriority.Send, _ New OneArgDelegate(AddressOf UpdateUserInterface), weather)
D. tomorrowsWeather.Dispatcher.BeginInvoke( _ System.Windows.Threading.DispatcherPriority.Render, _ New OneArgDelegate(AddressOf UpdateUserInterface), weather)
Ans: C
70. You are creating a Windows Presentation Foundation application by using Microsoft .NETFramework 3.5. You add a CommandBinding element to the Window element. The command has akeyboard gesture CTRL+H. The Window contains thefollowing MenuItem control.You need to ensure that the MenuItem control is disabled and the command is not executable whenthe focus shifts to a TextBox control that does not contain any text.What should you do?
A. Set the IsEnabled property for the MenuItem control in the GotFocus event handler for the TextBoxcontrols.
B. Set the CanExecute property of the command to Highlight_CanExecute.Add the following method to the code-behind file for the window.private void Highlight_CanExecute(object sender, CanExecuteEventArgs e) {TextBox txtBox = sender as TextBox;e.CanExecute = (txtBox.Text.Length > 0);}
C. Set the CanExecute property of the command to Highlight_CanExecute.Add the following method to the code behind file for the window.private void Highlight_CanExecute(object sender, CanExecuteEventArgs e) {TextBox txtBox = e.Source as TextBox;e.CanExecute = (txtBox.Text.Length > 0);}
D. Set the CanExecute property of the command to Highlight_CanExecute.Add the following method to the code behind file for the window.private void Highlight_CanExecute(object sender, CanExecuteEventArgs e) {MenuItem menu = e.Source as MenuItem;TextBox txtBox = menu.CommandTarget as TextBox;Menu.IsEnabled = (txtBox.Text.Length > 0);}
Ans: C