Xamarin Certification Xamarin Certification 2 — Questions and Answers
Question 1: Which Xamarin.Forms layout arranges children in a single row or column?
- AbsoluteLayout
- StackLayout (Correct answer)
- RelativeLayout
- FlexLayout
Correct answer: StackLayout
StackLayout arranges child views in a single horizontal or vertical line.
Question 2: What is the purpose of the DependencyService in Xamarin.Forms?
- To manage database connections
- To access platform-specific functionality from shared code (Correct answer)
- To handle HTTP requests
- To bind ViewModels to Views
Correct answer: To access platform-specific functionality from shared code
DependencyService allows shared code to call platform-specific implementations registered on each platform.
Question 3: In Xamarin.Android, which method is called when an Activity is first created?
- OnStart()
- OnResume()
- OnCreate() (Correct answer)
- OnInitialize()
Correct answer: OnCreate()
OnCreate() is the first lifecycle method called when an Android Activity is instantiated.
Question 4: Which binding mode in Xamarin.Forms updates the source when the target changes?
- OneWay
- OneWayToSource (Correct answer)
- TwoWay
- Default
Correct answer: OneWayToSource
OneWayToSource propagates changes from the binding target back to the binding source.
Question 5: What attribute is used to register a Xamarin.Forms custom renderer?
- [ExportRenderer] (Correct answer)
- [RegisterRenderer]
- [CustomRenderer]
- [PlatformRenderer]
Correct answer: [ExportRenderer]
The [ExportRenderer] assembly-level attribute maps a Xamarin.Forms control to its platform-specific renderer.
Question 6: Which interface must a ViewModel implement to support property change notifications in Xamarin.Forms MVVM?
- INotifyDataChanged
- IPropertyChanged
- INotifyPropertyChanged (Correct answer)
- IBindingContext
Correct answer: INotifyPropertyChanged
INotifyPropertyChanged exposes the PropertyChanged event that data bindings listen to for UI updates.
Question 7: In Xamarin.iOS, what is the equivalent of Android's Activity?
- UIWindow
- UIViewController (Correct answer)
- UIApplication
- UIScene
Correct answer: UIViewController
UIViewController manages a single screen of content in iOS, analogous to an Android Activity.
Which Xamarin.Forms layout arranges children in a single row or column?