Xamarin Certification Xamarin.Forms 2 — Questions and Answers
Question 1: Which Xamarin.Forms layout arranges children in a single row or column?
- Grid
- StackLayout (Correct answer)
- AbsoluteLayout
- RelativeLayout
Correct answer: StackLayout
StackLayout arranges child views in a single horizontal or vertical line using its Orientation property.
Question 2: What is the purpose of the BindingContext in Xamarin.Forms?
- Sets the default font for all child elements
- Defines the source object for data bindings on a view and its children (Correct answer)
- Specifies the navigation stack root
- Controls the visual state of a control
Correct answer: Defines the source object for data bindings on a view and its children
BindingContext sets the default data source that binding expressions on the view and its children resolve against.
Question 3: Which method in the Application class is called when the app goes to the background?
- OnStart
- OnResume
- OnSleep (Correct answer)
- OnPause
Correct answer: OnSleep
OnSleep is called by the Xamarin.Forms Application class when the application transitions to the background.
Question 4: In Xamarin.Forms Shell, what attribute on a ContentPage registers it as a navigation route?
- Shell.NavBarIsVisible
- Route (Correct answer)
- Shell.TabBarIsVisible
- Shell.PresentationMode
Correct answer: Route
The Route property (set via Shell.Route or RouteFactory) registers a page as a named destination for Shell navigation.
Question 5: Which interface must a ViewModel implement to notify the UI of property changes in Xamarin.Forms?
- IDisposable
- INotifyCollectionChanged
- INotifyPropertyChanged (Correct answer)
- IValueConverter
Correct answer: INotifyPropertyChanged
INotifyPropertyChanged requires implementing the PropertyChanged event, which the binding engine subscribes to for UI updates.
Question 6: What does the CollectionView differ from ListView in Xamarin.Forms?
- CollectionView only supports horizontal scrolling
- CollectionView has no support for data binding
- CollectionView offers flexible layout options including grids and requires no ViewCell wrapper (Correct answer)
- CollectionView is only available on iOS
Correct answer: CollectionView offers flexible layout options including grids and requires no ViewCell wrapper
CollectionView supports multiple layout strategies (linear, grid) and does not require items to be wrapped in ViewCell.
Question 7: Which XAML markup extension is used to reference a resource defined in a ResourceDictionary?
- {Binding}
- {StaticResource} (Correct answer)
- {DynamicResource}
- {x:Reference}
Correct answer: {StaticResource}
StaticResource looks up a key in the ResourceDictionary at parse time and does not update if the resource changes at runtime.
Which Xamarin.Forms layout arranges children in a single row or column?