Xamarin Certification Trivia 5 — Questions and Answers
Question 1: Which NuGet package provides SQLite database support commonly used in Xamarin apps?
- EntityFramework.Sqlite
- sqlite-net-pcl (Correct answer)
- Xamarin.SQLite
- SQLitePCLRaw
Correct answer: sqlite-net-pcl
sqlite-net-pcl is the most popular lightweight ORM for SQLite in Xamarin applications.
Question 2: What is the function of the IValueConverter interface in Xamarin.Forms data binding?
- Converts types between platforms
- Transforms data between the View and ViewModel (Correct answer)
- Converts XAML to C#
- Maps JSON to objects
Correct answer: Transforms data between the View and ViewModel
IValueConverter transforms bound data as it flows between the View and ViewModel, for example converting a boolean to a visibility value.
Question 3: Which Xamarin.Forms page type uses swipeable tabs for navigation?
- NavigationPage
- MasterDetailPage
- TabbedPage (Correct answer)
- CarouselPage
Correct answer: TabbedPage
TabbedPage provides a tabbed interface that allows users to switch between pages using tabs.
Question 4: What is the recommended approach for handling platform differences in a .NET MAUI/Xamarin project without custom renderers?
- OnPlatform markup extension (Correct answer)
- Platform.IsAndroid check
- #if ANDROID preprocessor
- Dependency injection
Correct answer: OnPlatform markup extension
The OnPlatform markup extension in XAML allows setting different property values per platform inline.
Question 5: In Xamarin.Forms, what is the MessagingCenter used for?
- Push notifications
- Loosely coupled messaging between components (Correct answer)
- In-app chat features
- Logging messages to App Center
Correct answer: Loosely coupled messaging between components
MessagingCenter provides a publish/subscribe mechanism for loosely coupled communication between ViewModels and other components.
Question 6: Which package is used to implement the MVVM pattern's INotifyPropertyChanged efficiently in Xamarin?
- Prism
- MvvmLight
- PropertyChanged.Fody (Correct answer)
- ReactiveUI
Correct answer: PropertyChanged.Fody
PropertyChanged.Fody automatically weaves INotifyPropertyChanged implementations at compile time, eliminating boilerplate code.
Question 7: What is the significance of the [Preserve] attribute in Xamarin.iOS applications?
- Marks code as thread-safe
- Prevents the linker from removing types or members (Correct answer)
- Keeps UI elements in memory
- Preserves user settings across updates
Correct answer: Prevents the linker from removing types or members
The [Preserve] attribute instructs the Xamarin.iOS linker to keep a type or member even if it appears unused, preventing runtime errors.
Which NuGet package provides SQLite database support commonly used in Xamarin apps?